1 / 13

CO004 Projects on Operating Systems

This project focuses on using GDB (GNU Debugger) for debugging C programs in operating systems. Learn essential GDB commands such as stepping through lines (s), stepping over lines (n), printing pointers (p.ptr), backtraces (bt), setting breakpoints (b), and continuing execution (c). Prerequisites include compiling with gcc using the right parameters (-ggdb) and verifying installations of gcc, gdb, and your text editor. Follow the GDB online manual for further details and ensure a smooth debugging experience through practical examples.

gale
Télécharger la présentation

CO004 Projects on Operating Systems

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. CO004 Projects on Operating Systems Debug 2 gdb and insight

  2. GDB commands • Use gdb directly (commands only) • s 2 (step in 2 lines) • n (step over 1 lines) • p ptr (print the value of ptr) • bt (back trace) • b (break point) • c (continue to run)

  3. GDB • Demo: • bugs.c • Prerequisite • Compile using proper parameter • gcc -ggdb -o bugs bugs.c • Reference • GDB Online Manual http://www.gnu.org/software/gdb/documentation/

  4. Insight+gdb • Things to Install • gcc • vim (or other text editor) • gdb • insight (or other debugger like “ddd”)

  5. Before Installation • Check which one has been installed • gcc –-version • gdb -–version • vim --version • insight --version

  6. You should see the source code Remember to use “gcc -ggdb xxxxxxx”, otherwise you cannot see any source code

  7. Breakpoint Program will stop before executing this statement!

  8. Breakpoint Program will stop before executing this statement!

  9. • Run : run/start the program • Step: Execute the current line of code, jump into the function if possible • Next: Similar to “Step”, but don’t jump into the function • Finish: Jump out of the current function • Continue: Execute until hitting another breakpoint

More Related