JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.3: Debugging a Program With dbx     Oracle Solaris Studio 12.3 Information Library
search filter icon
search icon

Document Information

Preface

1.  Getting Started With dbx

2.  Starting dbx

3.  Customizing dbx

4.  Viewing and Navigating To Code

5.  Controlling Program Execution

6.  Setting Breakpoints and Traces

7.  Using the Call Stack

8.  Evaluating and Displaying Data

9.  Using Runtime Checking

10.  Fixing and Continuing

11.  Debugging Multithreaded Applications

12.  Debugging Child Processes

13.  Debugging OpenMP Programs

14.  Working With Signals

15.  Debugging C++ With dbx

16.  Debugging Fortran Using dbx

17.  Debugging a Java Application With dbx

Using dbx With Java Code

Capabilities of dbx With Java Code

Limitations of dbx With Java Code

Environment Variables for Java Debugging

Starting to Debug a Java Application

Debugging a Class File

Debugging a JAR File

Debugging a Java Application That Has a Wrapper

Attaching dbx to a Running Java Application

Debugging a C Application or C++ Application That Embeds a Java Application

Passing Arguments to the JVM Software

Specifying the Location of Your Java Source Files

Specifying the Location of Your C Source Files or C++ Source Files

Specifying a Path for Class Files That Use Custom Class Loaders

Setting Breakpoints on Java Methods

Setting Breakpoints in Native (JNI) Code

Customizing Startup of the JVM Software

Specifying a Path Name for the JVM Software

Passing Run Arguments to the JVM Software

Specifying a Custom Wrapper for Your Java Application

Using a Custom Wrapper That Accepts Command-Line Options

Using a Custom Wrapper That Does Not Accept Command-Line Options

Specifying 64-bit JVM Software

dbx Modes for Debugging Java Code

Switching from Java or JNI Mode to Native Mode

Switching Modes When You Interrupt Execution

Using dbx Commands in Java Mode

The Java Expression Evaluation in dbx Commands

Static and Dynamic Information Used by dbx Commands

Commands With Identical Syntax and Functionality in Java Mode and Native Mode

Commands With Different Syntax in Java Mode

Commands Valid Only in Java Mode

18.  Debugging at the Machine-Instruction Level

19.  Using dbx With the Korn Shell

20.  Debugging Shared Libraries

A.  Modifying a Program State

B.  Event Management

C.  Macros

D.  Command Reference

Index

Using dbx Commands in Java Mode

When you are using dbx to debug a mixture of Java and native code, dbx commands fall into several categories:

Any commands not included in one of these categories work only in native mode.

The Java Expression Evaluation in dbx Commands

The Java expression evaluator used in most dbx commands supports the following constructs:

The Java expression evaluator does not support the following constructs:

A particularly useful way of inspecting the state of your Java application is using the watch facility in the IDE or dbxtool.

Depending on precise value semantics in expressions that do more than just inspect data is not recommended.

Static and Dynamic Information Used by dbx Commands

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.

Commands With Identical Syntax and Functionality in Java Mode and Native Mode

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 and such
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

Commands With Different Syntax in Java Mode

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)
print
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

Commands Valid Only in Java Mode

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