1 / 19

The Usage of Linux Debugging Techniques Ramya B.B.

The Usage of Linux Debugging Techniques Ramya B.B. Agenda. What is Debugger ? Significance, options, tools and scenario Working with GDB Working with DDD KDB - Introduction Linux Trace Toolkit . What is a Debugger ?. Insect repellant – software tool

azana
Download Presentation

The Usage of Linux Debugging Techniques Ramya B.B.

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. The Usage of Linux Debugging TechniquesRamya B.B.

  2. Agenda • What is Debugger ? • Significance, options, tools and scenario • Working with GDB • Working with DDD • KDB - Introduction • Linux Trace Toolkit

  3. What is a Debugger ? • Insect repellant – software tool • Detect the source of program errors • Step through the malfunctioning portion of the program to examine data and check operational conditions.

  4. Significance of Debugging • Working procedure of the program • Problems using printf statements • Localizing error • Tracing the bug

  5. Options to Debug Stepping Breakpoint Watch points Catch points

  6. Linux Debugging Tools • GDB – GNU debugger • DDD – Data Display Debugger • KDB – Kernel Debugger • LTT – Linux Tool Trace Kit • ……….. etc

  7. Debugging scenario • Testing • Localization • Correction • Verification

  8. Working with GDB • Allow you to see what is going on “inside” program while it executes • 4 things to help you catch bugs 1 Start your program with specifying anything that might affect its behavior. 2 Make your program stop on specified conditions. 3 Examine when your program has stopped. 4 Change things in your program

  9. GDB Session • Compile the program : gcc –g < file name > • Open the gdb session : gdb <filename> • gdb Commands • break [line number ] - set breakpoint at specified line • run - run program • print expr/variable - print the result of expr/var • c - continue execution • next, step - next instruction/line • watch - watch an expression • info locals - local variables • help - built-in help • Delete breakpoints - delete the breakpoints

  10. GDB-Example • (gdb) break 2 • Breakpoint 1 at 0x8048406: file a.c, line 2. • (gdb) run • The program being debugged has been started already. • Start it from the beginning? (y or n) y • Starting program: /root/ramya/a • Breakpoint 1, main () at a.c:3 • 3 printf ("%s", fd); • (gdb) n • Program received signal SIGSEGV, Segmentation fault. • 0x42080b43 in strlen () from /lib/i686/libc.so.6 • (gdb) n • Single stepping until exit from function strlen, • which has no line number information. • Program terminated with signal SIGSEGV, Segmentation fault. • The program no longer exists. • (gdb) quit

  11. Working with DDD • DDD – Data Display Debugger • Is a GUI clone of GDB • Provides all functionalities of GDB • Compile using –g Start the session with • ddd <filename>

  12. DDD Windows

  13. KDB- Introduction • KDB – Kernel Debugger • Does not require additional machine • Patch to kernel code • Download the patches and compile with the kernel debugger support

  14. KDB Commands • Memory display & modification md – displays memory starting address mdr – displays the raw contents of the memory mm – modifies the memory contents mmW – changes W bytes starting at the address

  15. KDB Commands • Register Display and Modification rd – displays processor register rd c – displays control register rd d – displays debug register rd u – displays register set of current task rm – modifies content of register ef - displays a exception frame at the specified address

  16. KDB Commands • Breakpoints bp -- applies breakpoint at the address bpa – applies breakpoints on all processors in SMP system bd – disables a breakpoint be – enables a breakpoint bl – list the current set of breakpoints bc – clears the breakpoint

  17. Linux Trace Toolkit • Provides information about dynamic behavior of system • Full featured GUI • Linux kernel tracing capabilities with many trace points. • Micro-second event time-stamps. • Support for real time application interface

  18. References • GDB [1]sources.redhat.com/gdb/current/onlinedocs/gdb_toc.html • DDD [1] www.gnu.org/manual/ddd/ • KDB [1] http://kgdb.sourceforge.net/ [2] www-106.ibm.com/developerworks/linux/library/ l-kdbug/ • LTT [1] //http://www.opersys.com/LTT/index.html

  19. Thank You Ramya B.B. Wipro Technologies ramya.balaraj@wipro.com

More Related