Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

淺入淺出 GDB

1,961 views

Published on

Published in: Technology
  • Be the first to comment

淺入淺出 GDB

  1. 1. GNU Debugger
  2. 2. Debugger!
  3. 3. Debugger ?
  4. 4. bug
  5. 5. ?
  6. 6. !
  7. 7. bug ?
  8. 8. debug
  9. 9. ↑ ↑ ↓ ↓ ← → ← → BA
  10. 10. printf
  11. 11. RUNTIME TRACING
  12. 12. DYNAMIC ANALYSIS
  13. 13. • • • • •
  14. 14. Good and Evil
  15. 15. Good and Evil
  16. 16. White and Black
  17. 17. White -box and Black -box
  18. 18. Debug Event
  19. 19. Breakpoints
  20. 20. soft Breakpoint
  21. 21. hardware Breakpoint
  22. 22. memory Breakpoint
  23. 23. Memory violation
  24. 24. Memory violation (segmentation faults)
  25. 25. Exceptions
  26. 26. GDB
  27. 27. ?
  28. 28. $ gcc test.c -o test.o $ ./test.o
  29. 29. $ gcc -g test.c -o test.o $ gdb test.o
  30. 30. file run start main break Ctrl+c list [line/function] print [var] next [times] step [times] until [line] continue finish function jump [line] info [command] (ex:info break)
  31. 31. Breakpoint help breakpoints breakpoints break [line] breakpoint break [function] info break breakpoints delete [n] breakpoint ( ) clear [line] breakpoint ( ) enable [n] breakpoint ( ) enable once [n] breakpoint break disable [n] breakpoint ( ) ignore [n] [cont] breakpoint ( ) (cont ) condition [n] [cond] cond break break [line] [cond] break 10 if n > 5 commands [n] break ,
  32. 32. watchpoint watch [var] var break rwatch [var] var break awatch [var] var info watch break watch point
  33. 33. display step next display [var] display undisplay [n] n display enable display n display [n] disable display n display [n] display info display table
  34. 34. function calls backtrace function stack up down frame [n] frame return [var] return
  35. 35. • (gdb) help all • (gdb) help • Reference
  36. 36. gdbtui ccdebug Xcode cgdb Glewn GDBtk/Insight Xxgdb Emacs WDB GVD DDD Dev-c Nemiver KDb ........
  37. 37. gdbtui ccdebug Xcode cgdb Glewn GDBtk/Insight Xxgdb Emacs WDB GVD DDD Dev-c Nemiver KDb ........
  38. 38. gdbtui ccdebug Xcode cgdb Glewn GDBtk/Insight Xxgdb Emacs WDB GVD DDD Dev-c Nemiver KDb ........
  39. 39. GDB
  40. 40. Reference • GNU http://www.gnu.org/software/gdb/ • GNU Debugger (gdb) Part I http://jserv.sayya.org/debugger/HappyGDB-PartI-2008-07-12.pdf • debugger GNU GDB http://cse.tw/981class/file/upe3.pdf • Gray Hat Python • http://www.cmlab.csie.ntu.edu.tw/~daniel/linux/gdb.html • http://www.study-area.org/cyril/opentools/opentools/ x1253.html
  41. 41. Q&A

×