1 / 12

Debugging with dbx

Debugging with dbx. interactive debugging tool to inspect the state of a stopped program complete control of the dynamical execution of a program evaluating and displaying data breakpoints. How to use dbx. Compile your program with option -g : > cc -g program.c -o program

aleta
Download Presentation

Debugging with dbx

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. Debugging with dbx • interactive debugging tool • to inspect the state of a stopped program • complete control of the dynamical execution of a program • evaluating and displaying data • breakpoints

  2. How to use dbx • Compile your program with option -g: > cc -g program.c -o program • Load your program in the debugger: > dbx program • Start your program: (dbx) run [arg] • Perhaps you can already see the location of the fault...

  3. A typical fault in your program.. • You get an informative massage > program Floating exception

  4. The same fault using dbx > dbx program dbx version 3.11.10 Type 'help' for help. main: 6 for (j=1;j<=10;j++){ (dbx) r signal Floating point exception at [function:21 +0x10,0x120001288] f=1.0/g; (dbx) where > 0 function(i = 10) ["program.c":21, 0x120001288] 1 main() ["program.c":13, 0x12000123c] (dbx) p g 0.0

  5. Controlling dbx • Lists all existing aliases: (dbx) alias • Lists currently set stop: commands (dbx) status • Delete stop commands: delete [<nr>|all]

  6. Controlling dbx (2) (dbx) stop at 6 [5] stop at "program.c":6 (dbx) stop at 19 [6] stop at "program.c":19 (dbx) status [5] stop at "program.c":6 [6] stop at "program.c":19 (dbx) delete 5 (dbx) status [6] stop at "program.c":19

  7. Examining Source • Calls an editor on the current file: edit • Lists 12 lines starting at line <line>: list [<line>] • Prints a type declaration: whatis <variable>

  8. Examining Source (2) (dbx) whatis g Integer g; (dbx) whereis g program.function.g (dbx) whatis program.function.g double g;

  9. Controlling Programs • Assign an expression to a program variable: assign <variable> • Resume execution: cont • Step over one line, dont go through a subroutine: next • Step over one line, go through a subroutine: step

  10. Execution tracing • Stops execution when <.variable> changes: stop <variable> • Stops execution when <procedure> is entered: stop in <procedure> • stops at line <line>: stop at <line>

  11. Examining Program State • Prints variable information about the current procedure: dump • Prints the value of variables: print <var1>,<var2> • Show the trace of the program: where

  12. Examining Program State (2) (dbx) run signal Segmentation fault at >*[fprintf, 0x3ff800dab60] ldq r16, 40(r16) (dbx) where > 0 fprintf(0x8008460d, 0x140000cc8, 0xffffffffffefffff, 0x100000, 0x0) [0x3ff800dab60] 1 main(argc = 2, argv = 0x11fffe708) ["sim.c":157, 0x120002d48]

More Related