Debugging a Program With dbx

Command Reference

run

Use the run command by itself to execute the program with the current arguments:


run

To begin executing the program with new arguments:


run args

rerun

To re-execute the program with no arguments:


rerun

next

The next command with no arguments steps one line stepping over calls:


next

To step n lines skipping over calls:


next n

To deliver the given signal while executing the next command:


next ... -sig sig

The dbxenv variable step_events controls whether breakpoints are enabled during a step.

To step the given thread:


next tid

To step the given LWP (lightweight process):


next lwpid

This will not implicitly resume all LWPs when skipping a function. When an explicit tid or lwpid is given, the deadlock avoidance measure of the generic next is defeated.

With multithreaded programs, when a function call is skipped over, all LWPs are implicitly resumed for the duration of that function call in order to avoid deadlock. Non-active threads cannot be stepped.


Note -

For information on lightweight processes (LWPs), see the Solaris Multithreaded Programming Guide.


cont

Use the cont command to continue execution. In a multithreaded process, all threads are resumed.


cont

To continue execution at line lineid is optional.


cont line id

To continue execution with the signal sig:


cont ... -sig sig

To continue execution from a specific thread or LWP:


cont id

To continue execution and follow a forked process:


cont ... -follow parent|child

step

The step command with no arguments steps one line stepping into calls:


step

To step n lines stepping into calls:


step n

To step n lines stepping into calls and out of the current function:


step up n

To deliver the given signal while executing the step command:


step ... -sig sig

The dbxenv variable step_events controls whether breakpoints are enabled during a step.

To step the given thread (step up does not apply):


step ... tid

To step the given LWP:


step ... lwpid

This will not implicitly resume all LWPs when skipping a function. When an explicit tid or lwpid is given, the deadlock avoidance measure of the generic step is defeated.

With multithreaded programs, when a function call is skipped over, all LWPs are implicitly resumed for the duration of that function call in order to avoid deadlock. Non-active threads cannot be stepped.

debug

The debug command prints the name and arguments of the program being debugged.


debug

To begin debugging a program with no process or core:


debug program

To begin debugging a program with corefile core:


debug -c core program
-or-
debug program core

To begin debugging a program with process ID pid:


debug -p pid program
-or-
debug program pid

To force the loading of a corefile; even if it doesn't match:


debug -f ...

To retain all display, trace, when, and stop commands. If no -r option is given, an implicit delete all and undelete() is performed.


debug -r

To start debugging a program even if the program name begins with a dash:


debug [options] -- program

detach

The detach command detaches dbx from the target, and cancels any pending signals:


detach

To detach while forwarding the given signal:


detach -sig sig