DBX command
use
Provides an environment for debugging and running programs.
grammar
DBX [-a processid] [-d NestingDepth] [-i Directory] [-e debugenvironment] [-p oldpath = newpath: ... | patfile] [-k] [-u] [-f ] [-R] [-x] [ObjectFile [Corefile]]
description
The DBX command provides a symbolic debugger for C, C , Pascal, and Fortran language programs that allow you to perform operations below:
Test objects and core files.
Provide a control environment for the program.
Set the breakpoint or single-step execution program at the selected statement.
Use symbol variables to debug and display them in the correct format.
The ObjectFile parameter is a target (executable) file generated by the compiler. When compiling your program, use the -g (Generate Symbol Table) flag to generate the information you need to do in the DBX command.
Note: The -g flag of the CC command should be used when compiling the object file. If the -g flag is not used or if the symbol is deleted from the XCOFF file by the Strip command, the symbol performance of the DBX command will be restricted.
If the -c flag is not specified, the DBX command will check the .dbxinit file in the user's $ HOME directory. Then it checks the .dbxinit file in the user's current directory. If there is a .dbxinit file in the current directory, this file will override the .dbxinit file in the user's $ HOME directory. If the.dbxinit file exists in the $ HOME directory of the user or in the current directory, the subcommand of the file will run at the beginning of the debug section. Use the editor to create a .dbxinit file.
If there is no ObjectFile, DBX will ask the name of the target file to be checked. The default is A.out. If there is a Core file in the current directory or specifying the Corefile parameter, the DBX will report the reporter to the location. Retain variables in the core image, register and memory can be checked until the ObjectFile is started. At that time the DBX debugger prompts to enter the command.
Expression handle
DBX programs can display a wide variety of expressions. You can specify an expression using a public subset of C and Pascal syntax and some Fortran extension subsets in the DBX debugger.
The following operators are valid in the debugger:
* (Asterisk) or ^ (Denoma) indicates that the indirect addressing or pointer is being canceled.
[] (Square bracket) or () (cracker) represents the subscript of the array expression.
(Period) Use the field reference operator by a pointer and structure. This will make the C operator -> (arrow) becomes unnecessary, although it is still allowed.
& (With symbol) to get the address of the variable.
.. (two stations) Separate up the up and down when specified the number of groups. For example: n [1..4].
The following types of operations are valid in the expression of the debugger:
Algebraic operation =, -, *, / (floating point operation), DIV (score of integer calculation), mod and exp (multiplication operation).
Billing operation -, i, bitand, xor, ~, << and >>
Logical OR, AND, NOT, II and &&
Comparison operation <,>, <=,> =, <> or! =, = Or ==
Other (type names), SIZEOF logic, and comparison expressions are used as conditions in STOP and TRACE.
Test the expression type. You can reset an expression type by renaming or overloading operators. The three renamed formats are: type name (expression), expression | type name, and (type name) expressions. The following is an example in which the X variable is an integer value of 97:
(dbx) Print X
97
(DBX) Print Char (x), X / Char, (CHAR) X, X
'a' 'a' 'a' 97 command line editor
The DBX command provides a command line editing function similar to the functionality provided by the Korn Shell. The VI mode provides an editing function similar to the VI, and the Emacs mode gives you a control function similar to the Emacs.
These features can be turned on by using the DBX sub-command set -o or set edit. To open the VI style command line editing, you can enter the subclock set edit vi or set -o vi.
You can also use Editor environment variables to set editing mode.
The DBX command will save the command in the history file .dbxhistory. If you do not set a DBXHISTFILE environment variable, the history file used is $ HOME / .DBXHISTORY.
Follow the default value, DBX will save the 128 commands recently entered. DBXHISTSIZE environment variables can increase this limit.
Sign
-a processID connects the debugger and the running process. To connect the debugger, you need to have permissions to use the kill command to the process. Use the PS command to determine the ID of the process. If you get a license, the DBX program interrupt the process, determines the full name of the target file, read symbol information, and prompt the command.
-c commandfile Reads the DBX subcommand in the file before reading the standard input. The file specified in the $ home directory will be processed first; then process the files in the current directory. Command files in the current directory will override the command files in the HOME directory. If the specified file does not exist in the $ home directory, the warning message will be displayed. Source subcommands can be used after the DBX program is running.
-d NestingDepth Sets the nesting limit of the program block. The default nested depth is limited to 25.
-E Debugenvironment Specifies the environment variable of the debugger.
-pOldpath = newpath: ... | pathfile specifies the path to the replacement library when checking the core file in the format of OldPath = NewPath. OldPath specifies the value that will be replaced (stored in the core file) and the NewPath specifies the new value to be replaced. These may be all or part of, absolute paths or relative paths. You can specify a number of replacements, and they are separated by colons. The opposite -P flag can specify the file name, map the previously read description format. Only one mapping is only read from the file per line.
-F can be used to turn off slow read mode and enable the DBX command to read all symbols at startup. By default, the slow read mode is open: it reads the required symbol table information when the DBX session is initialized. . In this mode, DBX will not read the variables and types that have not been read in those symbol information. Therefore, orders such as WHEREIS i are not listed in all instances of variable I in all functions.
-I Directory contains the directory specified by the Directory variable to the search source file directory list. The default directory of search source files is:
The directory where the source file is located when the file is compiled. The directory can only be searched when the compiler sets the source path in the object.
Current directory.
The current program is located.
-k mapping memory address; this is very useful for kernel debugging. -r Run the object file immediately. If it successfully ends, the DBX debugger will exit. Otherwise, it will enter the debugger and report the reason for the interrupt.
Note: Unless the -R is specified, the DBX command will prompt the user and wait for the command to enter.
-u Let the dbx command prefix the file name plus the @ (AT symbol). This logo reduces the possibility of symbolic confusion.
-x prevents the DBX command from skipping the _ (underline) character from the Fortran source code. This symbol allows DBX to distinguish between the symbols which except for the underscore, such as XXX and XXX_.
Example
The following example explains how to start a process while starting a DBX debugger. This example uses a program called Samp.c. The C program first generates a target file containing a symbolic list by compiling the -g flag. In this case, the program named: SAMP:
After the $ cc -g Samp.c -o Sampsamp program runs, the operating system reports a bus error and writes the core image to your current working directory, as shown below:
$ SAMP
BUS Error - Core Dumped To determine where an error occurs, enter:
$ DBX SAMP system will return as follows:
DBX Version 3.1
Type 'Help' for Help.
Reading symbolic information...
USING MEMORY Image IN CORE]
25 x [i] = 0;
(dbx) Quit This example explains how to connect DBX to the process. This example uses the following procedure Looper.c:
Main ()
{
INT I, X [10];
For (i = 0; i <10;);
} The program will not abort because I will not increase. Compile Looper.c with -g flag to get symbol debugging capabilities:
$ Cc -g looper.c -o loop Run Looper in the command line and performs the following steps to connect DBX to the program when it is running:
To connect DBX to Looper, you must determine the ID of the process. If you don't run Looper as a background program, you must start another XWindow window. In this xwindow window, enter:
PS -U Userid where userid is your login ID. All processes that belong to your event will be displayed:
PID TTY TIME COMMAND
68 Console 0:04 SH
467 LFT3 10:48 Looper in this example and the Looper process ID is 467.
To connect DBX to Looper, enter:
$ Dbx -a 467 system will return the following information:
Waiting to attach to Process 467.
Successfully attached to / tmp / looper.
DBX IS Initializing
Type 'Help' for Help.
...
Attached in main at line 5
5 for (i = 0; i <10;);
(dbx) Now you can query and debug the process as that programs are initially started by DBX.
To add a directory to the directory list of the source file of the search executable Objefile, you can enter:
$ dbx -i / home / user / src -i / home / group / srcobjfileuse subcommand can be used to implement this function after DBX start. The USE command re-sets the directory list and the -i flag adds a directory to the list.
To use the -R flag, type:
$ Dbx -r samp system will return as follows:
..
DBX Version 3.1
Type 'Help' for Help.
...
Bus Error In Main At Line 25
25 x [i] = 0;
(DBX) QUIT-R logo allows you to check the status of your process in memory although not set up a core image.
To specify the environment variable of the debugger, enter:
Dbx -e libpath = / home / user / lib -e language = ja_jp objfiledbx subcommand
Note: These subcommands can only be used when running a DBX debugger.
/ Search for some mode in the current source file.
• Search some mode in the current source file.
Alias (alias) creates an alias of the DBX subcommand.
Assign assigns a variable.
Attribute displays information about all or selects property objects.
Call (call) runs object code related to the specified process or function.
Case modifies the way the DBX debugger explains the symbol.
Catch (capture) starts capturing this signal before a signal is sent to the application.
CLEAR Deletes the stop line of all source specified rows.
Cleari removes all breakpoints in the address.
Condition displays information about all or selected conditional variables.
CONT Continue the execution of the current stop point until the program terminates or encounters the next breakpoint.
Delete deletes tracking and stop lines corresponding to the number of specified events.
DETACH continues the implementation of the application and exits the debugger.
Display Memory displays content in memory.
Down moves the current function down in the stack.
DUMP displays the name and value of the variable during the specified process.
Edit Start Editor Edit the specified file.
FILE (file) Modify the current source file into the specified file.
FUNC (function) modifies the current function into a specified process or function.
Goto (jump to) makes the specified line a row of the next run.
Gotoi modifies the program counter address.
Help displays help information for DBX subcommands or themes.
Ignore stops capturing this signal before a signal is sent to the application.
List Displays the row of the current source file.
Listi lists the instruction list of applications.
Map displays information about the application loading feature.
Move jumps to the next row and displays.
MultProc enables or disables multi-threaded debugging.
Mutex displays all or selected mutual exclusive information.
Next Run the application until the next source.
NEXTI runs the application until the next machine command.
Print prints the value of the expression or runs a process and the returns of the process. Prompt Modify the DBX command prompt.
Quit stops the DBX debugger.
Registers displays all universal registers, system control registers, floating point registers, and current command registers.
Run the application in accordance with the previously set parameters.
RETURN Continue the application's run until reaches a specified process.
Rwlock displays information about RWLOCKS.
Run starts running an application.
Screen opens an interaction of XWindow as the DBX command.
Set (setting) defines a value for the DBX debug program variable.
The SH passes the command to the shell to run.
SKIP continues to run the application from the current stop.
Source reads the DBX subcommand from the file.
Status Displays the tracking and stop subsis of the activity.
STEP runs a source line.
STEPI runs a machine instruction.
Stophwp Sets a hardware observation point to stop.
STOP stops running the application.
Stopi Set the stop point at the specified location.
Thread displays and controls threads.
TRACE prints information.
TracehwP Sets hardware observation points tracking.
Tracei opens tracking.
UNALIAS Delete an alias.
Unset (Cancel Settings) Deletes a variable.
Up (rise) moves the current function in the stack.
Use of Use (use) Settings a list of directories to search when searching for a source file.
WhatS displays the declaration of the application component.
WHERE displays a list of active procedures and functions.
Whereis displays all the names match the symbol of the specified identifier.
Which shows the list of given identifiers.
/ Subcommand
/ [RegularExpression [/]]]]]]
The / subcommand searches forward the mode specified by the RegularExpression parameter in the current source file. Without the parameter input / subcommand will make the DBX command to search for previous regular expressions. Search will be folded at the end of the file.
Example
To search forward in the current source file 12 numbers, please enter:
/ 12 To repeat the previous search, type:
/ See "(Search) sub-command and regcmp subroutines.
? Subcommand
? [RegularExpression [?]]]]
The subcommand searches the mode specified by the RegularExpression parameter in the current source file. Without parameter input? The subcommand will make the DBX command to search the previous regular expression. Search will be folded at the end of the file.
Example
Search later to search Z characters in the current source file, type:
? z To repeat the previous search, type:
? See / (Search) subcommand and REGCMP subroutines.
Alias subcommand
Alias [Name [[[arglist)] string | subsmand]]]]]
The Alias subcommand creates an alias for the DBX subcommand. The Name parameter is the alias to create. The String parameter is the sequence of the DBX subcommand, which can be referenced by NAME after executing the subsis. If the alias subcommand does not specify a parameter, it will display all current alias. Example
To replace RER with RR, enter:
Alias RR RERUN To run the print n and step two subcommands while entering PrintAndStep, enter:
Alias PrintAndStep "Print N; Step" Alias subcommand can also be used as a limited macro tool. E.g:
(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 hexadecimal value without permanently affecting the debug environment.
Assign subcommand
Assign Variable = Expression
The Assign subcign is allocated by the value specified by the Expression parameter to the variable specified by the Variable parameter.
Example
To assign a value 5 to an X variable, enter:
Assign X = 5 To assign the value of the variable y to the variable x, type:
Assign X = Y To assign the character value 'z' into the variable z, please enter:
Assign z = 'z' To assign the Boolean value false into the logical type variable B, enter:
Assign B = FALSE To assign strings "Hello World" into character pointer y, please enter:
Assign Y = "Hello World" To disable the type check, set the DBX debugger variable $ unsafeassign, enter:
SET $ unsafeassign See displaying and modify variables.
Attribute subcommand
Attribute [attributenumber ...]
The attribute subcommand displays information about the user thread, mutual exclusion or conditional property object defined for AttributeNumber parameters. If you do not specify a parameter, all properties objects will be listed.
For each attribute object listed, the following information will be displayed:
AtTR Follow the $ AATTRIBUTENUMBER format to indicate the symbol name of the property object.
Obj_addr points out the address of the attribute object.
TYPE points out the type of attribute object; the types of user threads, mutual exclusion, and conditional variables are THR, MUTEX or COND.
State points out the status of the property object. This state may be Valid or Inval.
Stack indicates a stack size attribute of a thread properties object.
Scope points out the scope of the thread attribute object. This will determine the contention of the thread and define the collection of threads that must be strive for process resources. For system or process domains, the value of the scope can be SYS or PRO.
PRIO points out the priority properties of the thread attribute object.
Sched pointed out the scheduling policy attribute of a thread properties object. This attribute controls the scheduling policy, optional value of FIFO, RR (cycle method) or Other.
P-Shar Specifies the process sharing properties of the mutual exclusion or conditional attribute object. If you can be accessed by threads of different processes, the mutual exclusion or condition is a process shared. This attribute value can be YES or NO. Protocol points out the mutually exclusive protocol properties. This attribute determines the role of maintaining thread priority mutual exclusion. The optional values have NO_PRIO, PRIO, or PROTECT.
note:
The PRINT subcommand of the DBX debugger can identify the symbol attribute name and can be used to display the status of the corresponding object.
The available properties depends on the implementation of the POSIX option.
Example
To list information about all properties, enter:
Attribute 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
To list information about attributes 1 and 3, enter:
Attribute 1 3
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 in the dbx command, and thread subcommands.
See also AIX 5L Version 5.2 General Programming Concepts: Writing Threads, Using Mutexes, and Using Condition Variables in Writing and Debugging Program.
Call subcommand
Call Procedure ([parameters])
The Call subcommand runs the process specified by the ProCedure parameter. The return code will not be printed. If the parameters are specified, they will pass to the running process.
example
To call a command when running DBX, enter:
(DBX) Call Printf ("Hello")
Helloprintf successfully returned.
Case subcommand
Case [Default | Mixed | LOWER | Upper]
The case subcommand modifies the way the DBX debugger explains the symbol. The default symbolic processing is dependent on the language currently used. If the current language is C, C or no definitions, these symbols will not be merged; if the current language is Fortran or Pascal, these symbols are merged into lowercase formats. If the symbol needs to be explained using the method of inconsistency with the current language, the subcommand is used.
The Case subcommand will display the current Case mode without parametric input.
Sign
DEFAULT changes with current language.
Mixed interprets the symbol by actually displayed.
LOWER explains the symbol by lowercase.
Upper is interpreted by capitalization.
Example
To display the current case mode, type:
Case To indicate the DBX command to explain the symbol according to the actual form, please enter:
Case Mixed To indicate DBX to explain the symbol in the uppercase, enter: Case Upper See Folding Variables to LowerCase and Uppercase.
Catch subcommand
Catch [SignalNumber | SignalName]
The Catch subcommand starts capturing this signal before the signal is sent to the application. This subcommand is useful when the debugged application handles a signal such as an interrupt. The signal to be captured can be specified by the signalnumber parameter, respectively or by name by the signalname parameter. The signal name is not case sensitive, and the prefix SIG is optional. If neither specified SignalNumber specifies the signalname parameter, the default capture is captured in addition to all signals outside SIGHUP, SIGCLD, SIGALARM, and SIGKILL. If you do not specify a parameter, a list of currently captured signals will be displayed.
Example
To display a list of signals currently captured by DBX, enter:
Catch To capture the Sigalarm signal, type:
Catch SigaLarm See Ignore subcommands and signal processing.
Clear subcommand
Clear SourceLine
The CLEAR subcommand deletes the stop of all gives the source file line. Sourceline parameters can be specified in two formats:
As an integer
Wood as a file name string, followed by one: (colon) and an integer
Example
To delete the breakpoints set in Chapter 19, enter:
Clear 19 See the Cleari subcommand and the delete subcommand. See also AIX 5L Version 5.2 General Programming Concepts: Writing and deletring BreakPoints in Writing and Debugging Programs.
Cleari subcommand
Cleari Address
The Cleari subcommand clears all breakpoints of the address specified by the Address parameter.
Example
To delete the breakpoint set at address 0x100001b4, type:
Cleari 0x100001B4 To delete the breakpoint set at the main () process address, enter:
Cleari & Main Please refer to Clear subcommand, DELETE subcommand, and AIX 5L Version 5.2 General Programming Concepts: Writing and Deleting Breakpoints in Writing and Debugging Programpoints.
Condition subcommand
Condition [Wait | NOWAIT | CONDitionNumber ...]
The Condition subcommand displays information about one or more condition variables. If one or more ConditionNumber parameters are specified, the condition subcommand will display the information of the specified condition variable. If there is no specified flag or parameter, the condition subcommand lists all the list of all condition variables.
The list of information for each condition is as follows:
CV indicates the symbol name of the condition variable according to the format of $ cconditionNumber.
Obj_addr Sets the memory address of the condition variable.
Num_Wait Set the number of threads waiting in the condition variable.
Waiters lists the user threads waiting for the condition variable.
Note: The PRINT subcommand identifier of the DBX debugger identifies the status of the symbol condition variable and is used to display the status of the corresponding object.
Sign
WAIT shows the condition variables with waiting threads.
NOWAIT displays conditional variables that are not waiting for a thread.
Example
To display information about all condition variables, enter:
Condition To display information about the conditional variable waiting for a thread, enter: condition wait
To display information about the conditional variable 3, enter:
Condition 3 similar output is:
CV Obj_addr num_wait waiters
$ C3 0x20003290 0 See attribute subcommand, mutex subcommand, print subcommand, and thread subcommand.
See also AIX 5L Version 5.2 General Programming Concepts: Writing Condition Variables in Writing and Debugging Programs.
Cont subcommand
Cont [SignalNumber | SignalName]
The CONT subcommand continues from the current breakpoint until the program ends or encounters another breakpoint. If the SignalNumber parameter (specified signal number) or the signalname parameter (specified signal name), the program will assume that the signal has been received and proceed. The signal name is not case sensitive and its prefix SIG is optional. If no signal is specified, the program will continue to perform as not stopped.
Example
To continue using the program from the current breakpoint location, enter:
Continental continues to execute programs as received as a SIGQUIT signal, type:
Cont Sigquit Refer to the DETACH subcommand of the dbx command, DBX's goto subcommand, DBX's next subcommand, DBX's SKIP subcommand, DBX's STEP subcommand.
DELETE subcommand
Delete {Number ... | all}
The delete subcommand removes tracking and stop from the application. You can delete all tracking and stops by the Number parameter to delete the specified tracking and stop, or by the all flag. Use the Status subcommand to display the DBX debugger to track and stop the generated tracking number and the stop number.
Sign
ALL deletes all tracking and stop.
Example
To remove all tracking and stop from the application, enter:
DELETE ALL To delete the tracking and stop of the event number 4, type:
DELETE 4 See the setting and deletrings in the Clear subcommand, Cleari subcommand, status subcommand, and AIX 5L Version 5.2 General Programming Concepter.
Detach subcommand
Detach [SignalNumber | SignalName]
The DETACH subcommand will continue the execution of the application and exit the debugger. The signal can be specified in any of the following:
Name, use signalname parameters
Serial number, use the SignalNumber parameter
The signal name is not case sensitive and the prefix SIG is optional.
If the signal is specified, the program will continue to execute as the signal is received. If no signal is specified, the program will continue to perform as not stopped.
Example
To exit DBX and continue the application, enter:
Detach To exit DBX and continue executing the program as you receive the SigRequest signal, type:
Detach SigRequest See using DBX Debug Program.
Display memory subcommand
{Address, address / | address / [count]} [mode] [> file]
The Display Memory subcommand that is initialized without any keyword will display some contents of memory controlled by the following factors: The range of memory is specified by one of the following two methods:
Two address parameters, the content between the two addresses will be displayed.
or
A Address parameter specifies that the display start address and a count parameter specifies the number of rows that start from Address.
Add a & (with symbol) to specify the symbol address before the name. The address can be an expression of other addresses and (plus),-(minus, regular), and * (indirect multiplication) operations. Any expression that contains in brackets will be considered an address.
The format of the display memory is controlled by the MODE parameter. The default value of the Mode parameter is the current mode. The initial value of the Mode parameter is X. Possible patterns include:
b Print an octave byte.
c Press the character to print a byte.
D prints a short word according to the decimal.
D Press the decimal to print a long word.
F print single precision.
g Print a double precision.
h Print a byte according to hexadecimal.
i Print Machine Directive.
The 8-byte decimal number of LLD prints symbols.
LLU prints no symbolic 8-byte decimal number.
LLX prints unsigned 8-byte hexadecimal number.
LLO prints no symbol-free 8-byte eight-input system.
o Print a short word according to octa.
O Print a long word according to octa.
Q Print an extension of the floating point.
s Print a string of an empty byte end.
x Press hexadecimal to print a short word.
X Press hex to print a long word.
Sign
> File redirect output to the specified file.
Example
To press hexadecimal to display a long word of a memory start address of 0x3ffe460, please enter:
0x3ffe460 / x To display the start address by the character, you are determined by the variable y, please enter:
& y / 2c To display the sixth to eighth elements in the Fortran string A_String, type:
& a_string 5, & a_string 7 / c See AIX 5L Version 5.2 General Programming Conception: Writing and Debugging Programs Examining Memory Addresses.
Down subcommand
Down [count]
The Down subcommand moves the current function in the stack to move the count. The current function is used to parse the name. The default value for the count parameter is 1.
Example
To move the level down in the stack, type:
Down To move three levels down in the stack, please enter:
Down 3 See the UP subcommand, where subcommand and AIX 5L Version 5.2 General Programming Concepts: Writing A Stack TRACE in Writing and Debugging Programs.
DUMP subcommand
Dump [Procedure] [> file]
The dump subcommand displays the name and value of all variables during the specified process. If the Procedure parameter is. (Cycle), all active variables will be displayed. If you do not specify an Procedure parameter, use the current process. If you use> file logo, the output will redirect to the specified file.
Sign
> File redirect output to the specified file.
Example
To display the name and value of the variable in the current process, enter:
DUMP To display the name and value of the variable in the process add_count, enter:
Dump add_count To turn the name and value of the variables in the current process to the Var.List file, please enter: dump> var.list See AIX 5L Version 5.2 General Programming Concepts: Writing and DEBUGGING Program DISPLAYING AND MODIFYING Variables.
Edit subcommand
Edit [Procedure | File]
The Edit subcommand starts the editor for the specified file. Files can be specified by file parameters or specifying the ProCedure parameter, where the editor will start and open the file containing the process. If no file is specified, the editor will call according to the current source file. The default is the VI editor. Override the default value by resetting the Editor environment variable to the editor name you want.
Example
To edit the current source file, type:
Edit To edit main.c file, please enter:
Edit Main.c To edit the file included in the do_count () process, enter:
Edit do_count See the list subcommand, vi or vedit command. See also AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs in Changing The Current File or Procedure and Displaying The Current File.
File subcommand
File [file]
The file subcommand converts the current source file to the file specified by the file parameter; it does not write the source file. FILE parameters can specify the path to the full file. If the file parameter does not specify a path, the DBX program is trying to find the file by searching using the path. If no file parameter file subcommand will display the current source name. If the path is known, the file subcommand also displays the full or relative path name of the file.
Example
To change the current source file with the main.c file, enter:
File main.c To display the current source file name, please enter:
File See the FUNC subcommand. See also AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs in Changing The Current File or Procedure and Displaying The Current File.
FUNC subcommand
Func [Procedure]
The FUNC subcommand changes the current function to the program or function specified by the parameter procedure. If the default value is not specified, the default value is displayed to display the current function. Change the current function to replace the current source file into a file containing new functions; the current name resolution has changed.
Example
To change the current function to the Do_count process, enter:
Func do_count To display the name of the current function, enter:
FUNC See the file subcommand. See also AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs in Changing The Current File or Procedure.
Goto subcommand
Goto Sourceline
The goto subcommand makes the source line a row to which you want to run. Usually specified source lines must be in the same function with the current row. To reset the constraint, use the set sub-command and bring $ unsafegoto flag.
example
To make the next line of behavior, please enter:
Goto 6 See the Cont subcommand, gotoi subcommand, and SET subcommand. Gotoi subcommand
Gotoi Address
The gotoi subcommand modifies the address specified by the address counter address for the Address parameter.
example
To modify the program counter address is 0x100002B4, please enter:
Gotoi 0x100002B4 See the goto subcommand.
Help subcommand
Help [Subcommand | Topic]
Display the help information of the DBX subcommand or theme according to the parameter HELP subcommand you specify. Enter the Help subcommand and bring the Subcommand parameter to display the description of the speech speech and the specified subcommand. Enter the Help subcommand and have a detailed description of the specified topic with the Topic parameter. The following is the available topics:
Startup lists the list of DBX boot options.
Execution lists and programs perform related DBX subcommands.
BreakPoints lists and breakpoints and tracking the related DBX subcommands.
FILES lists the DBX subcommand used to access the source file.
Data lists the DBX subcommand used to access program variables and data.
Machine lists DBX subcommand descriptions for debugging of machine level.
Environment lists the DBX subcommand used for DBX configuration and environment settings.
Threads lists the DBX subcommand to get thread-related objects.
Expressions describes DBX expressions syntax and operators.
Scope Description DBX resolves the name of the unused domain.
Set_variables lists the debug variables with use of the DBX.
USAGE lists DBX public subcommands with simple description.
Example
To list all available DBX subcommands and topics, enter:
Help To display the description of the DBX subcommand List, please enter:
Help List To display the description of the topic set_variables of the DBX command, please enter:
Help set_variablesignore subcommand
Ignore [SignalNumber | SignalName]
The IGNORE subcommand stops the capture of the specified signal before the signal is sent to the application. This subcommand is very useful when debugging a signal such as an interrupt.
The signal to be captured can be specified in any of the following:
SignalNumber parameter specifies the number of signals
SignalName parameter specifies the signal name
The signal name is not case sensitive. The prefix SIG is optional.
If no signalnumber is specified nor specified SignalName parameters, you will capture all signals other than Sighup, SigCLD, SigalRM, and Sigkill by default. If the SigTrap signal comes from a process other than the debugger, the DBX debugger cannot ignore the signal. If you do not specify a parameter, a list of all ignored signals will be displayed.
example
To make DBX ignore the alert clock timeout signal sent to the application, enter:
Ignore Alrm See the Catch subcommand. See also AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Program Handling Signals.
List subcommand
List [Procedure | SourceLine-Expression]]]
The List subcommand displays the row of the specified number of source files. The number of lines is specified by one of the following two methods:
Specify a process by using the ProCedure parameter.
In this case, the List subcommand displays the few rows before the start of the specified process until the list window is full.
Specify the start and end rows by using the SourceLine-Expression parameter.
The Sourceline-Expression parameter is composed of an optional (plus) or-(minus sign), and an integer. In addition, the SourceLine $ (USD) can be used to represent the current line number; SourceLine @ (AT symbol) can be used to indicate the line number of the next row to listed. All rows between the first specified row number and the second specified line number (including these two rows) will be displayed.
If you don't specify a second source, you only make one line.
If the List subcommand does not specify a parameter, the number of rows specified by $ ListWindow will be printed from the row of the current source file.
To modify the default value of the list row, you can set a specific debugger variable, $ ListWindow, the number of rows you want. The initial value of $ ListWindow is 10.
Example
To list the 1st to 10th lines in the current file, please enter:
List 1, 10 To list 10 lines, or $ ListWindow line MAIN programs, please enter:
List main should be in the middle of the current behavior, listed in 10 lines before and after, please enter:
List $ -5, $ 5 You can use simple integer expressions including addition and subtraction in the SourceLineExpression expression. E.g:
(dbx) List $
4 {
(dbx) List 5
5 char i = '4';
(dbx) List Sub
23 Char * SUB (S, A, K)
24 INT A;
..
(dbx) MOVE
25
(dbx) List @ -2
23 CHAR * SUB (S, A, K) See Edit subcommand, listi subcommand, and Move subcommand. See also AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs in Displaying The Current File.
Listi subcommand
Listi [Procedure | At SourceLine | Address [, Address]]]
The Listi subcommand shows the set of instructions specified by the source file. The displayed instructions can be specified by the following methods:
Provide the procedure parameter, where the Listi subcommand will list the command list from the specified process until the list window is filled.
Using the At SourceLine flag, where Listi starts a list of instructions from the specified row until the list window is filled. SourceLine variables can be specified by an integer or a file name string followed: (colon) and an integer method specified.
With the address parameter to specify the starting and end of the address, all instructions between the two addresses (including these two addresses) will be displayed.
If the Listi subcommand does not use a flag or parameter, the next $ listWindow directive is displayed. To modify the size of the current list window, you can use the Set $ ListWindow = Value subcommand.
Disassemble
The DBX program can disassemble the Power series or Power PC architecture instruction. In the default mode, the DBX program displays instructions that are running.
The $ INSTRUCTIONSET and the MNEMONICS variable in the dbx command are allowed to overwrite the default disassemble. For more information, see the Set subcommand in the dbx command.
Sign
SourceLine specifies the list of start command lines. Example
To list 10 or $ ListWindow instructions, enter:
Listi To list the machine instructions of the 10th line, enter
Listi AT 10 To list the machine commands of the source code on the source code in the Sample.c file, enter:
Listi at "Sample.c": 5 To list the address between 0x10000400 and 0x10000420, enter:
Listi 0x10000400, 0x10000420 See the list subcommand and set subcommand. See also AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs in Debuggingat The Machine Level with dbx.
Map subcommand
Map [> file]
The MAP subcommand displays the feature of each load in the application. This information includes the name, text source, text length, data source, and data length of each mounting block.
Sign
> File redirect output to the specified file.
See AIX 5L Version 5.2 General Programming Concects: Writing and debugging Program Level with dbx.
Move subcommand
Move sourceline
The MOVE subcommand will be replaced with the next display line to the row specified by the Sourceline parameter. This subcommand modifies the value of the @ (AT symbol) variable.
SourceLine variables can be specified by an integer or after a character string representing the file name: (colon) and an integer method specified.
Example
To change the next line to Chapter 12, please enter:
Move 12 To modify the next line to the 5th line of the file Sample.c, please enter:
Move "Sample.c": 5 See the list subcommand. See also AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs in Displaying The Current File.
Multproc subcommand
Multproc [on | Parent | Child | OFF]
The MULTPROC subcommand specifies the behavior when the DBX debugger is created during the derived or an overruption process. The ON flag is used to specify a new DBX session will be created to debug the subpath of the derived process. The original DBX will continue to debug the original parent path. Parent and Child flags are used to specify a separate path of the derived process. In addition to all of OFF, you can make DBX follow the processes. OFF logo disables multi-process debugging. If there is no specified flag, the multproc subcommand returns the state of the current debugged multi-process.
The DBX program uses XWindows to make multi-process debugging. The DBX program will open enough windows for multi-process debugging. The title of each sub-window is a child process ID (PID). To switch between processes, use XWINDOWS processing technology to activate the window of the DBX session display. If the system does not support xwindows, a warning message will appear when debugging the derived process and the DBX program continues only the Parent process. Multi-process debugging may also fail because of the following reasons:
The DBX program is not running in the XWindows environment.
XWindows has run but does not set a valid display name without setting a DBX universal $ xdisplay variable. The $ xdisplay variable is initialized to the SHELL's Display environment variable. Set Name = Expression DBX subcommand can be used to modify the value of the display name.
The / TMP directory does not allow read and write access to the debugger. The DBX program requires a small amount of space control XWindow environment in this directory. The system does not have enough resources to meet a new XWINDOW window.
$ xdisplay is set to remote display, and the user may not see the newly created XWindow. If the $ xdisplay setting is incorrect, XWindows or other system resources will report the cause of the error.
The DBX program cannot distinguish between different types of errors, but will send the following information when the subcommand fails:
Warning: DBX Subcommand MultiProc Fails. DBX
Continued with multproc disabled. User-defined configuration for the new creation window can be defined by the DBX_TERM application name in the .xdefaults file.
Sign
ON Enables multi-process debugging.
OFF disables multi-process debugging.
Example
To check the status of the current multi-process, enter:
Multproc To enable multi-process debugging, please enter:
Multproc ON To disable multi-process debugging, please enter:
MultProc Off See the Screen subcommand and the Fork subroutine. See also AIX 5L Version 5.2 General Programming Concepts: Debugging Program in Writing and Debugging ProGrams Involving Multiple Processes.
MUTEX subcommand
Mutex [Lock | Unlock | Thnum | UTID | MUTEXNUMBER ...]
The MUTEX subcommand displays information about mutual exclusion. If a given MUTEXNUMBER parameter MUTEX subcommand will display the specified mutual exclusion. If you do not specify a flag or parameter, the Mutex subcommand will display all mutual exclusive information.
Each mutually exclusive information is listed below:
Mutex specifies the mutual exclusive symbol name and follows the MMUTEXNUMBER format.
TYPE points out the mutual exclusion type: Non-REC (Non-recursive), Recursi, or FAST.
Obj_addr points to the mutual exclusive memory address.
LOCK points out the lock state of the mutual exclusion: YES If mutually exclusive has been locked, the no is not locked.
Owner If the mutual exclusion, it points to the symbolic name of the user thread with the mutual exclusion.
Blockers lists the user threads that are locked in the mutex.
Note: The PRINT subcommand of the DBX debugger identifies the mutual exclusive symbol name and can be used to display the status of the corresponding object.
Sign
LOCK displays information about locking mutual exclusion.
UNLOCK displays information about unlocking mutual exclusion.
ThNUM displays all mutual exclusive information for a particular thread.
UTID Displays all mutual exclusive information of the user thread that the user thread ID is consistent with the given user thread id.
Example
To display all mutually exclusive information, please enter:
Mutex wants to display all locked mutual exclusive information, please enter:
Mutex Lock
To display information about a mutex number 4, 5, 6, type:
MUTEX 4 5 6 output is similar to:
Mutex Obj_addr Type Lock Owner Blockers
$ m4 0x20003274 Non-Rec No
$ M5 0x20003280 Recursi NO
$ M6 0x2000328A Fast No To display mutual exclusive information of all thread 1, please enter:
Mutex Thnum 1 To display all mutual exclusive information with threads with a thread number 0x0001, enter: Mutex utid 0x0001 See attribute subcommand, condition subcommand, print subcommand, and thread subcommand.
See also AIX 5L Version 5.2 General Programming Concepts: Writing Mutexes in Writing and Debugging Program.
NEXT subcommand
Next [Number]
Next subcommand runs the application to the next line. Number parameter Specifies the number of times the next subcommand runs. If no Number parameters are specified, Next is only running once.
If you use the next subcommand in the multi-threaded application, run all user threads during operation, but the program continues to run until running to the specified row. If you want to run the running thread, set the $ HOLD_NEXT variable using the set subcommand. Setting this variable will cause a deadlock because the running thread may wait for a block that is blocking the thread.
Example
To continue to the next source, type:
Next To continue to execute the third line after the current source, please enter:
NEXT 3 See the Cont subcommand, goto subcommand, nexti subcommand, set subcommand, and step subcommand.
Nexti subcommand
Nexti [Number]
Nexti subcommand runs the application to the next instruction. The Number parameter specifies the number of times the nexti subcommand runs. If no Number parameter is specified, Nexti only runs once.
If you use a nexti subcommand in a multi-threaded application, all user threads will run during operation, but the program will continue to run until the running thread reaches the specified machine instruction. If you want to run the running thread, set the $ HOLD_NEXT variable using the set subcommand. Setting this variable will cause a deadlock because the running thread may wait for a block that is blocking the thread.
Example
To continue to the next machine directive, enter:
Nexti To continue to perform the third machine command from the current machine directive, enter:
Nexti 3 See gotoi subcommand, next subcommand, set subcommand, and STEPI subcommand. See also AIX 5L Version 5.2 General Programming Concepts: Writing a program at The Machine Level in Writing and Debugging Programs.
Print subcommand
Print expressions ...
Print Procedure ([parameters])
Print subcommand prints Perform the following tasks:
Print the value of the expression list specified by the Expression parameter.
Execute the procedure parameter specified by the procedure parameter and print the return value of the process. The included parameters are passed to the process.
Example
To display the X and Y left shift two-digit value, type:
Print X, Y << 2 To display the parameter 0 to call the return value of the SBRK routine, please enter:
Print SBRK (0) See the assign subcommand, the call subcommand, and the SET subcommand.
PROMPT subcommand
Prompt ["String"]
The PROMPT subcommand changes the prompt of the DBX command to the string specified by the String parameter.
example
To modify the prompt to DBX>, enter:
Prompt "DBX>" See AIX 5L Version 5.2 General Programming ConcePts: Writing A New DBX PROMPT in Writing and Debugging Programs. Quit subcommand
quit
The quit subcommand ends all the processes in the DBX debug dialog.
See the Detach subcommand.
Registers subcommand
Registers [> file]
The registers subcommand displays the general purpose register, system control register, floating point number register, and the value of the current command register.
The general purpose register is represented by the symbol $ RNUMBER variable, where the Number parameter specifies the serial number of the register.
Note: The value of the register can be set to a hexadecimal number of 0xDeadbeef. The hexadecimal number 0XDeadbeef is an initial value in the general register when the process is initialized.
The floating point register is represented by the $ FRNUMBER variable. Follow the default settings, floating point registers will not be displayed. To display a floating point register, use the Unset $ Noflregs DBX subcommand.
Note: If the current thread is in kernel mode, the registers subcommand will not display the register.
Sign
> File redirect output to the specified file.
See the SET subcommand and unset subcommand. See also AIX 5L Version 5.2 General Programming Concepts: Writing Machine Registers in Writing and Debugging Programs.
Run subcommand
Run [arguments] [
The RRUN subcommand starts the execution of the target file. The Arguments parameter will be passed as a command line parameter. If the arguments parameter is not specified, the parameters used by the last RUN or RERUN subcommand will be used again.
Sign
> File redirect output into the file file. >> File Add Redirected Output to File. 2> File Redirects the standard error to the file. 2>> File Add Redirected Standard Errors to File. > & File Redirects the output and standard errors to the file. >> & File Add Output and Standard Errors to File. See the RUN subcommand. ReturN subcommand Return [Procedure] The return subcommand causes the application until returned to the process specified by the Procedure parameter. If you do not specify an Procedure parameter, execution will stop when the current process is returned. Example To continue using the routine call, type: Return wants to continue to the main process, please enter: Return Main rwlock subcommand RWLOCK [Read | Write | rwlocknumber ....]] The rwlock subcommand displays information about RWLOCKS. If a given rwlockNumber parameter, the rwlock subcommand will display the specified rwlocks. If there is no specified flag or parameter, the rwlock subcommand will display all RWLOCKs information. The information on each rwlock is as follows: RWL Sets the RWLOCK symbol name, format is $ rw rwlocknumber. Flag_Value points out the value of the flag. Owner pointed out the owner of the rwlock. Status pointed out who owns the rwlock. This value can be read (if owned by the reader), writing (if you have a write) or idle (if free). WSLEEP [#] indicates that the written thread is blocked. # Describe the total number of thread blocks written. Rsleep [#] indicates that the read thread is blocked. # Describe the total number of threaded blocks read. Note: The PRINT subcommand of the DBX debugger identifies the symbolic name of the RWLock and can be used to display the status of its corresponding object. Sign READ displays all RWLock information in the read state. Write displays all RWLock information in writing. Example To display all RWLOCK information, type: RWLOCK output is similar to: RWL Flag_Value Owner Status $ RWL 1 $ T1 WRITE Rsleeps [0]: WSLEEPS [0]: To display all RWLock information, please enter: RWLOCK WRITE output is similar to: RWL Flag_Value Owner Status $ RWL 1 $ T1 WRITE Rsleeps [0]: WSLEPS [0]: See attribute subcommand, condition subcommand, mutex subcommand, print subcommand, and thread subcommand. Run subcommand Run [arguments] [ The run subcommand turns on the target file. The Arguments parameter will be used as a command line parameter. Sign > File redirect output into the file file. 2> File Redirects the standard error to the file. >> File Add Redirected Output to File. 2>> File Add Redirected Standard Errors to File. > & File Redirects the output and standard errors to the file. >> & File Add Output and Standard Errors to File. example To run the application with parameters, Blue and 12, enter: Run Blue 12 See the RERUN subcommand. SCREEN subcommand Screen The Screen subcommand opens an XWINDOW window for the DBX command. You can continue to operate on the window that happens. The Screen subcommand must run when the DBX debugger is running in an XWINDOWS environment. If the Screen subcommand runs in a non-XWindow environment, the DBX program will display a warning message and continue the debugging process as if the screen subcommand is not set. The Screen subcommand may also fail in the following cases: The DBX program is not running in the XWindows environment. XWindows has run but does not set a valid display name without setting a DBX universal $ xdisplay variable. The $ xdisplay variable is initialized to the value of the Display environment variable. DBX sub-command set name = Expression modifies the value of the display name. XWindows is running, but the Term environment variable is not set to a valid command name to call a new window. The / TMP directory does not allow read and write access to the debugger. The DBX program requires small space in this directory when the screen command is executed. The system does not have enough resources to meet a new XWINDOW window. The DBX program cannot distinguish between different types of errors, but will send the following information when the subcommand fails: Warning: DBX Subcommand Screen Fails. dbx If $ xdisplay is set to remote display, the user may not see the newly created XWindow. If the $ xdisplay setting is incorrect, XWindows or other system resources will report the problem. The user-defined configuration of the new creation window can be defined by the DBX_TERM application name in the .xdefaults file. Example To open an XWINDOW window interactive, enter: screen See AIX 5L Version 5.2 General Programming Concepts: Separating dbx Output Writing and Debugging Programs of From Program Output and AIX 5L Version 5.2 AIXwindows Programming Guide in AIXwindows Overview. SET subcommand Set [variable = expression] The set subcommand defines a value for the DBX debug program variable. Its value is specified by the Expression parameter; the program variable is specified by the variable parameter. Variable names cannot be conflicted with the usage names in the program being debugged. Extend the variable to the corresponding expression in other orders. If the SET subcommand does not use the parameter, the current variable will be displayed. The following variables can be set with the SET sub-command: $ CATCHBP captures breakpoints during the execution of the next command. $ EXPANDUNIS Displays the value of each part of the variant record or variant. $ FRAME uses the stack framework pointed to by the address specified by the value of the $ frame to perform the stack tracking and access local variables. $ HEXCHARS prints characters in accordance with hexadecimal value. $ HEXIN is explained in accordance with the hexadecimal interpretation address. $ HEXINTS prints integers according to hexadecimal numerical values. $ HEXSTRINGS Prints the character pointer according to the hexadecimal. $ HOLD_NEXT Controls Get all threads outside the running thread when running the Cont, NEXT, NEXTI, and STEP subcommands. Setting this variable will cause a deadlock because the running thread may wait for a block that is blocking the thread. $ IGNORELOAD will not stop when you run the LOAD, UNLOAD or LOADBIND subroutine. $ INSTRUCTIONSET Reset the default disassembly method. The following list contains the value of the Expression parameter may take: Default " Specifies the structure of the DBX program run. "COM" Specifies the command set of public cross-crossed modes of Power PC and Power Series architecture. The DBX program is default to Power-based ambiguity. "pwr" Specifies the command set and a mission of the POWER series architecture. "pwrx" Specifies the provision set and a mission of the Power series architecture to specify AIX 5.1 or earlier. "601" Specifies the Content Sets and Help Missing AIX 5.1 and earlier version of the PowerPC 601. "603" Specifies the Content Sets and Help Missing AIX 5.1 and earlier PowerPC 603. "604" Specifies the instruction set and help of the PowerPC 604 RISC microprocessor. PPC Specifies the instruction set and a mission based on the POWER architecture, except for the optional instruction. These instructions are valid in all Power implementation systems, except for AIX 5.1 or earlier PowerPC 601 RISC microprocessor. "any" Specifies any valid, Power-based or Power Series series instructions. For overlapping instructions, the default help notes are Power-based ambiguity. If an expression parameter is not set, DBX will use the default disassembly. $ ListWindow Specifies the number of rows of a function list and the number of rows that do not use the list when using the list submission. The default is 10 lines. $ MapAddRS Start the mapping address. Cancel $ mapAddRS settings will stop address mapping. $ MNEMONICS modifies the macrper setting of the DBX program. Default " Specifies a macker that is closest to the specified instruction. "pwr" Specifies a help not of the POWER series structure. PPC Specifies the help notes defined in the Power-based structure that does not include an optional instruction. If the EXPRESSION parameter value DBX program will close closer to the assigned command set. $ NOARGS omits parameters from subcommands, such as WHERE, UP, DOWN, and DUMP. $ Noflregs omits the display of floating point registers in the registers subcommand. $ Octin explains an octal address. $ Octints prints an octal integer. The $ pretty is connected to the Print submandle, and the value of complex C and C data structures (structure, joint, array) is displayed in PRETTY Printed format. "on" The specified value does not change the print, and has a landscaping print with a definite name indicating the statically range of the value. Verbose Specifies the proper printing of each value in each line and a qualified name with a static range indicating the value. A qualified name contains a list of points separated from the value related external blocks. "OFF" Specifies to close properly. This is the default setting. $ REPEAT If no command is input, repeat the previous command. The blocking signal of the $ SIGBLOCK program. $ Stepignore control how DBX is active when the STEP subcommand runs a source, and the source line calls another routine that can be returned without debugging. This variable allows the STEP subcommand to skip the routine that cannot get debug information. The following list contains the value of the Expression parameter may take: "function" Perform a function of the next subcommand of the DBX command. It's the default value. "Module" If the function is in a load block and cannot obtain debug information (eg, a system library), the NEXT sub-command function is executed. "none" Perform a function of the STEPI subcommand in the DBX command in the background until a directive available to the source file information. At this point, DBX will show where the run is stopped. $ THCOMP When the $ thComp will display the display information of the thread in the compression format. $ UNSAFEASSIGN Close the strict type check statement on both ends of the Assign statement. Even if the $ unsafeassign variable is set, the ASSIGN statement does not necessarily contain different sizes of storage types. $ unsafebounds Close the subscript check of the array. $ UNSAFECALL Turn off subroutines or strict type checks for the function call parameters. $ unsafegoto Close the Goto subtitable destination check. $ VARDIM Specifies the dimension that will be used when printing an unknown boundary. The default is 10. $ xdisplay specifies the name of the XWindows displayed, used for Multproc or Screen subcommand. The default is the value of the shell Display variable. The $ unsafe variable limits the use of the DBX debugger in error detection. Example To modify the number of rows that the default list is 20, please enter: Set $ listWindow = 20 To disable the type check of the assign subcommand, enter: Set $ unsafeassign To use AIX 5.1 or earlier PowerPC 601 RISC microprocessor's disassembler command, enter: set $ instructionSet = "601" to see UNSET subcommand. See also AIX 5L Version 5.2 General Programming Concepts: Writing Print Output with Special Debug Program Variables in Writing and Debugging Program. Set Edit [VI, Emacs] or SET -O [VI, EMACS] subcommand The set subcarrone with the -O or EDIT option can be used to open a row editing mode. If the SET-O VI or Set Edit Vi command is given, you will be in the input mode of the VI row editor. If you give the Set -o Emacs or Set Edit Emacs command, you will be in the input mode of the EMACS row editor. Example To open the VI line editor, enter: SET-O VI or Set Edit Vish subcommand SH [Command] The SH subcommand passed the command specified by the Command parameter to the shell execution. Which shell is used to use the shell environment variable. The default is the SHELL. If you do not specify a parameter, the control will be handed over to the shell. Example To run the LS command, enter: SH ls To enter the shell, please enter: SH To use the shell environment variable, type: SH Echo $ shell See AIX 5L Version 5.2 General Programming Conception: Writing Shell Commands from DBX in Writing and Debugging Programs. SKIP subcommand Skip [Number] The SKIP subcommand continues from the current stop point. The breakpoint equal to the value of the Number parameter will be skipped and will stop executing at the end of the next break point or the program. If no Number parameter is specified, the default is 1. Example To continue using the program until the second breakpoint, type: SKIP 1 can also see the Cont subcommand. Source subcommand Source file Source subcommand reads the DBX subcommand from the file specified by the FILE parameter. Example To read the DBX subcommand from the cmdfile file, enter: Source Cmdfile See AIX 5L Version 5.2 General Programming Concepts: Writing DBX Subcommands from a file in Writing and Debugging Programs. STATUS subcommand STATUS [> file] The status subcommand displays the currently active Trace and STOP subcommands. > Signs from the output of the Status subcommand to the file specified by the file parameter. Sign > File redirect output into the file file. See the CLEAR subcommand of the dbx command, the delete subcommand, the stop subcommand, the trace subcommand. See also AIX 5L Version 5.2 General Programming Concepts: Writing and deletring BreakPoints in Writing and Debugging Programs. STEP subcommand Step [Number] The Step subcommand runs the application source command line. Specify the number of rows executed by the Number parameter. If the Number parameter is omitted, the default is 1. If you use the Step subcommand in the multi-threaded application, all user threads are running, but the program continues until the running thread reaches the specified source engine. If you want to run the running thread, set the $ HOLD_NEXT variable using the set subcommand. Setting this variable will cause a deadlock because the running thread may wait for a block that is blocking the thread. Note: Use the $ STEPIGNORE variable of the set sub-command to control the behavior of the Step subcommand. The $ Stepignore variable allows the STEP sub-command to skip routines that cannot obtain debug information. Example To continue with a source, type: STEP To continue with five lines, please enter: STEP 5 To prevent the DBX program from step-by step to execute the Printf function, as described below: 60 Printf ("Hello World / N"); please enter: SET $ Stepignore = "function"; Step See the Cont subcommand, goto subcommand, next subcommand, set subcommand, and step command. STEPI subcommand Stepi [Number] The Stepi subcommand runs the application. Specify the number of instructions executed by the Number parameter. If the Number parameter is omitted, the default is 1. If you are using on a multi-threaded application, the Stepi subcommand is only available to execute the current running thread. All other threads will stop. Example To continue with a machine directive, enter: Stepi To continue the command of 5 machine instructions, please enter: Stepi 5 See gotoi subcommand, nexti subcommand, step subcommand. STOP subcommand Stop {[variable] [at Sourceline | In Procedure] [ife]} The STOP subcommand stops the application when meeting a particular condition. The application will stop at the following conditions: The condition value is true, if the IF condition flag is used. Procedure is called if the in procedure flag is used. If a variable parameter is specified, Variable has changed. If the At SourceLine flag is set, it reaches the Sourceline line. SourceLine variables can be specified by an integer or representative file name, following: (colon) and an integer method specified. After the arbitrary command is complete, the DBX debugger generates a message report that it has been generated as a command result. This message includes the ID of the event related to your breakpoint and the explanation of your command. The syntax explained is not necessarily the same as your command. Example: STOP IN MAIN [1] stop in main STOP AT 19 IF X == 3 [2] Stop at "Hello.c": 19 IF x = 3 The numbers in square brackets are identifiers of the event related to the breakpoint. The DBX debugger links the number of events and each STOP subcommand. When an event causes the program to stop, the event identifier will be displayed with the current row to illustrate an event that causes the program to stop. The event you created and the internal event generated by the DBX command coexist, so the event number may not always be. Use the Status subcommand to view these event numbers. You can redirect the output to a file to a file. Use the Delete or Clear subcommand to turn off the stop subcommand. In multi-threaded applications, all user threads will stop when any user thread encounters breakpoints. The breakpoints set in the source file line and function will be encountered by any user thread that execute the row and the function unless you specify the condition in the manner described below. The following alias is automatically specified: bfth (function, threadnumber) Blth (SourceLine, Threadnumber) ThreadNumber is a digital part of the thread symbol name, reported by the Thread subcommand (for example, 5 is ThreadNumber named $ T5 thread). These alias is actually macro, they produce the extension subdix as follows: Stopi AT & Function IF ($ Running_thread == Threadnumber Stop at SourceLine IF ($ Running_thread == ThreadNumber) Sign At Sourceline Specify the line number. If condition specifies the condition, such as a true value. In procedure Specifies the process of calling. Example To stop at the first statement during the MAIN, type: STOP IN Main This When the value of the X variable changes when performing at 12th execution, stop execution, please enter: STOP X AT 12 To stop executing at the fifth line of the sample.c file, enter: Stop at "Sample.c": 5 Check the X value when the dbx command is run each time the subroutine of FUNC1, please enter: STOP IN FUNC1 IF X = 22 To check the dbx command, each time the value is run when the FUNC1 function is run, please enter: Stopi AT & FUNC1 IF X = 22 When changing the value of a Variable variable, stop the program, type: Stop variable should be at any time to change the runtime to the true stop program, please enter: STOP if (x> y) and (x <2000) The following example lists how to display events and delete them: STATUS [1] stop in main [2] stop at "Hello.c": 19 IF x = 3 Delete 1 STATUS [2] stop at "Hello.c": 19 IF x = 3 Clear 19 STATUS (dbx) delete command to delete an event with event identifier. The CLEAR command removes the breakpoint by the line number. To set the breakpoint in the beginning of FUNC1, and only if it is executed by thread $ T5, enter one of the following equivalents: Stopi AT & FUNC1 IF ($ Running_thread == 5) or BFTH (FUNC1, 5) See the Clear subcommand, the delete subcommand, the stopi subcommand, and the trace subcommand. See also AIX 5L Version 5.2 General Programming Concepts: Writing and deletring BreakPoints in Writing and Debugging Programs. STOPHWP subcommand Stophwp Address Size The stophwp subcommand sets a hardware monitor point to the specified memory area. If the content change program of the area will stop. Note: The success of the STOPHWP subcommand is that hardware dependence. This feature can only be used in a 630 type, PowerPC model, and later models. Since the hardware can only set a monitoring limit, the observation event that is active when trying to create another hardware observation point will conflict in Stophwp and TracehwP. Similarly, the previous event must be deleted before creating a new event. Similarly, because there is an active software observation point (generated by some STOP and TRACE subdigns) to cancel the performance of hardware monitoring points, these types of events can also be deleted as a conflict event that must be deleted before creating a hardware monitor point. Example 1. When the start address is 0x200004E8, you should stop the program when the memory content changes, please enter: Stophwp 0x200004e8 4 See the tracehwp subcommand. STOPI subcommand Stopi {[address] [at address | in procedure] [ife The Stopi subcommand sets a stop point at the specified location: The program can be stopped at the specified condition via the if Condition flag. Through the address parameter, the program stops running when the content of Address is modified. With the At Address flag, set the stop point at the specified address. With the in procedure logo, the program stops when calling procedure. Sign If condition specifies the condition, such as a true value. In procedure Specifies the process of calling. AT Address specifies the machine command address. Example Stop execution at the address 0x100020F0, type: STOPI AT 0x100020F0 stops when the content of the address is 0x100020F0, please enter: STOPI 0x100020F0 is stopped when the content of the address is 0x20002020f0 is changed, please enter: STOPI 0x200020F0 IF ($ running_thread == 1) See the STOP subcommand. See also AIX 5L Version 5.2 General Programming Concects: Writing and Debugging Program Level with dbx. THREAD subcommand Display the selected thread Thread {[info] [-] [threadnumber ...]} | CURRENT | RUN | SUSP | TERM | WAIT Select a separate thread Thread current [-] ThreadNumber Keep or release threads Thread {Hold | UnHold} [-] [threadnumber ...] Get the help of display options Thread {help} The thread subcommand displays and controls the user thread. The first form of the Thread subcommand can be displayed in two formats. If the Thread subcommand is TH, the first format will be used. If the Thread subcommand is TH -, then information will be displayed in the second format. If you do not specify a parameter, information of all user threads will be displayed. If one or more ThreadNumber parameters are specified, the information of the related user thread is displayed. If the thread subcommand displays the thread, the current thread command will add>. If the running thread and the current thread are inconsistent, * symbol will be added before the row. The information displayed by the thread subcommand is as follows. The information displayed by the thread subcommand according to the first way is as follows: Thread Indicates the symbol name of the user thread according to the $ TTHREADNUMBER format. State-k pointed out the status of the core thread (if the user thread is connected to the core thread). It can be Run, Wait, SUSP or TERM, corresponding to operation, waiting, hang, and termination, respectively. WCHAN pointed out that the core thread is waiting for or sleep (if the user thread is connected to the core thread). State-u indicates the status of the user thread. There may be Running, Blocked or Terminated. K-TID indicates the core thread identifier (if the user thread is connected to the core thread). Mode indicates the way the user thread stops (if the user thread is connected to the core thread), it can be a core approach or user mode. Held pointed out whether to keep the user thread. Scope points out the domain of user threads; for system or process domains, SYS or PRO. Function points to the name of the user thread function. The information displayed by the Thread subcommand as follows. According to the default value, the information displayed is a long format for the THREAD sub-command TH-parameter. Thread pointed out that the symbol name of the user thread is based on the $ TTHREADNUMBER format. Information about the core thread TID pointers the user thread identifier (if the user thread is connected to the core thread). PRI pointed out the priority of the core thread. Sched pointed out the scheduling strategy of the core thread. It can be FIF, OTH, or RR, respectively correspond to FIFO, other and robe (Round Robin) scheduling policies. State pointed out the status of the core thread (if the user thread is connected to the core thread). It can be Run, Wait, SUSP or ZOMB, corresponding to operation, waiting, hang, and zombie state. User thread related information TID pointers the user thread identifier. PRI points out the priority of the user thread. Sched pointed out the scheduling policy of the user thread. It can be FIF, OTH or RRs corresponding to FIFO, other and robe (Round Robin) scheduling policies. State pointed out the status of the user thread. It can be Running, Creating, Suspended, Block, Runnable, or Terminated. State points out the user status according to hexadecimal. Flags points out the value of the PThread logo according to hexadecimal. WCHAN pointed out that the core thread is waiting for or sleep (if the user thread is connected to the core thread). Mode pointers the way the user thread stop (core or user) (if the user thread is connected to the core thread). HELD pointed out whether to keep the user process. Scope points out the domain of user threads; for system or process domains, SYS or PRO. Cancellation Pending It is pointed out whether it is canceled in a suspended state. State It is pointed out that the canceled mode and state. If the cancellation is not suspended, the state and the mode are enabled and postup, with the ED, if the cancel state and mode are enabled and asynchronous, use the EA representative, and if the mode is not enabled, use D. If the state and mode that is canceled, the mode is enabled and delayed, the ED is represented, and if the cancel state and mode are enabled and asynchronous, the EA is used, and if the mode is not enabled, the D is represented. JoinABLE indicates whether the thread can be connected. Boosted pointed out the thread boosted value. Function points to the name of the user thread function. Cursig pointed out the value of the current signal. If option is set $ Thcomp, the information will be displayed in the following compression format. M Mode (k) ERNEL (U) SER K K-State (r) Unning (w) AIMBIEU U-State (R) Unning (r) Unnable (s) uspended (t) erminated (b) Locked (c) REATING H held (yes) (n) o S Scope (s) YSTEM (P) Rocess C Cancellation Not Pending: (e) NABLED & (D) Eferred, (e) NABLED & (A) SYNC, (D) Isabled PENDING: (E) NABLED & (D) Eferred, (E) NABLED & (A) SYNC, (D) Isabled J JOINABLE (N) O B B Boosted Value Of Boosted Field in Pthread Structure PLK KERNEL THREAD (OTH) ER (FIF) O (RR) -> Round-Robin Policy PLU User Thread (OTH) ER (FIF) O (RR) -> Round-Robin Policy PRK KERNEL THREAD HEX NUMBER Policy PRU User Thread HEX Number Policy K-TID hexadecimal kernel thread identity U-TID hexadecimal PTHREAD logo FL hexadecimal value of the flag field in the PTHRead structure The value of the status field in the STA hexadecimal PTHREAD structure CS current signal value WCHAN thread is waiting for an event The second format of the Function function name thread subcommand is used to select the current thread. The PRINT, Registers, and WHERE subcommands of the DBX debugger are working in the context of the current thread. If the current thread is at the core mode Registers subcommand, the register cannot be displayed. The third format of the thread subcommand is used to control the execution of the thread. You can keep the thread using the HOLD flag, or use the UnHold flag to release the thread. The maintained thread will not continue until it is released. Note: The PRINT subcommand of the DBX debugger identifies the symbolic name of the thread and can display the status of the corresponding object. Sign Current If the THREADNUMBER parameter is not specified, the current thread will be displayed. If the threadNumber parameter is specified, select the specified user thread as the current thread. HELP displays information about the thread options displayed when using the TH - command. HOLD If there is no ThreadNumber parameter, all user threads will be maintained and displayed. If you specify one or more ThreadNumber parameters, you will remain and display the specified user thread. UnHold If the THREADNUMBER parameter is not specified will release and display all previously kept user threads. If you specify one or more ThreadNumber parameters, the specified user thread will be released and displayed. Info If you do not specify a ThreadNumber parameter, a long format list of all user threads will be displayed. If you specify one or more ThreadNumber parameters will display a list of long formats for the specified user thread. All of the above signs use the [-] option. If this option is given, the information will be displayed in the second format and the long format unless set $ THComp option is set. Run displays threads in the RUN state. SUSP displays threads in SUSP status. Term displays threads in Term status. WAIT displays threads in the WAIT state. Example To display all WAIT information, please enter: Thread Wait Output is similar to: Thread State-K Wchan State-U K-TID MODE HELD Scope Function $ T1 Wait Running 17381 U No Pro Main $ T3 WAIT RUNNING 8169 U NO PRO IOTHREAD To display a number of given threads, please enter: Thread 1 3 4 output is similar to: Thread State-K Wchan State-U K-TID MODE HELD Scope Function $ T1 Wait Running 17381 U No Pro Main $ T3 WAIT Running 8169 U No Pro Iothread > $ T4 Run Running 9669 U No Pro Save_thr To make thread 4 become current thread, please enter: Thread Current 4 To keep the line 2, please enter: Thread Hold 2 To display information in a wait state, please enter: Thread Wait - Output is similar to: Thread M K U H S C J B KPL UPL KPR UPR K_TID U_TID FL STA WCHAN FUNCTION * $ T1 U R W N p Ed y 0 oth OTH 61 1 0043E5 000001 51 004 Main $ T3 U R w N p Ed y 0 oth os 61 1 001fe9 000102 51 004 Iothread > $ T4 U R R N P Ed y 0 OTH 61 1 0025C5 000203 50 064 Save_thr To display a number of given threads in the second format, type: Thread - 1 2 3 Output is similar to: Thread M K U H S C J B KPL UPL KPR UPR K_TID U_TID FL STA WCHAN FUNCTION * $ T1 U R W N p Ed y 0 oth OTH 61 1 0043E5 000001 51 004 Main $ T3 U R W N p Ed y 0 oth os 61 00fe9 000102 51 004 IotHRead > $ T4 U R R N P Ed y 0 OTH 61 1 0025C5 000203 50 064 Save_thr See attribute subcommand, condition subcommand, mutex subcommand, print subcommand, registers subcommand, and WHERE subcommand. See also AIX 5L Version 5.2 General Programming Concepts: Writing Threads in Writing and Debugging Programs. Trace subcommand Trace [SourceLine | Expression at Source | Procedure | [Variable] [At SourceLine | In Procedure]] [ife] The Trace Submand Time Track Print Specify Process, Functions, Command Lines, Expressions, or Variables Tracking Information. SourceLine variables can be specified by an integer or representative file name, following: (colon) and an integer method specified. You can specify the condition. The DBX debugger links a number and each trace subcommand. Use the Status subcommand to view these numbers. Use the Delete subcommand to close the track. Tracking is based on the process based on the default. To create a thread-based track, specify the thread in accordance with the conditions of Example 8. Sign At Sourceline specifies the source line of discovering the tracked expression. If Condition Specifies the conditions for the start of the track. Tracking is only executed when IF condition is true. In procedure specifies the process used to discover the tracked process or variable. Example To track the call to each PrintF process, enter: TRACE Printf To track each execution of the Hello.c file 22, please enter: Trace "Hello.c": 22 To track the modification of the X variable during the main process, enter: TRACE x in main To track the data address 0x2004000, please enter: SET $ A = 0x2004000 TRACE $ A Note: The tracei subcommand is used to track the address. You can limit the printed printed Print to the specified procedure event. You can also specify optional Condition to control when to generate tracking information. E.g: (dbx) Trace in SUB2 [1] Trace in SUB2 (dbx) Run TRACE IN Hellosub.c: 8 Printf ("% s", s); TRACE IN HELLOSUB.C: 9 I = '5'; TRACE IN HELLOSUB.C: 10} You can display a message each time the process is called or returned. When a process is called, the message includes the name of the passing parameters and the called routine. In return, this information includes a value returned from Procedure. E.g: (dbx) TRACE SUB [1] TRACE SUB (dbx) Run Calling sub (s = "hello", a = -1, k = delete) from function main Returning "Hello" from Sub You can print the value of the Expression when the program is running to the specified row. The line number and file will be printed, but the source command line will not be printed. E.g: (DBX) Trace X * 17 AT "Hellosub.c": 8 IF (x> 0) [1] Trace X * 17 AT "Hellosub.c": 8 IF x> 0 (dbx) Run AT line 8 in file "hellosub.c": x * 17 = 51 (dbx) Trace X [1] TRACE X Initially (at line 4 in "hello.c"): x = 0 After line 17 in "Hello.c": x = 3 To track the change in X variable in the $ T1 thread, enter: (dbx) Trace X if ($ running_thread == 1) can also see the tracei subcommand. Tracehwp subcommand Tracehwp Address Size The tracehwp subcommand sets a hardware monitor point to the specified memory area. If the content of the area changes, the DBX debugger prints the tracking information. Note: The success of the TracehwP command is that hardware dependence. This feature can only be used in a 630 type, PowerPC model, and later models. Since the hardware can only set a monitoring limit, the observation event that is active when trying to create another hardware observation point will conflict in Stophwp and TracehwP. Similarly, the previous event must be deleted before creating a new event. Similarly, because there is an active software monitoring point (generated by some STOP and TRACE sub-command), the performance of the hardware monitoring point can be used as a conflict event that must be deleted as a hardware monitor point. Example To track the 4-byte memory content of the start address is 0x200004E8, please enter: TRACEHWP 0x200004E8 4 See the Stophwp subcommand. Tracei subcommand Tracei [[Address] [At Address | In Procedure] | Expression At Address] [ife] The Tracei subcommand is turned on in the following cases: The address content specified by the Address parameter is changed if the Address flag is included. If the AT Address parameter is specified, run the At Address command. The process specified by Procedure is active if the In Procedure flag is included. The condition specified by condition is true if the if condition flag is included. Sign AT Address specifies an address. Tracking can be enabled when the instruction at this address is run. IF condition specifies the condition. Track is enabled when this condition is satisfied. In procedure specifies a process. The process is lacking when the process is active. Example To track execution of each instruction, type: Tracei To track commands performed at address 0x100020f0 each time you are: Tracei AT 0x100020F0 Tracks the memory address 0x20004020 when the main process activity is changed each time, please enter: Tracei 0x20004020 In Main To track each execution of the command to the command 0x10002020F0, please enter: TRACEI AT 0x100020F0 IF ($ running_thread == 4) See the trace subcommand. See also AIX 5L Version 5.2 General Programming Concects: Writing and Debugging Program Level with dbx. UNALIAS subcommand UNALIAS NAME The UNALIAS subcommand deletes the alias specified by the Name parameter. example To delete an alias called PrintX, type: Unalias Printx See Alias subcommand. See also AIX 5L Version 5.2 General Programming Concepts: Writing Subcommand Aliases in Writing and Debugging Programs. UNSET subcommand Unset name The UNSET subcommand deletes the DBX debugger variables associated with the name specified by the parameter name. example To delete a variable that disables the display floating point register, type: Unset $ NoflRegs See the SET subcommand. See also AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs in Changing Print Output with Special Debugging Variables. UP subcommand Up [count] The UP subcommand moves the current function to move the count in the stack. The current function is used to parse the name. The default value for the count parameter is 1. Example To move the current function up to the stack, enter: UP 2 To display the current function in the stack, enter: UP 0 See the DOWN subcommand. See also AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Program Change, Displaying A Stack TRACE, DISPLAYING A Stack TRACE. USE subcommand Use [Directory ...] Use subcommand setting When the DBX debug command is looking for a list of directories to search for the source file. If you do not specify the parameters of the USE subcommand, the current directory list you want to search. @ (AT symbol) is a special symbol that indicates the full path name information in the DBX program to find the full path name in the destination file, if exists. If you have a related directory called @ To search, you can use it in the search path ./@. Use the subcommand uses (plus) to add a directory to the list of search directories. If you have a directory named , specify a complete directory path name (for example,. / Or / tmp / ). Example To change the search directory list to the current directory (.), Parent directory (..), and / TMP directory, enter: Use .. / TMP To change the search directory list to the current directory (.), the source file compile (@), please enter: Use. @ ../source To add the / tmp2 directory to the list of directory to be searched, please enter: Use / TMP2 can also be found in the Edit subcommand and the list subcommand. Whatis subcommand Whatis Name The WHAT subcommand displays the declaration of the Name, where the Name parameter specifies the name of the variable, process or function, and the block name is optional. Note: Use the whereis subcommand only when the DBX debugger is running. Example To display the declaration of the X variable, enter: What x is to show the state of the main process, please enter: What main