When you are using dbx to debug a mixture of Java and native code, dbx commands fall into several categories:
Commands that accept the same arguments and operate the same way in Java mode or JNI mode as in native mode (see Commands With Identical Syntax and Functionality in Java Mode and Native Mode).
Commands have arguments that are valid only in Java mode or JNI mode, as well as arguments that are valid only in native mode (see Commands With Different Syntax in Java Mode).
Commands that are valid only in Java mode or JNI mode (see Commands Valid Only in Java Mode).
Any commands not included in one of these categories work only in native mode.
The Java expression evaluator used in most dbx commands supports the following constructs:
All literals
All names and field accesses
this and super
Array accesses
Casts
Conditional binary operations
Method calls
Other unary/binary operations
Assignment to variables or fields
instanceof operator
Array length operator
The Java expression evaluator does not support the following constructs:
Qualified this, for example, <ClassName>.this
Class instance creation expressions
Array creation expressions
String concatenation operator
Conditional operator ? :
Compound assignment operators, for example, x += 3
A particularly useful way of inspecting the state of your Java application is using the display facility in the dbx Debugger.
Depending on precise value semantics in expressions that do more than just inspect data is not recommended.
Much of the information about a Java application is normally available only after the JVM software has started, and is unavailable after the Java application has finished executing. However, when you debug a Java application with dbx, dbx gleans some of the information it needs from class files and JAR files that are part of the system class path and user class path before it starts the JVM software. This allows dbx to do better error checking on breakpoints before you run the application.
Some Java classes and their attributes might not be accessible through the class path. dbx can inspect and step through these classes, and the expression parser can access them, once they are loaded. However, the information it gathers is temporary and is no longer available after the JVM software terminates.
Some information that dbx needs to debug your Java application is not recorded anywhere so dbx skims Java source files to derive this information as it is debugging your code.
The following dbx commands have the same syntax and perform the same operations in Java mode as in native mode.
Command |
Functionality |
---|---|
attach |
Attaches dbx to a running process, stopping execution and putting the program under debugging control |
cont |
Causes the process to continue execution |
dbxenv |
List or set dbx environment variables |
delete |
Deletes breakpoints and other events |
down |
Moves down the call stack (away from main) |
dump |
Prints all variables local to a procedure or method |
file |
Lists or changes the current file |
frame |
Lists or changes the current stack frame number |
handler |
Modifies event handlers (breakpoints) |
import |
Import commands from a dbx command library |
line |
Lists or changes the current line number |
list |
Lists or changes the current line number |
next |
Steps one source line (steps over calls) |
pathmap |
Maps one path name to another for finding source files, etc. |
proc |
Displays the status of the current process |
prog |
Manages programs being debugged and their attributes |
quit |
Exits dbx |
rerun |
Runs the program with no arguments |
runargs |
Changes the arguments of the target process |
status |
Lists the event handlers (breakpoints) |
step up |
Steps up and out of the current function or method |
stepi |
Steps one machine instruction (steps into calls) |
up |
Moves up the call stack (toward main) |
whereami |
Displays the current source line |
The following dbx commands have different syntax for Java debugging than for native code debugging, and operate differently in Java mode than in native mode.
Command |
Native Mode Functionality |
Java Mode Functionality |
---|---|---|
assign |
Assigns a new value to a program variable |
Assigns a new value to a local variable or parameter |
call |
Calls a procedure |
Calls a method |
dbx |
Starts dbx |
Starts dbx |
debug |
Loads the specified application and begins debugging the application |
Loads the specified Java application, checks for the existence of the class file, and begins debugging the application |
detach |
Releases the target process from dbx’s control |
Releases the target process from dbx’s control |
display |
Evaluates and prints expressions at every stopping point. |
Evaluates and prints expressions, local variables, or parameters at every stopping point |
files |
Lists file names that match a regular expression |
Lists all of the Java source files known to dbx |
func |
Lists or changes the current function |
Lists or changes the current method |
next |
Steps one source line (stepping over calls) |
Steps one source line (stepping over calls) |
|
Prints the value of an expression |
Prints the value of an expression, local variable, or parameter. |
run |
Runs the program with arguments |
Runs the program with arguments |
step |
Steps one source line or statement (stepping into calls) |
Steps one source line or statement (stepping into calls) |
stop |
Sets a source-level breakpoint |
Sets a source-level breakpoint |
thread |
Lists or changes the current thread |
Lists or changes the current thread |
threads |
Lists all threads |
Lists all threads |
trace |
Shows executed source lines, function calls, or variable changes |
Shows executed source lines, function calls, or variable changes |
undisplay |
Undoes display commands |
Undoes display commands |
whatis |
Prints the type of expression or declaration of type |
Prints the declaration of an identifier |
when |
Executes commands when a specified event occurs |
Executes commands when a specified event occurs |
where |
Prints the call stack |
Prints the call stack |
The following dbx commands are valid only in Java mode or JNI mode.
Command |
Functionality |
---|---|
java |
Used when dbx is in JNI mode to indicate that the Java version of a specified command is to be executed |
javaclasses |
Prints the names of all Java classes known to dbx when you give the command |
joff |
Switches dbx from Java mode or JNI mode to native mode |
jon |
Switches dbx from native mode to Java mode |
jpkgs |
Prints the names of all Java packages known to dbx when you give the command |
native |
Used when dbx is in Java mode to indicate that the native version of a specified command is to be executed |