IBM Support

DEBUGGER COMMANDS (AIX DBX, SOLARIS DBX, LINUX GDB)

Technical Blog Post


Abstract

DEBUGGER COMMANDS (AIX DBX, SOLARIS DBX, LINUX GDB)

Body

Quick summary of commands attach process
detach process
list threads
select specific thread
current thread stack
specific thread stack
print registers
list loaded objects
remap library path
dump assembly code
breakpoint at function name (any thread will stop)
breakpoint at address (any thread will stop)
breakpoint at address (specified thread will stop)
list breakpoints
print memory content (display variable)
change memory content (assign variable)
redirect output to a file

 

 
attach process
dbx solaris dbx <executable> <pid>  
dbx aix dbx -a <pid>  
gdb linux gdb <executable> <pid>  
 
detach process
dbx solaris (dbx) detach  
dbx aix (dbx) detach  
gdb linux (gdb) detach  
 
list threads
dbx solaris (dbx) threads  
dbx aix (dbx) thread  
gdb linux (gdb) info thread  
 
select specific thread
dbx solaris (dbx) thread <tid> (dbx) thread t@8
dbx aix (dbx) thread current <tid> (dbx) thread current 8
gdb linux (gdb) thread <tid> (gdb) thread 8
 
current thread stack
dbx solaris (dbx) where  
dbx aix (dbx) where  
gdb linux (gdb) where  
 
specific thread stack
dbx solaris (dbx) where <tid> (dbx) where t@2
dbx aix (dbx) where <tid> (dbx) where $t2
gdb linux (gdb) thread apply <tid> where (gdb) thread apply 2 where
 
print registers
dbx solaris (dbx) regs  
dbx aix (dbx) registers  
gdb linux (gdb) info reg  
 
list loaded objects
dbx solaris (dbx) loadobject -list
(dbx) loadobjects -v
(dbx) proc -map
 
dbx aix (dbx) map  
gdb linux (gdb) info sharedlibrary  
 
remap library path
dbx solaris (dbx) pathmap <oldpath> <newpath> (dbx) pathmap /opt/DB2/lib64 /home/sqllib/lib64
dbx aix (dbx) -p <oldpath>=<newpath> dbx -p /opt/lib64/=/home/lib64/:/usr/packlib/=/new/lib/
gdb linux (gdb) set sysroot <path> (gdb) set sysroot /home/libraries
 
dump assembly code
dbx solaris (dbx) dis <function>
(dbx) listi <function>
(dbx) examine <address>,<address>/i
(dbx) examine <address>/<N>i
(dbx) dis main
(dbx) listi main
(dbx) examine 0x00010d34,0x00010d44/i
(dbx) examine 0x00010d34/512i
dbx aix (dbx) listi <function>
(dbx) <address>/<N>i
(dbx) listi handle_list
(dbx) 0x90000007bb3ff00/128i
gdb linux (gdb) disas <function>
(gdb) x/<N>i <address>
(gdb) disas main
(gdb) x/32i 0x0000000000400b64
 
breakpoint at function name (any thread will stop)
dbx solaris (dbx) stop in <function> (dbx) stop in queue_put
dbx aix (dbx) stop in <function> (dbx) stop in prt_regs
gdb linux (gdb) b <function> (gdb) b main
 
breakpoint at address (any thread will stop)
dbx solaris (dbx) stopi at <address> (dbx) stopi at 0x0000000100002b40
dbx aix (dbx) stopi at <address> (dbx) stopi at 0x0000000100001600
gdb linux (gdb) b <*address> (gdb) b *0x0000000000400b64
 
breakpoint at address (specified thread will stop)
dbx solaris (dbx) stopi at <address> -thread <tid> (dbx) stopi at 0x0000000100002db8 -thread t@1
dbx aix (dbx) tstopi at <address> for $t<tid> (dbx) tstopi at 0x900000118b86c44 for $t12
gdb linux (gdb) b <*address> thread <tid> (gdb) b *0x0000000000400b64 thread 21
 
list breakpoints
dbx solaris (dbx) status  
dbx aix (dbx) status  
gdb linux (gdb) info breakpoints  
 
print memory content (display variable)
dbx solaris (dbx) p *((<cast> *) <address>) (dbx) p *((int *) 0x100100c30)
  (dbx) examine <address>/<format> (dbx) examine 0x100100c30/D
dbx aix (dbx) p *((<cast> *) <address>) (dbx) p *((int *) 0x0000000110000730)
  (dbx) <address>/<format> (dbx) 0x0000000110000730/D
  (dbx) <address>,<address>/<format> (dbx) 0x0a00000005fff8c0,0x0a000000060355a0/X
gdb linux (gdb) p *((<cast> *) <address>) (gdb) p *((int *) 0xfffee290)
  (gdb) x/<format> <address> (gdb) x/wx 0xfffee270
 
change memory content (assign variable)
dbx solaris (dbx) assign *((<cast> *) <address>) = <value> (dbx) assign *((int *) 0x100100c30) = 88
dbx aix (dbx) assign <address> = <value> (dbx) assign 0x0000000110000730 = 32
gdb linux (gdb) p *((<cast> *) <address>) = <value> (gdb) p *((int *) 0xfffee290) = 0x4a
 
redirect output to a file
dbx solaris (dbx) > <filename> <command> (dbx) > /tmp/dump.out examine 0x100100c30/D
dbx aix (dbx) <command> > <filename> (dbx) 0x0000000110000730/D > /tmp/dump.out
gdb linux (gdb) set loggin file <filename>
(gdb) set loggin on
(gdb) <command>
(gdb) set loggin off
(gdb) set loggin file /tmp/dump.out
(gdb) set loggin on
(gdb) p *((int *) 0xfffee290) = 0x4a
(gdb) set loggin off
 

 

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

UID

ibm13286431