Gdb

From Attie's Wiki
(Difference between revisions)
Jump to: navigation, search
m (Created page with 'Useful GDB commands... {| | <code>bt</code> or <code>backtrace</code> || show a backtrace from the current location |- | <code>frame ''<frameno>''</code> || move to a different …')
 
m
 
(8 intermediate revisions by one user not shown)
Line 1: Line 1:
 
Useful GDB commands...
 
Useful GDB commands...
{|
+
{|class="wikitable"
 +
! Command !! Description
 +
|-
 
| <code>bt</code> or <code>backtrace</code> || show a backtrace from the current location
 
| <code>bt</code> or <code>backtrace</code> || show a backtrace from the current location
 
|-  
 
|-  
Line 15: Line 17:
 
| <code>info breakpoints</code> || list of breakpoints
 
| <code>info breakpoints</code> || list of breakpoints
 
|-
 
|-
| <code>break ''<file>'':''<lineno>'' || set a breakpoint
+
| <code>break ''<file>'':''<lineno>''</code> || set a breakpoint
 +
|-
 +
| <code>step</code> || step into the current line
 +
|-
 +
| <code>next</code> || step over the current line
 +
|-
 +
| <code>fin</code> || step out
 +
|-
 +
| <code>cont</code> || continue execution
 +
|-
 +
| <code>del ''<number>''</code> || delete a breakpoint (or multiple with <code>''<number> <number>''</code>)
 +
|-
 +
! - !! -
 +
|-
 +
| <code>x/x ''<address>''</code> || examine memory
 +
|-
 +
| <code>x/x ''<variable>''</code> || dump variable contents
 +
|-
 +
| <code>x/128xb ''<variable>''</code> || dump variable contents, 128 bytes (<code>b</code> byte / <code>h</code> halfword / <code>w</code> word / <code>g</code> giant, 8-bytes )
 +
|-
 +
| <code>x/s ''<variable>''</code> || dump variable contents, as a nul-terminated string
 +
|-
 +
| <code>x/32i ''<variable>''</code> || dump variable contents, as 32 machine instructions
 +
|-
 +
! - !! -
 +
|-
 +
| <code>generate-core-file</code> || it's a secret...
 +
|-
 +
| <code>thread apply all bt</code> || print a <code>bt</code> for all active threads
 +
|-
 +
! - !! -
 +
|-
 +
| <code>set logging file ''<filename>''</code> || log GDB's output to <code>''filename''</code>
 +
|-
 +
| <code>set logging on</code> || enable logging
 +
|-
 +
| <code>set logging off</code> || disable logging
 
|}
 
|}

Latest revision as of 11:32, 16 June 2016

Useful GDB commands...

Command Description
bt or backtrace show a backtrace from the current location
frame <frameno> move to a different stack frame
- -
info threads list of running threads
thread <threadno> switch to a different thread
- -
info breakpoints list of breakpoints
break <file>:<lineno> set a breakpoint
step step into the current line
next step over the current line
fin step out
cont continue execution
del <number> delete a breakpoint (or multiple with <number> <number>)
- -
x/x <address> examine memory
x/x <variable> dump variable contents
x/128xb <variable> dump variable contents, 128 bytes (b byte / h halfword / w word / g giant, 8-bytes )
x/s <variable> dump variable contents, as a nul-terminated string
x/32i <variable> dump variable contents, as 32 machine instructions
- -
generate-core-file it's a secret...
thread apply all bt print a bt for all active threads
- -
set logging file <filename> log GDB's output to filename
set logging on enable logging
set logging off disable logging
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox