GDB: 두 판 사이의 차이
내용 삭제됨 내용 추가됨
편집 요약 없음 |
(차이 없음)
|
2006년 9월 18일 (월) 16:18 판
보통은 GDB라고 부르는 GNU 디버거는 GNU 소프트웨어 시스템을 위한 기본 디버거이다. GDB는 다양한 Unix 기반의 시스템에서 동작하는 이식성있는 디버거로, Ada, C, C++, 포트란 등의 여러 프로그래밍 언어를 지원한다.
역사
GDB는 1988년에서 리처드 스톨만에 의해 최초로 작성되었으며, GNU 일반 공중 사용 허가서하에 배포되는 자유 소프트웨어이다.
1990년에서 1993년에 걸쳐 시그너스 솔루션즈에서 근무하는 존 길모어에 의해 관리되었다.
기술적인 세부 사항
TO DO
커맨드의 사용 예
gdb prog.out prog.out 을 디버그 한다. gdb > run 프로그램을 실행시킨다
예제 세션
GNU gdb Red Hat Linux (6.3.0.0-1.21rh) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1". (gdb) run Starting program: /home/sam/programming/crash Reading symbols from shared object read from target memory...done. Loaded system supplied DSO at 0xc11000 This program will demonstrate gdb Program received signal SIGSEGV, Segmentation fault. 0x08048428 in function_2 (x=24) at crash.c:22 22 return *y; (gdb) edit (gdb) shell gcc crash.c -o crash -gstabs+ (gdb) run The program being debugged has been started already. Start it from the beginning? (y or n) y warning: cannot close "shared object read from target memory": File in wrong format `/home/sam/programming/crash' has changed; re-reading symbols. Starting program: /home/sam/programming/crash Reading symbols from shared object read from target memory...done. Loaded system supplied DSO at 0xa3e000 This program will demonstrate gdb 24 Program exited normally. (gdb) quit
먼저 프로그램을 실행시키고 세그먼트 폴트의 원인을 찾은 후에 올바른 동작을 하도록 수정(edit)하였다. 수정된 프로그램은 GCC를 통해 다시 컴파일된 후 실행되었다.
참고 문헌
- Richard M. Stallman, Roland Pesch, Stan Shebs, et al., Debugging with GDB (자유 소프트웨어 재단, 2002) ISBN 1-882114-88-4
바깥 고리
- GDB 홈페이지
- gdb 문서: "Debugging with GDB" (html 과 400 페이지 이상의 PDF로 제공)
- GDB Internals
- GDB 강좌
- kgdb, 리눅스 커널을 디버깅하기 위한 gdb 백엔드
- Peter Jay Salzman's excellent GDB guide