Sun Studio 12 Update 1: Debugging a Program With dbx

Using the save Command

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.

 

debug

 

debug

 

stop at line

 

stop at line

 

run

 

run

 

next

 

next

 

next

 

next

Saving a complete run 

stop at line

Saving a run minus  

stop at line

 

continue

the last two steps 

continue

 

next

 

next

 

next

 

next

 

step

 

step

 

next

 

next

 

save

 

save -2

       

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