This appendix describes the general syntax used for all debugger commands as well as the particulars of each command.
A debugger command may contain any of the following syntax elements:
You can group debugger commands with braces, and separate them with semicolons. The resulting compound command may be considered an atomic command. For example:
{command;command;command}
this_is_a_string {so is this}
hello.c
//2/dir1/dir2
The Accelerate command behaves as if a menu item from the main menu were selected:
Accelerate main menu {menu_string}
The following command behaves as if the named menu item in the floating popup menu for the current window were selected:
Accelerate {menu_string}
The arguments are as follows:
behave as if Until return were selected from the Run menu:
accelerate main run {until return}
behave as if Home were picked from the floating popup menu of the current window:
accelerate {Home}
To print a list of all breakpoints in the log window:
Break
To set a breakpoint (see the Breakpoints chapter for details about breakpoint operation):
Break [|/Set|/Byte|/Word|/DWord|/Modify] address [ {do_command} [ { condition } [ countdown ]]]
To deactivate a breakpoint:
Break/Deactivate brkid
To enable a breakpoint:
Break/Activate brkid
To clear a breakpoint:
Break/Clear brkid
To toggle a breakpoint through the active/inactive/deleted states:
Break/Toggle brkid
To turn on the Resume option in the breakpoint:
Break/Resume brkid
To turn off the Resume option in the breakpoint:
Break/UnResume brkid
If you specify both condition and countdown, countdown decrements only when condition evaluates to true. |
To set a breakpoint at foo the twentieth time that i equals 10. When this occurs do j7 is executed:
Break /Set foo {do j7} {i10} 20
To clear the breakpoint at foo:
Break /Clear foo
To activate breakpoint #1:
Break /Activate #1
To deactivate all breakpoints:
Break /Deactivate *
Use the Call command to call a routine:
Call [/Far|/Interrupt|/Near]address [([parm[,parm[...]]])] [/|printlist]
This command calls the routine at address, passing the given parameters. The arguments are as follows:
location is [/|regset]
To call the function foo:
call foo
To call the function bar, passing the parameters 1, 2, and 3:
call bar( 1,2,3 )
To call foo, putting 1 on the stack, 2 in ax, and 3 in cx:bx; printing the value of ax and dx in decimal and hexadecimal, respectively, on return:
call /near foo( // 1, /ax 2, /[cx bx] 3 ) {%d %x} ax,dx
For another way to call C or C++ functions, see ``Primary Expression Operators for the C Grammar'' in the Expression Handling chapter.
Use the Capture command to execute a command and put the resulting program output into a window:
CAPture command
For example, the following command calls a routine foo and puts its output into a debugger window:
capture call foo
The syntax of this command is as follows:
COnfigfile
This command is used by the debugger to save and restore configuration. The debugger overwrites the file containing configfile when it saves configuration information.
The Display command allows you to open any window:
Display wndname [/Open|/Close|/New|/MInimize|/MAximize|/Restore] [ord,ord,ord,ord]
To refresh the debugger screen:
Display
To open the status line:
Display Status [/Open]
To close the status line:
Display Status /Close
To bring a window to the front:
Display wndname
To open a register window in the top left quarter of the screen:
display register /open 0,0,5000,5000
To minimize the source window if it's open:
display source /minimize
Use the DO command to evaluate an arbitrary C/C++ or FORTRAN expression:
DO expr
For example:
DO i = 10
Use the Error command to display a string as an error message:
ERror string
For example:
error {An error has been detected}
Use the Examine command to examine memory at a specific address:
Examine [/Byte|/Word|/Dword|/Pointer] [address] [,follow [,len]]
To show an assembly window at a specific address:
Examine /Assembly [address]
To show a source window at a specific address:
Examine /Source [address]
To add an address to the I/O window as a byte, word, or dword:
Examine [/IOByte|/IOWord|/IODword] [address]
For example, The following command opens a memory window positioned at the address of foo. The window initially displays 2-byte words. If the Repeat menu item is used, it follows a near pointer 4 bytes past the beginning of the window *(.+$). The window displays 16 bytes of data at a time:
examine /word foo,*(.+4),16
Use the Flip command to configure screen flipping. See the section ``Options Dialog'' in the Debugger Environment chapter for details.
Flip ON Flip OFf
Use the Font command to set the font for the specified window:
FOnt wndname fontinfo
where
Use the Go command to start or continue program execution. Execution then resumes at the specified address or at the location defined by the current contents of the instruction pointer (the CS:IP or CS:EIP register pair). The format of the Go command is:
Go [/Until] [/Keep] [/Noflip] [[start,]stop]
To resume execution until function foo is executed, without flipping to the application screen:
go /noflip foo
The following command starts execution at foo, and runs until bar is executed.
go foo,bar
Bring up the help screen:
Help
The help information provides information on using the debugger on a variety
of operating systems; this manual concentrates on QNX alone.
The Photon Helpviewer contains the entire set of Watcom manuals for QNX. |
Use the Hook command to execute a command when a defined event occurs:
HOok event command
event can be any of the following:
This example causes the Locals and Source windows to come to the front whenever a region with symbolic debugging information is entered:
hook sourceinfo {display locals; display source}
Use the If command to evaluate an expression, and then (depending on the results) execute a list of commands:
IF expr { command } [ ELSEIF expr { command } [ ELSEIF expr { command } [...]]] [ELSE { command }]
If the expression results in a non-zero value, the debugger commands contained after the IF expression are executed. Otherwise, the commands that appear after the ELSEIF expression are executed.
Use the Invoke command to invoke a file containing a number of debugger commands:
INvoke file [string [string [...]]] < file [string [string [...]]]
Use the Log command to send the Dialog window output to a specified file. To start logging to a file:
Log file Log /Start file > file
To start appending log information to a file:
Log > file >> file Log /Append file
To stop logging:
Log >
Use the Modify command to change memory at an address to the values specified by the list of expressions:
MOdify [/Byte|/Pointer|/Word|/Dword|/IOByte|/IOWord|/IODword] address[,expr[...]]
The following command changes the 3 bytes at location foo to the values 1, 2, and 3:
modify /byte foo 1,2,3
The following command changes the 4 bytes at location foo to the value 12345678 hex:
modify /dword foo 0x12345678
Use the New command to initialize various items:
NEW [args] NEW /Program [[:symfile] progfile [args]] NEW /Restart [args] NEW /STDIn file NEW /STDOut file NEW /SYmbol file [seg [,seg [...]]
Use the Paint command to define window or dialog colors. For window colors, use the following command:
PAint [Status|wndname] wndattr color ON color
For dialog colors, use the following command:
PAint DIalog dlgattr color ON color
You can't use BRIght White as the background color. |
To paint plain text black on white in all windows:
paint all plain black on white
To make the highlighted text for buttons in all dialogs appear as bright green on a yellow background:
paint dialog button standout bright green on yellow
For more examples of this command, see a configuration file such as setup.dbg.
Use the Print command to:
The form of the Print command is:
Print [/Window|/Program] [printlist]
Sequence: | Format: |
---|---|
%i | signed decimal integer value |
%d | signed decimal integer value |
%u | unsigned decimal integer value |
%x | unsigned hexadecimal integer value. Letter digits are printed in lower case (a-f). |
%X | unsigned hexadecimal integer value. Letter digits are printed in upper case (A-F). |
%o | unsigned octal integer value |
%p | pointer (segment:offset) value in hexadecimal notation. |
%c | single character value. |
%s | C/C++ string value. The argument must point to a string of characters terminated by a byte whose value is zero. |
%% | To print out a percentage symbol, the % must be doubled up (that is, %%). |
%f | floating-point representation. If the floating-point value has a very large or small magnitude, you should use one of g, G, e or E formatting. |
%g | floating-point representation. Numbers of very large or small magnitude are printed out in scientific ``E'' notation (for example, 1.54352e+16). The exponent letter is printed in lower case. |
%G | floating-point representation Numbers of very large or small magnitude are printed out in scientific ``E'' notation (for example, 1.54352E+16). The exponent letter is printed in upper case. |
%e | scientific ``E'' notation (for example, 1.23456e+02). The exponent letter is printed in lower case. |
%E | scientific ``E'' notation (for example, 1.23456E+02). The exponent letter is printed in upper case. |
%r | current default numeric radix. |
%a | symbol reference (symbol_name+offset) when possible; otherwise it's printed out as a pointer (segment:offset) value in hexadecimal notation. |
%l | line number reference (module_name@line_number+offset) when possible; otherwise it is printed out as a pointer (segment:offset) value in hexadecimal notation. |
To print the value of i:
? i
To print decimal=100 hex=0x64:
print {decimal=%d hex=%x} 100,100
Use the Quit command to leave the debugger.
Use the Record command to add a command to the Replay window. This command is for internal use only. The format of the command is:
REcordexpr command
The format of the Register command is:
Register intexpr
If intexpr is negative, this is equivalent to using the menu item Undo/Undo -intexpr times. If intexpr is positive, this is equivalent to using the menu item Undo/Redo intexpr times.
Use the Remark command to enter lines of comments:
REMark string
The Set command is used internally by the debugger to save and restore the configuration:
Set AUtosave [ON|OFf] Set ASsembly [Lower|Upper] [Outside|Inside] [Source|NOSource] [Hexadecimal|Decimal] Set Variable [Entire|Partial] [CODe|NOCODe] [INherit|NOINherit] [COMpiler|NOCOMpiler] [PRIvate|NOPRIvate] [PROtected|NOPROTected] [Members|NOMembers] Set FUnctions [Typed|All] Set GLobals [Typed|All] Set REGister [Hexadecimal|Decimal] [Extended|Normal] Set Fpu [Hexadecimal|Decimal] Set Bell [ON|OFf] Set Call [/Far|/Interrupt|/Near] [ ( [location [,location [...]]] ) ] Set Dclick expr Set Implicit [ON|OFf] Set INput wndname Set Radix expr Set RECursion [ON|OFf] Set SEarch [CASEIgnore|CASEREspect] [Rx|NORx] string Set SOurce [/Add] [path [path] [...]]] Set SYmbol [/Add|/Ignore|/Respect] [lookspec [lookspec [...]]] Set Tab intexpr Set Level [Assembly|Mixed|Source] Set LAnguage [CPP|C|FORTRAN] Set SUpportroutine string Set MAcro wndname key command
The Show commands are used internally by the debugger to save and restore its configuration. The syntax is:
SHow Paint SHow Display SHow Font SHow Set SHow Set AUtosave SHow Set ASsembly SHow Set Variable SHow Set FUnctions SHow Set GLobals SHow Set REGister SHow Set Fpu SHow Set Bell SHow Set Call SHow Set Dclick SHow Set Implicit SHow Set INput SHow Set Radix SHow Set RECursion SHow Set SEarch SHow Set SOurce SHow Set SYmbol SHow Set Tab SHow Set Level SHow Set LAnguage SHow Set MAcro SHow Set SUpportroutine SHow Flip SHow Hook
Use the Skip command to set the instruction pointer (CS:EIP) to a specific address:
SKip address
The Stackpos command is the same as using Undo/Unwind. The intexpr allows you to define the number of times to undo or unwind.
Use the System command to spawn an operating system shell to execute a given string. The format of the system command is:
SYstem [/Remote|/Local] string
Use the Thread command to manipulate the threads of execution of a multi-threaded application under OS/2 or NetWare 386:
THread [/Show|/Freeze|/Thaw|/Change] [threadid]
Use the Trace command to step through the execution of your program:
Trace [/Assembly|/Mixed|/Source] [/Into|/Next|/Over]
The format of the Undo command is:
Undo intexpr
If intexpr is positive, this is equivalent to using the menu item Undo/Undo intexpr times. If intexpr is negative, this is equivalent to using the menu item Undo/Redo -intexpr times.
Use the View command to show a file in a window:
View [/Binary] [file|module]
Use the While command to permit the execution of a list of commands while the specified expression is true:
While expr { command }
The WIndow command operates on the current window and is useful when defining accelerators that perform window operations.