Provides an environment to debug and run programs.
dbx [ -a ProcessID ] [ -c CommandFile ] [ -d NestingDepth ] [ -I Directory ] [ -E DebugEnvironment ] [ -p oldpath=newpath:...| pathfile ] [ -k ] [ -u ] [ -F ] [ -r ] [ -x ] [ ObjectFile [ CoreFile ] ]
The dbx command provides a symbolic debug program for C, C++, Pascal, and FORTRAN programs, allowing you to carry out operations such as the following:
The ObjectFile parameter is an object (executable) file produced by a compiler. Use the -g (generate symbol table) flag when compiling your program to produce the information the dbx command needs.
Note: The -g flag of the cc command should be used when the object file is compiled. If the -g flag is not used or if symbol references are removed from the xcoff file with the strip command, the symbolic capabilities of the dbx command are limited.
If the -c flag is not specified, the dbx command checks for a .dbxinit file in the user's $HOME directory. It then checks for a .dbxinit file in the user's current directory. If a .dbxinit file exists in the current directory, that file overrides the .dbxinit file in the user's $HOME directory. If a .dbxinit file exists in the user's $HOME directory or current directory, that file's subcommands run at the beginning of the debug session. Use an editor to create a .dbxinit file.
If ObjectFile is not specified, then dbx asks for the name of the object file to be examined. The default is a.out. If the core file exists in the current directory or a CoreFile parameter is specified, then dbx reports the location where the program faulted. Variables, registers, and memory held in the core image may be examined until execution of ObjectFile begins. At that point the dbx debug program prompts for commands.
The dbx program can display a wide range of expressions. You can specify expressions in the dbx debug program with a common subset of C and Pascal syntax, with some FORTRAN extensions.
The following operators are valid in the debug program:
The following types of operations are valid in expressions in the debug program:
Logical and comparison expressions are allowed as conditions in stop and trace.
Expression types are checked. You override an expression type by using a renaming or casting operator. The three forms of type renaming are Typename(Expression), Expression|Typename, and (Typename) Expression. The following is an example where the x variable is an integer with value 97:
(dbx) print x 97 (dbx) print char (x), x \ char, (char) x, x 'a' 'a' 'a' 97
The dbx commands provides a command line editing feature similar to those provide by Korn Shell. vi mode provides vi-like editing features, while emacs mode gives you controls similar to emacs.
These features can be turned on by using dbx subcommand set -o or set edit. To turn on vi-style command-line editing, you would type the subcommand set edit vi or set -o vi.
You can also use the EDITOR environment variable to set the editing mode.
The dbx command saves commands entered to a history file .dbxhistory. If the DBXHISTFILE environment variable is not set, the history file used is $HOME/.dbxhistory.
By default, dbx saves the text of the last 128 commands entered. The DBXHISTSIZE environment variable can be used to increase this limit.
| -a ProcessID | Attaches the debug program to a process that is running. To attach the debug program, you need authority to use the kill command on this process. Use the ps command to determine the process ID. If you have permission, the dbx program interrupts the process, determines the full name of the object file, reads in the symbolic information, and prompts for commands. |
| -c CommandFile | Runs the dbx subcommands in the file before reading from standard input. The specified file in the $HOME directory is processed first; then the file in the current directory is processed. The command file in the current directory overrides the command file in the $HOME directory. If the specified file does not exist in either the $HOME directory or the current directory, a warning message is displayed. The source subcommand can be used once the dbx program is started. |
| -d NestingDepth | Sets the limit for the nesting of program blocks. The default nesting depth limit is 25. |
| -E DebugEnvironment | Specifies the environment variable for the debug program. |
| -p oldpath=newpath:...| pathfile | Specifies a substitution for library paths when examining core files in the format oldpath=newpath. oldpath specifies the value to be substituted (as stored in the core file) and newpath specifies what it is to be replaced with. These may be complete or partial, relative or absolute paths. Multiple substitutions may be specified, separated by colons. Alternatively, the -p flag may specify the name of a file from which mappings in the previously described format are to be read. Only one mapping per line is allowed when mappings are read from a file. |
| -F | Can be used to turn off the lazy read mode and make the dbx command read all symbols at startup time. By default, lazy reading mode is on: it reads only required symbol table information on initiation of dbx session. In this mode, dbx will not read local variables and types whose symbolic information has not been read. Therefore, commands such as whereis i may not list all instances of the local variable i in every function. |
| -I Directory | (Uppercase i) Includes directory specified by the Directory variable in the list of directories searched for source files. The default is to look for source files in the following directories: |
| -k | Maps memory addresses; this is useful for kernel debugging. |
| -r | Runs the object file immediately. If it terminates successfully,
the dbx debug program is exited. Otherwise, the debug
program is entered and the reason for termination is reported.
Note: Unless -r is specified, the dbx command prompts the user and waits for a command. |
| -u | Causes the dbx command to prefix file name symbols with an @ (at sign). This flag reduces the possibility of ambiguous symbol names. |
| -x | Prevents the dbx command from stripping _ (trailing underscore ) characters from symbols originating in FORTRAN source code. This flag allows dbx to distinguish between symbols which are identical except for an underscore character, such as xxx and xxx_. |
$ cc -g samp.c -o samp
When the program samp is run, the operating system reports a bus error and writes a core image to your current working directory as follows:
$ samp Bus Error - core dumped
To determine the location where the error occurred, enter:
$ dbx samp
The system returns the following message:
dbx version 3.1 Type 'help' for help. reading symbolic information . . . [ using memory image in core] 25 x[i] = 0; (dbx) quit
main()
{
int i,x[10];
for (i = 0; i < 10;);
}The program will never terminate because i is never incremented. Compile looper.c with the -g flag to get symbolic debugging capability:
$ cc -g looper.c -o looper
Run looper from the command line and perform the following steps to attach dbx to the program while it is running:
ps -u UserID
where UserID is your login ID. All active processes that belong to you are displayed as follows:
PID TTY TIME COMMAND 68 console 0:04 sh 467 lft3 10:48 looper
In this example the process ID associated with looper is 467.
$ dbx -a 467
The system returns the following message:
Waiting to attach to process 467 . . . Successfully attached to /tmp/looper. dbx is initializing Type 'help' for help. reading symbolic information . . . attached in main at line 5 5 for (i = 0; i < 10;); (dbx)
You can now query and debug the process as if it had been originally started with dbx.
$dbx -I /home/user/src -I /home/group/src objfile
The use subcommand may be used for this function once dbx is started. The use command resets the list of directories, whereas the -I flag adds a directory to the list.
$ dbx -r samp
The system returns the following message:
Entering debug program . . . dbx version 3.1 Type 'help' for help. reading symbolic information . . . bus error in main at line 25 25 x[i] = 0; (dbx) quit
The -r flag allows you to examine the state of your process in memory even though a core image is not taken.
dbx -E LIBPATH=/home/user/lib -E LANG=Ja_JP objfile
Note: The subcommands can only be used while running the dbx debug program.
| / | Searches forward in the current source file for a pattern. |
| ? | Searches backward in the current source file for a pattern. |
| alias | Creates aliases for dbx subcommands. |
| assign | Assigns a value to a variable. |
| attribute | Displays information about all or selected attributes objects. |
| call | Runs the object code associated with the named procedure or function. |
| case | Changes how the dbx debug program interprets symbols. |
| catch | Starts trapping a signal before that signal is sent to the application program. |
| clear | Removes all stops at a given source line. |
| cleari | Removes all breakpoints at an address. |
| condition | Displays information about all or selected condition variables. |
| cont | Continues application program execution from the current stopping point until the program finishes or another breakpoint is encountered. |
| delete | Removes the traces and stops corresponding to the specified event numbers. |
| detach | Continues execution of application and exits the debug program. |
| display memory | Displays the contents of memory. |
| down | Moves the current function down the stack. |
| dump | Displays the names and values of variables in the specified procedure. |
| edit | Starts an editor on the specified file. |
| file | Changes the current source file to the specified file. |
| func | Changes the current function to the specified procedure or function. |
| goto | Causes the specified source line to be the next line run. |
| gotoi | Changes the program counter address. |
| help | Displays help information for dbx subcommands or topics. |
| ignore | Stops trapping a signal before that signal is sent to the application program. |
| list | Displays lines of the current source file. |
| listi | Lists instructions from the application program. |
| map | Displays information about load characteristics of the application. |
| move | Changes the next line to be displayed. |
| multproc | Enables or disables multiprocess debugging. |
| mutex | Displays information about all or selected mutexes. |
| next | Runs the application program up to the next source line. |
| nexti | Runs the application program up to the next machine instruction. |
| Prints the value of an expression or runs a procedure and prints the return code of that procedure. | |
| prompt | Changes the dbx command prompt. |
| quit | Stops the dbx debug program. |
| registers | Displays the values of all general-purpose registers, system-control registers, floating-point registers, and the current instruction register. |
| rerun | Begins execution of an application with the previous arguments. |
| return | Continues running the application program until a return to the specified procedure is reached. |
| rwlock | Displays information about the rwlocks. |
| run | Begins running an application. |
| screen | Opens an Xwindow for dbx command interaction. |
| set | Defines a value for a dbx debug program variable. |
| sh | Passes a command to the shell to be run. |
| skip | Continues running the application program from the current stopping point. |
| source | Reads dbx subcommands from a file. |
| status | Displays the active trace and stop subcommands. |
| step | Runs one source line. |
| stepi | Runs one machine instruction. |
| stophwp | Sets a hardware watchpoint stop. |
| stop | Stops running of the application program. |
| stopi | Sets a stop at a specified location. |
| thread | Displays and controls threads. |
| trace | Prints tracing information. |
| tracehwp | Sets a hardware watchpoint trace. |
| tracei | Turns on tracing. |
| unalias | Removes an alias. |
| unset | Deletes a variable. |
| up | Moves the current function up the stack. |
| use | Sets the list of directories to be searched when looking for source files. |
| whatis | Displays the declaration of application program components. |
| where | Displays a list of active procedures and functions. |
| whereis | Displays the full qualifications of all the symbols whose names match the specified identifier. |
| which | Displays the full qualification of the given identifier. |
/ [ RegularExpression [ / ] ]
The / subcommand searches forward in the current source file for the pattern specified by the RegularExpression parameter. Entering the / subcommand with no arguments causes dbx to search forward for the previous regular expression. The search wraps around the end of the file.
/ 12
/
See the ? (search) subcommand and the regcmp subroutine.
? [ RegularExpression [ ? ] ]
The ? subcommand searches backward in the current source file for the pattern specified by the RegularExpression parameter. Entering the ? subcommand with no arguments causes the dbx command to search backwards for the previous regular expression. The search wraps around the end of the file.
?z
?
See the / (search) subcommand and the regcmp subroutine.
alias [ Name [ [ (Arglist) ] String | Subcommand ] ]
The alias subcommand creates aliases for dbx subcommands. The Name parameter is the alias being created. The String parameter is a series of dbx subcommands that, after the execution of this subcommand, can be referred to by Name. If the alias subcommand is used without parameters, it displays all current aliases.
alias rr rerun
alias printandstep "print n; step"
(dbx) alias px(n) "set $hexints; print n; unset $hexints" (dbx) alias a(x,y) "print symname[x]->symvalue._n_n.name.Id[y]" (dbx) px(126) 0x7e
In this example, the alias px prints a value in hexadecimal without permanently affecting the debugging environment.
assign Variable=Expression
The assign subcommand assigns the value specified by the Expression parameter to the variable specified by the Variable parameter.
assign x = 5
assign x = y
assign z = 'z'
assign B = false
assign Y = "Hello World"
set $unsafeassign
See Displaying and Modifying Variables.
attribute [ AttributeNumber ... ]
The attribute subcommand displays information about the user thread, mutex, or condition attributes objects defined by the AttributeNumber parameters. If no parameters are specified, all attributes objects are listed.
For each attributes object listed, the following information is displayed:
Notes:
attribute
The output is similar to:
attr obj_addr type state stack scope prio sched p-shar $a1 0x200035c8 mutex valid no $a2 0x20003628 cond valid no $a3 0x200037c8 thr valid 57344 sys 126 other $a4 0x200050f8 thr valid 57344 pro 126 other
attribute 1 3
The output is similar to:
attr obj_addr type state stack scope prio sched p-shar $a1 0x200035c8 mutex valid no $a3 0x200037c8 thr valid 57344 sys 126 other
See the condition subcommand, mutex subcommand, print subcommand, and thread subcommand for the dbx command.
Also, see Creating Threads, Using Mutexes, and Using Condition Variables in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
call Procedure ( [ Parameters ] )
The call subcommand runs the procedure specified by the Procedure parameter. The return code is not printed. If any parameters are specified, they are passed to the procedure being run.
To call a command while running dbx, enter:
(dbx) call printf("hello")
hello
printf returns successfully.
case [ default | mixed | lower | upper ]
The case subcommand changes how the dbx debug program interprets symbols. The default handling of symbols is based on the current language. If the current language is C, C++, or undefined, the symbols are not folded; if the current language is FORTRAN or Pascal, the symbols are folded to lowercase. Use this subcommand if a symbol needs to be interpreted in a way not consistent with the current language.
Entering the case subcommand with no parameters displays the current case mode.
case
case mixed
case upper
See Folding Variables to Lowercase and Uppercase.
catch [ SignalNumber | SignalName ]
The catch subcommand starts the trapping of a specified signal before that signal is sent to the application program. This subcommand is useful when the application program being debugged handles signals such as interrupts. The signal to be trapped can be specified by number or by name using either the SignalNumber or the SignalName parameter, respectively. Signal names are case insensitive, and the SIG prefix is optional. If neither the SignalNumber nor the SignalName parameter is specified, all signals are trapped by default except the SIGHUP, SIGCLD, SIGALARM, and SIGKILL signals. If no arguments are specified, the current list of signals to be caught is displayed.
catch
catch SIGALARM
See the ignore subcommand and Handling Signals.
clear SourceLine
The clear subcommand removes all stops at a given source line. The SourceLine parameter can be specified in two formats:
To remove breakpoints set at line 19, enter:
clear 19
The cleari subcommand and delete subcommand. Also, see Setting and Deleting Breakpoints in in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
cleari Address
The cleari subcommand clears all the breakpoints at the address specified by the Address parameter.
cleari 0x100001b4
cleari &main
See the clear subcommand, the delete subcommand, and Setting and Deleting Breakpoints in in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
condition [ wait | nowait | ConditionNumber ... ]
The condition subcommand displays information about one or more condition variables. If one or more ConditionNumber parameters are given, the condition subcommand displays information about the specified condition variables. If no flags or parameters are specified, the condition subcommand lists all condition variables.
The information listed for each condition is as follows:
Note: The print subcommand of the dbx debug program recognizes symbolic condition variable names, and can be used to display the status of the corresponding object.
| wait | Displays condition variables which have waiting threads. |
| nowait | Displays condition variables which have no waiting threads. |
condition
condition 3
The output is similar to:
cv obj_addr num_wait waiters $c3 0x20003290 0
See the attribute subcommand, mutex subcommand, print subcommand, and thread subcommand.
Also, see Using Condition Variables in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs:.
cont [ SignalNumber | SignalName ]
The cont subcommand continues the execution of the application program from the current stopping point until either the program finishes or another breakpoint is reached. If a signal is specified, either by the number specified in the SignalNumber parameter or by the name specified in the SignalName parameter, the program continues as if that signal had been received. Signal names are not case sensitive and the SIG prefix is optional. If no signal is specified, the program continues as if it had not been stopped.
cont
cont SIGQUIT
See the detach subcommand for the dbx command, the goto subcommand for the dbx command, the next subcommand for the dbx command, the skip subcommand for the dbx command, the step subcommand for the dbx command.
delete { Number ... | all }
The delete subcommand removes traces and stops from the application program. The traces and stops to be removed can be specified through the Number parameters, or all traces and stops can be removed by using the all flag. Use the status subcommand to display the numbers associated by the dbx debug program with a trace or stop.
| all | Removes all traces and stops. |
delete all
delete 4
See the clear subcommand, the cleari subcommand, the status subcommand and Setting and Deleting Breakpoints in in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
detach [ SignalNumber | SignalName ]
The detach subcommand continues the execution of the application program and exits the debug program. A signal can be specified either by:
Signal names are not case sensitive and the SIG prefix is optional.
If a signal is specified, the program continues as if it had received that signal. If no signal is specified, the program continues as if no stop had occurred.
detach
detach SIGREQUEST
See Using the dbx Debug Program.
{ Address,Address/ | Address/ [ Count ] } [ Mode ] [ >File ]
The display memory subcommand, which does not have a keyword to initiate the command, displays a portion of memory controlled by the following factors:
The range of memory displayed is controlled by specifying either:
OR
Specify symbolic addresses by preceding the name with an & (ampersand). Addresses can be expressions made up of other addresses and the operators + (plus sign), - (minus sign), and * (indirection). Any expression enclosed in parentheses is interpreted as an address.
| >File | Redirects output to the specified file. |
0x3fffe460 / X
&y / 2c
&a_string + 5, &a_string + 7/c
See Examining Memory Addresses in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
down [ Count ]
The down subcommand moves the current function down the stack Count number of levels. The current function is used for resolving names. The default for the Count parameter is one.
See the up subcommand, the where subcommand, and Displaying a Stack Trace in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
dump [ Procedure ] [ >File ]
The dump subcommand displays the names and values of all variables in the specified procedure. If the Procedure parameter is . (period), then all active variables are displayed. If the Procedure parameter is not specified, the current procedure is used. If the >File flag is used, the output is redirected to the specified file.
| >File | Redirects output to the specified file. |
dump
dump add_count
dump > var.list
See Displaying and Modifying Variables in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
edit [ Procedure | File ]
The edit subcommand invokes an editor on the specified file. The file may be specified through the File parameter or by specifying the Procedure parameter, where the editor is invoked on the file containing that procedure. If no file is specified, the editor is invoked on the current source file. The default is the vi editor. Override the default by resetting the EDITOR environment variable to the name of the desired editor.
edit
edit main.c
edit do_count
See the list subcommand, the vi or vedit command. Also, see Changing the Current File or Procedure and Displaying the Current File in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
file [ File ]
The file subcommand changes the current source file to the file specified by the File parameter; it does not write to that file. The File parameter can specify a full path name to the file. If the File parameter does not specify a path, the dbx program tries to find the file by searching the use path. If the File parameter is not specified, the file subcommand displays the name of the current source file. The file subcommand also displays the full or relative path name of the file if the path is known.
file main.c
file
See the func subcommand. Also, see Changing the Current File or Procedure and Displaying the Current File in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
func [ Procedure ]
The func subcommand changes the current function to the procedure or function specified by the Procedure parameter. If the Procedure parameter is not specified, the default current function is displayed. Changing the current function implicitly changes the current source file to the file containing the new function; the current scope used for name resolution is also changed.
func do_count
func
See the file subcommand. Also, see Changing the Current File or Procedure in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
goto SourceLine
The goto subcommand causes the specified source line to be run next. Normally, the source line must be in the same function as the current source line. To override this restriction, use the set subcommand with the $unsafegoto flag.
To change the next line to be executed to line 6, enter:
goto 6
See the cont subcommand, the gotoi subcommand, and the set subcommand.
gotoi Address
The gotoi subcommand changes the program counter address to the address specified by the Address parameter.
To change the program counter address to address 0x100002b4, enter:
gotoi 0x100002b4
See the goto subcommand.
help [ Subcommand | Topic ]
The help subcommand displays help information for dbx subcommands or topics, depending upon the parameter you specify. Entering the help subcommand with the Subcommand parameter displays the syntax statement and description of the specified subcommand. Entering the help subcommand with the Topic parameter displays a detailed description of the specified topic. The following topics are available:
help
help list
help set_variables
ignore [ SignalNumber | SignalName ]
The ignore subcommand stops the trapping of a specified signal before that signal is sent to the application program. This subcommand is useful when the application program being debugged handles signals such as interrupts.
The signal to be trapped can be specified by:
Signal names are not case sensitive. The SIG prefix is optional.
If neither the SignalNumber nor the SignalName parameter is specified, all signals except the SIGHUP, SIGCLD, SIGALRM, and SIGKILL signals are trapped by default. The dbx debug program cannot ignore the SIGTRAP signal if it comes from a process outside of the debugger. If no arguments are specified, the list of currently ignored signals will be displayed.
To cause dbx to ignore alarm clock time-out signals sent to the application program, enter:
ignore alrm
See the catch subcommand. Also, see Handling Signals in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
list [ Procedure | SourceLine-Expression [ ,SourceLine-Expression ] ]
The list subcommand displays a specified number of lines of the source file. The number of lines displayed are specified in one of two ways:
In this case, the list subcommand displays lines starting a few lines before the beginning of the specified procedure and until the list window is filled.
The SourceLine-Expression parameter should consist of a valid line number followed by an optional + (plus sign), or - (minus sign), and an integer. In addition, a SourceLine of $ (dollar sign) may be used to denote the current line number; a SourceLine of @ (at sign) may be used to denote the next line number to be listed.
All lines from the first line number specified to the second line number specified, inclusive, are then displayed.
If the second source line is omitted, the first line is printed only.
If the list subcommand is used without parameters, the number of lines specified by $listwindow are printed, beginning with the current source line.
To change the number of lines to list by default, set the special debug program variable, $listwindow, to the number of lines you want. Initially, $listwindow is set to 10.
list 1,10
list main
list $-5,$+5
(dbx) list $
4 {
(dbx) list 5
5 char i = '4';
(dbx) list sub
23 char *sub(s,a,k)
24 int a;
25 enum status k; . . .
(dbx) move
25
(dbx) list @ -2
23 char *sub(s,a,k)See the edit subcommand, the listi subcommand, and the move subcommand. Also, see Displaying the Current File in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
listi [ Procedure | at SourceLine | Address [ , Address ] ]
The listi subcommand displays a specified set of instructions from the source file. The instructions displayed are specified by:
If the listi subcommand is used without flags or parameters, the next $listwindow instructions are displayed. To change the current size of the list window, use the set $listwindow=Value subcommand.
The dbx program can disassemble instructions for either the POWER family or POWER PC architecture. In the default mode, the dbx program displays the instructions for the architecture on which it is running.
The $instructionset and $mnemonics variables of the set subcommand for the dbx command allow you to override the default disassembly mode. For more information, see the set subcommand for the dbx command.
| at SourceLine | Specifies a starting source line for the listing. |
listi
listi at 10
listi at "sample.c":5
listi 0x10000400, 0x10000420
See the list subcommand and the set subcommand. Also, see Debugging at the Machine Level with dbx in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
map [ > File ]
The map subcommand displays characteristics for each loaded portion of the application. This information includes the name, text origin, text length, data origin, and data length for each loaded module.
| > File | Redirects output to the specified file. |
See Debugging at the Machine Level with dbx in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
move SourceLine
The move subcommand changes the next line to be displayed to the line specified by the SourceLine parameter. This subcommand changes the value of the @ (at sign) variable.
The SourceLine variable can be specified as an integer or as a file name string followed by a : (colon) and an integer.
move 12
move "sample.c":5
See the list subcommand. Also, see Displaying the Current File in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
multproc [ on | parent | child | off ]
The multproc subcommand specifies the behavior of the dbx debug program when forked and exceed processes are created. The on flag is used to specify that a new dbx session will be created to debug the child path of a fork. The original dbx will continue to debug the parent path. The parent and child flags are used to specify a single path of a fork to follow. All flags except off enable dbx to follow an exceed process. The off flag disables multiprocess debugging. If no flags are specified, the multproc subcommand returns the current status of multiprocess debugging.
The dbx program uses Xwindows for multiprocess debugging. The dbx program opens as many windows as needed for multiprocessing. The title for each child window is the process ID (pid) of the child process. To switch between processes, use Xwindows handling techniques to activate the window where the dbx session is displayed. If the system does not have Xwindows support, a warning message is issued when the debugger forks, and the dbx program continues debugging only the parent process. Multiprocess debugging can also be unsuccessful for the following reasons:
If $xdisplay is set to a remote display, the user may not be able to see the newly created Xwindow. If the $xdisplay setting is not correct, Xwindows or other system resources report the cause of the failure.
The dbx program does not distinguish between different types of failures, but the following message is sent when the subcommand is not successful:
Warning: dbx subcommand multiproc fails. dbx continued with multproc disabled.
The user-defined configuration of the newly created window can be defined under the dbx_term application name in the .Xdefaults file.
| on | Enables multiprocess debugging. |
| off | Disables multiprocess debugging. |
multproc
multproc on
multproc off
See the screen subcommand and the fork subroutine. Also, see Debugging Programs Involving Multiple Processes in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
mutex [ lock | unlock | thnum | utid | MutexNumber ... ]
The mutex subcommand displays information about mutexes. If the MutexNumber parameter is given, the mutex subcommand displays information about the specified mutexes. If no flags or parameters are specified, the mutex subcommand displays information about all mutexes.
The information listed for each mutex is as follows:
Note: The print subcommand of the dbx debug program recognizes symbolic mutex names, and can be used to display the status of the corresponding object.
mutex
mutex 4 5 6
The output is similar to:
mutex obj_addr type lock owner blockers $m4 0x20003274 non-rec no $m5 0x20003280 recursi no $m6 0x2000328a fast no
mutex thnum 1
mutex utid 0x0001
See the attribute subcommand, the condition subcommand, the print subcommand, and the thread subcommand.
Also, see. Using Mutexes AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
next [ Number ]
The next subcommand runs the application program up to the next source line. The Number parameter specifies the number of times the next subcommand runs. If the Number parameter is not specified, next runs once only.
If you use the next subcommand in a multi-threaded application program, all the user threads run during the operation, but the program continues execution until the running thread reaches the specified source line. If you wish to step the running thread only, use the set subcommand to set the variable $hold_next. Setting this variable may result in deadlock since the running thread may wait for a lock held by one of the blocked threads.
next
next 3
See the cont subcommand, goto subcommand, nexti subcommand, set subcommand, and the step subcommand.
nexti [ Number ]
The nexti subcommand runs the application program up to the next instruction. The Number parameter specifies the number of times the nexti subcommand will run. If the Number parameter is not specified, nexti runs once only.
If you use the nexti subcommand in a multi-threaded application program, all the user threads run during the operation, but the program continues execution until the running thread reaches the specified machine instruction. If you wish to step the running thread only, use the set subcommand to set the variable $hold_next. Setting this variable may result in deadlock since the running thread may wait for a lock held by one of the blocked threads.
nexti
nexti 3
See the gotoi subcommand, next subcommand, set subcommand, and stepi subcommand. Also, see Running a Program at the Machine Level in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
print Expression ...
print Procedure ( [ Parameters ] )
The print subcommand does either of the following:
print x, y << 2
print sbrk(0)
See the assign subcommand, the call subcommand, and the set subcommand.
prompt [ "String" ]
The prompt subcommand changes the dbx command prompt to the string specified by the String parameter.
To change the prompt to dbx>, enter:
prompt "dbx>"
See Defining a New dbx Prompt in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
quit
The quit subcommand terminates all processes running in the dbx debugging session.
See the detach subcommand.
registers [ >File ]
The registers subcommand displays the values of general purpose registers, system control registers, floating-point registers, and the current instruction register.
Note: The register value may be set to the 0xdeadbeef hexadecimal value. The 0xdeadbeef hexadecimal value is an initialization value assigned to general-purpose registers at process initialization.
Note: The registers subcommand cannot display registers if the current thread is in kernel mode.
| >File | Redirects output to the specified file. |
See the set subcommand and the unset subcommand. Also, see Using Machine Registers in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
rerun [ Arguments ] [ < File ] [ > File ] [ > > File ] [ 2> File ] [ 2> > File ] [ >& File ] [ > >& File ]
The rerun subcommand begins execution of the object file. The Arguments are passed as command line arguments. If the Arguments parameter is not specified, the arguments from the last run or rerun subcommand are reused.
| <File | Redirects input so that input is received from File. |
| >File | Redirects output to File. |
| > >File | Appends redirected output to File. |
| 2>File | Redirects standard error to |