1 / 25

GDB

GDB. INDEX. 01 GDB. 02 실습. 03 단계별로 실행하기. 01 GDB. GDB. 가장 대표적인 디버거 GUN debugger( gdb ). GDB. gdb 주요 기능 정지 점 (Breakpoint) 설정 한 줄씩 실행 변 수 접근 및 수정 함 수 탐색 추 적 (Tracing). GDB. gdb 사용을 위한 컴파일 -g 옵션을 이용하여 컴파일 gcc –g –o longest longest.c. GDB. 다중 모듈 프로그램

ziya
Download Presentation

GDB

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. GDB

  2. INDEX 01 GDB 02 실습 03 단계별로 실행하기

  3. 01 GDB

  4. GDB • 가장 대표적인 디버거 • GUN debugger(gdb)

  5. GDB • gdb주요 기능 • 정지점(Breakpoint) 설정 • 한 줄씩 실행 • 변수 접근 및 수정 • 함수 탐색 • 추적(Tracing)

  6. GDB • gdb사용을 위한 컴파일 • -g 옵션을 이용하여 컴파일 • gcc –g –o longest longest.c

  7. GDB • 다중 모듈 프로그램 • gcc –g –o main main.ccopy.c

  8. GDB • gdb실행 • gcc [실행 파일] • gdb main

  9. GDB • 소스 보기 : l(ist) • l [줄 번호] 지정된 줄을 프린트 • l [파일명]:[함수명] 지정된 함수를 프린트 • set listsize n 출력되는 줄의 수를 n으로 변경

  10. GDB • 정지점: b(reak), clear, d(elete)

  11. GDB • 프로그램 수행

  12. GDB • 변수 값 프린트: p(rint)

  13. GDB

  14. GDB

  15. GDB • DDD(Data Display Debugger) • gdb를 위한 그래픽 사용자 인터페이스 • http://www.gnu.org/software/ddd

  16. 02 실습

  17. 실습 • 먼저 다음과 같은 버그가 있는 usedebug.c파일을 작성해보세요. (pp.384 예제) • (파일 이름은 자유롭게 하셔도 됩니다.)

  18. 실습 • gcc –g usedebug.c –o debug • gdbusedebug • gdb가 실행되면 run을 입력해보세요. • run은 gdb안에서 프로그램을 실행시키는 명령어입니다.

  19. 실습 • 변수 i의 값으로 임의의 값이 지정되어 있습니다. 원하는 프로그램은 변수 i를 이용하여 10에서 1씩 감소 시키면서 1까지 더하는 것입니다. 1까지 더해야 하는 종료 조건을 주지 않았으므로 이러한 문제가 발생한 것입니다.

  20. 03 단계별로 실행하기

  21. 단계별로 실행하기 • 실습예제 pp.396

  22. 단계별로 실행하기

  23. 단계별로 실행하기

  24. Q A ? ? ?

  25. Thank you

More Related