12.07.2015 Views

GDB/DDD Reference Sheet V1.0 (All commands work both in GDB ...

GDB/DDD Reference Sheet V1.0 (All commands work both in GDB ...

GDB/DDD Reference Sheet V1.0 (All commands work both in GDB ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Exam<strong>in</strong><strong>in</strong>g codepr<strong>in</strong>t/a $pc (pr<strong>in</strong>t the program counter)pr<strong>in</strong>t $sp (pr<strong>in</strong>t the stack po<strong>in</strong>ter)disas(display the function around the current l<strong>in</strong>e)<strong>DDD</strong>: (Have the Mach<strong>in</strong>e Code W<strong>in</strong>dow Display<strong>in</strong>g)To Turn Mach<strong>in</strong>e Code W<strong>in</strong>dow ON/OFF (SELECT => MACHINE CODE WINDOW)disas ADDR (display the function around the address)disas ADDR1 ADDR2 (display the function between the addresses)disas FUNCTION (displays the mach<strong>in</strong>e <strong>in</strong>structions for that function)EX. disas phase_1 (disassembles phase_1 function <strong>in</strong>structions)Exam<strong>in</strong><strong>in</strong>g datapr<strong>in</strong>t $eaxp/x $eaxp/a $eaxp/d $eaxp/t $eaxp/c $eaxp 0x100p/x 555(pr<strong>in</strong>t the contents of %eax)(pr<strong>in</strong>t the contents of %eax as hex)(pr<strong>in</strong>t the contents of %eax as an address)(pr<strong>in</strong>t the contents of %eax as decimal)(pr<strong>in</strong>t the contents of %eax as b<strong>in</strong>ary)(pr<strong>in</strong>t the contents of %eax as a character)(pr<strong>in</strong>t decimal repr. of hex value)(pr<strong>in</strong>t hex repr. of decimal value)x ADDR (pr<strong>in</strong>t the contents of ADDR <strong>in</strong> memory)x/NFU ADDR (pr<strong>in</strong>t the contents at ADDR <strong>in</strong> memory:N = number of units to displayF = display format-Uses all the same ones as pr<strong>in</strong>t (p) and hasthese additional ones:s = (pr<strong>in</strong>t-out null-term<strong>in</strong>ated str<strong>in</strong>g)i = (pr<strong>in</strong>t out mach<strong>in</strong>e <strong>in</strong>structions)U = b (bytes), h (2 bytes), w (4 bytes))Autodisplay<strong>in</strong>g <strong>in</strong>formationdisplay $eax (pr<strong>in</strong>t contents of %eax every time the program stops)display(pr<strong>in</strong>t the auto-displayed items)delete display (stop display<strong>in</strong>g item NUM)<strong>DDD</strong> (THIS WILL REALLY HELP!!):Display<strong>in</strong>g <strong>in</strong> the DATA WINDOWNote: To Turn Data W<strong>in</strong>dow ON/OFF (SELECT => DATA WINDOW)graph display `(p or x Command)`Ex. graph display `x/a $ebp+8`Ex. graph display `x/s *(<strong>in</strong>t*)($ebp+8)`(I casted value to a po<strong>in</strong>ter and than dereferenced)Ex. graph display `x/8xb 0x08048e2c`` = Tick Mark (below the Escape Key)Useful <strong>in</strong>formation <strong>commands</strong>help <strong>in</strong>fo<strong>in</strong>fo r (registers and their contents)<strong>DDD</strong>: Select Status => Registers<strong>in</strong>fo b (status of user-settable breakpo<strong>in</strong>ts)<strong>DDD</strong>: Select Source => Breakpo<strong>in</strong>ts<strong>in</strong>fo stack (backtrace of the stack)<strong>DDD</strong>: Select Status => Backtrace<strong>in</strong>fo address SYMBOL (use for look<strong>in</strong>g up addresses of functions)<strong>in</strong>fo frame (<strong>in</strong>formation about the current stack frame)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!