Skip Navigation Links | |
Exit Print View | |
Oracle Solaris Studio 12.3: Debugging a Program With dbx Oracle Solaris Studio 12.3 Information Library |
Debugging a Core File in the Same Operating Environment
If Your Core File Is Truncated
Debugging a Mismatched Core File
Eliminating Shared Library Problems
Mapping the Compile-time Directory to the Debug-time Directory
Setting dbx Environment Variables
Creating Your Own dbx Commands
Compiling a Program for Debugging
Creating a Separate Debug File
Code Compiled Without the -g Option
Shared Libraries Require the -g Option for Full dbx Support
Killing a Program Without Terminating the Session
4. Viewing and Navigating To Code
5. Controlling Program Execution
6. Setting Breakpoints and Traces
8. Evaluating and Displaying Data
11. Debugging Multithreaded Applications
16. Debugging Fortran Using dbx
17. Debugging a Java Application With dbx
18. Debugging at the Machine-Instruction Level
19. Using dbx With the Korn Shell
dbx provides three commands for saving all or part of a debugging run and replaying it later:
The save command saves to a file all debugging commands issued from the last run command, rerun command, or debug command up to the save command. This segment of a debugging session is called a debugging run.
The save command saves more than the list of debugging commands issued. It saves debugging information associated with the state of the program at the start of the run: breakpoints, display lists, and the like. When you restore a saved run, dbx uses the information in the save-file.
You can save part of a debugging run; that is, the whole run minus a specified number of commands from the last one entered.
If you are not sure where you want to end the run you are saving, use the history command to see a list of the debugging commands issued since the beginning of the session.
Note - By default, the save command writes information to a special save-file. If you want to save a debugging run to a file you can restore later, you can specify a file name with the save command. See Saving a Series of Debugging Runs as Checkpoints .
To save an entire debugging run up to the save command, type:
(dbx) save
To save part of a debugging run, use the save number command, where number is the number of commands back from the save command that you do not want saved.
(dbx) save -number
If you save a debugging run without specifying a file name, dbx writes the information to a special save-file. Each time you save, dbx overwrites this save-file. However, by giving the save command a filename argument, you can save a debugging run to a file that you can restore later, even if you have saved other debugging runs since the one saved to filename.
Saving a series of runs gives you a set of checkpoints, each one starting farther back in the session. You can restore any one of these saved runs, continue, then reset dbx to the program location and state saved in an earlier run.
To save a debugging run to a file other than the default save-file:
(dbx) save filename
After saving a run, you can restore the run using the restore command. dbx uses the information in the save-file. When you restore a run, dbx first resets the internal state to what it was at the start of the run, then reissues each of the debugging commands in the saved run.
Note - The source command also reissues a set of commands stored in a file, but it does not reset the state of dbx; it only reissues the list of commands from the current program location.
For exact restoration of a saved debugging run, all the inputs to the run must be exactly the same: arguments to a run-type command, manual inputs, and file inputs.
Note - If you save a segment and then issue a run, rerun, or debug command before you do a restore, restore uses the arguments to the second, post-save run, rerun, or debug command. If those arguments are different, you might not get an exact restoration.
To restore a saved debugging run, type:
(dbx) restore
To restore a debugging run saved to a file other than the default save-file, type:
(dbx) restore filename
The replay command is a combination command, equivalent to issuing a save -1 followed immediately by a restore. The replay command takes a negative number argument, which it passes to the save portion of the command. By default, the value of -number is -1, so the replay command works as an undo command, restoring the last run up until, but not including, the last command issued.
To replay the current debugging run, minus the last debugging command issued, type:
(dbx) replay
To replay the current debugging run and stop the run before a specific command, use the dbx replay command, where number is the number of commands back from the last debugging command.
(dbx) replay -number