当前位置: 首页 > 工具软件 > Play-DBx > 使用案例 >

[转]dbx Command Summary

毛成济
2023-12-01

 

dbx Command Summary

 

Here is a local copy of short explanation of commands and dbx faq .

Basic Dbx Shell Commands

!!execute the previous command
rexecute the previous command
!<num>execute command number
! -<num>execute command <num> before the current
historylist a history of dbx commands
.read (source) dbx commands from a file
runstart the current process
killkill the controlled process
debugprint name and arguments of program being debugged
debug <prog> [<core>]debug <prog> with corefile <core>(optional)
debug <prog> <pid>attach to process <pid>
detachdetaches dbx from the controlled process
runargs <args>set the run arguments for the current program
runargs . . . [>|>>] file>output redirection for a program
runargs . . . < <file>input redirection for a program

print [-r] [-d] <statement>prints <statement>.
 <statement> can be a function call, a local variable, or a constant
 (though not a macro, because the c preprocessor and dbx don't
 work and play well together
-r-r prints inherited members in C++
-duses dynamic (RTTI) type information to determine the type of
 <statement>
print <arr>[<first>..<last>:<stride>]print an array slice
examine < addr> = [ <fmt> ]display an address in a format
examine <addr 1>, <addr 2> / fmtexamine memory in the given format
display <expr>display an expression
undisplay <num>turn off displaying expression number <num>
 (0 turns off all displays)
wheredisplay the stack trace.
upmove up one stack frame
downmove down one stack frame

iinstruction (disassembly)
d,Ddecimal (2 or 4 bytes)
o,Ooctal (2 or 4 bytes)
x,Xhexadecimal (2 or 4 bytes)
boctal (1 byte)
ccharacter
wwide character
sstring
Wwide character string
fhex and float (4 bytes, 6 digit prec.)
Fhex and float (8 bytes, 14 digit prec.)
gsame as `F'
Ehex and float (16 bytes, 14 digit prec.)
ld,lDdecimal (4 bytes, same as D)
lo,lOoctal (4 bytes, same as O)
lx,LXhexadecimal (4 bytes, same as X)
Ld,LDdecimal (8 bytes)
Lo,LOoctal (8 bytes)
Lx,LXhexadecimal (8 bytes)

stop <event> <modifier>stop execution when <event> occurs
trace <event> <modifier>print out a message when <event> happens.
tracei <event> <modifier>like above, but works on assembly instructions
when <event> <command> <modifier>execute <command> when <event>happens
dbxenv trace_speed <num>pause <num> seconds between traces
clear [<lineno>]clears events at <lineno> (defaults to current line)
statusPrint trace's, when's, and stop's in effect
status <hid>print the status of handler (event) <hid>
status -sprint all events in a form that dbx can read
 (dbx) status -s > bpts
  
 (dbx) source bpts
delete <num>delete handler <num> (0 deletes all handlers)
call <proc> <[params]>call <proc> with the given parameters
contcontinues execution
nextnext instruction (skip calls)
nextinext assembly instruction (skip calls)
stepnext instruction (enter calls)
stepinext assembly instruction (enter calls)
regsdisplay the registers
dbxenv follow_fork_mode <spec><spec> can be child, parent, or ask
 if <spec> equals parent, stay with the parent after a call to fork(2)
 if <spec> equals child, follow the child after a call to fork(2)
 if <spec> equals ask, then ask which to follow after a call to fork(2)
assign <var> = <exp>assign <exp> to <var>

in <func>When the program enters <func>
at <line>When <line> in the current file is about to be executed
at <filename>:<line>When <line> in <filename> is about to be executed
inmethod <func>Entry into any method named <func>
infunction <func>Entry into any overloaded version of <func>
inclass <class>Trigger in any member of <class>
inmember <class>Entry into any member function of a class (c++ only)
inobject . . . [>|>>]Trigger in any member of an instance of a class (c++ only)
modify <addr-expr> [, <size-expr>]Trigger when the address range is written to
throwA C++ exception has been thrown
throw <type>A C++ exception of type <type> has been thrown.

-if <cond>event only fires when <cond> is true
-in <func>event only fires when in <func>
-count <n>count up from 0; fire event and reset counter when nhas been reached
-tempA temporary event. Delete event when fired

check <type>checks for runtime errors specified by <type> (see below)
check <type> <places>check for runtime errors in <places> where <places>
 is a comma separated list of files, functions, or loadobjects.
 this can be used to focus RTC on specific places.
uncheck <type>stops checking for runtime errors.
showleaks [-v]shows memory leaks (-v for verbose)
showmemuse [-v]shows memory usage (-v for verbose)
suppressHistory of suppress and unsuppress commands
suppress <errors>Suppress <errors> everywhere.
suppress <errors> <places>Suppress <errors> in <places> where <places>
 is a comma separated list of files, functions, or loadobjects.
unsuppress <errors>Stop suppressing <errors> everywhere.
unsuppress <errors> <places>Stop suppressing <errors> in <places>.

bafBad free
dufDuplicate free
mafMisaligned free
marMisaligned read
mawMisaligned write
oomOut of memory
ruaRead from unallocated memory
ruiRead from uninitialized memory
wroWrite to read-only memory
wuaWrite to unallocated memory
aibPossible memory leak - only pointer points in the middle of the block
airPossible memory leak - pointer to the block exists only in register
melMemory leak - no pointers to the block

-accessStops the process whenever a memory access error occurs.
 This checks for baf, duf, maf, mar, maw, oom, rua, rui, wro, wua
 If you set dbxenv rtc_auto to ``on'', then access errors will be
 logged to a file rather than halting execution (controlled by rtc_error_log_filename)
-leaksGenerates a list of memory leaks when the program terminates.
 checks for aib, air, mel. The report is not verbose by default,
 controlled by rtc_mel_at_exit. Also, you can use showleaks at any time
-memuseGenerates a list of blocks in use when the program terminates. Implies -leaks
 This report is not verbose by default, and controlled by rtc_biu_at_exit
-allChecks for memory usage and leaks




All RTC checking types may be followed by either of the following two options: 


-frames <n>Display <n> distinct stack frames when reporting leaks.
-match <m>if two or more errors match <m> or more stack frames, then
 they are reported as one error.

listlist the default number of lines in the current file
list <n>list line number <n> in the current file
list +<n>list the next <n> lines in the current file
list <n1>, [+]<n2>list lines from <n1> to <n2> (or the next <n2> lines if +<n2>)
list <filename>:<n>list line <n> in filename.
list -iintermix assembly lines between source lines
list -wlist a window of 10 lines.
edit <filename>edit (in $EDITOR) <filename>
edit <proc>edit file containing procedure <proc>
dis <addr> [/<count>]disassemble <count> instructions at <addr>

whereis <func>Returns the file containing <func>
whatis <name>returns the type of <name>. Example: ``whatis main'' would
 return ``void main(int argc, char **argv)''
collectorcollect information about performance.
__cb_promptA ksh function that gets called before the prompt is displayed
daliasset (or list) a dbx alias
ignore <signal>ignore signal named/numbered <signal>
(un)intercept <typename>(do not) intercept throws of type <typename>
(un)intercept -a(do not) intercept all throws
(un)intercept -x <typename>(Do not) intercept throws of type <typename>(use with above)
(un)interceptlist intercepted types

fixfix the current file.
fixFix list of files
fix -fForce fixing of a file, even if it has not been modified.
fix -aFix all modified files
fix -gstrip -O flags and replace with -g flags
fix -cprint compilation line
fix -nno execution (list what would have been done)
fix -vverbose mode
fix +vnon-verbose mode
__cb_fix_compdbxenv variable that controls compilation options
__cb_fix_linkdbxenv variable that controls link options
fix_verbosedbxenv variable that printing of the compilation line during a ``fix'' (default off)
fix-pitfallsthe section of help that lists ``fix'''s limitations.

 

 类似资料: