Unformatted text preview: watching the program in action, while having considerable control over its execution. Figure 3.26 shows examples of some GDB commands that help when working with machine-level, IA32 programs. It is very helpful to ﬁrst run OBJDUMP to get a disassembled version of the program. Our examples were based on running GDB on the ﬁle prog, described and disassembled on page 96. We would start GDB with the command line:
unix> gdb prog 166 CHAPTER 3. MACHINE-LEVEL REPRESENTATION OF C PROGRAMS Command
Starting and Stopping quit run kill Breakpoints break sum break *0x80483c3 delete 1 delete Execution stepi stepi 4 nexti continue finish Examining code disas disas sum disas 0x80483b7 disas 0x80483b7 0x80483c7 print /x $eip Examining data print $eax print /x $eax print /t $eax print 0x100 print /x 555 print /x ($ebp+8) print *(int *) 0xbffff890 print *(int *) ($ebp+8) x/2w 0xbffff890 x/20b sum Useful information info frame info registers help Effect
Exit GDB Run your program (give command line arguments here) Stop your program Set breakpoint at entry to function sum Se...
View Full Document