Debugging A Program |
4 |
![]() |
You can determine where a program crashed, view the values of variables and expressions, set breakpoints in the code, and run and trace a program. In addition, machine-level and other commands are available to help you debug code. You can use standard dbx commands in the Dbx Commands window.
This chapter is organized into the following sections:
Debugging Features
When debugging in WorkShop, you have access to an extensive range of event management, process control, and data inspection features. You can:
The following shows the basic steps to follow when debugging a program. For more detailed information on any of the steps, see the online help for WorkShop.
Quick Mode
Quick Mode is a new debugging feature that allows you to run your program normally but keep debugging ready in the background to take over the process at any point. Think of Quick Mode like a safety net. If you fall--your program terminates abnormally--the Debugger is there to save the program before it core dumps, just like the net. If you decide you want to debug the program you are running, you can interrupt and turn control over to the Debugger. Advantages of Quick Mode
Quick Mode offers the following advantages:
SEGV
s or has some other abnormal termination, WorkShop steps in, leaving you with an active program and full debugging functionality. If you had run the program without Quick Mode, WorkShop would have terminated the program, and you would have to debug a core file using a restricted set of debugging actions.
You can toggle between Quick mode and Debug mode for the current program from the Debug menu in the WorkShop main window or in the Debugging window.
If you want to change your defaults so that future programs automatically start in Quick mode, choose Debugging Options
Your program starts automatically and runs normally until it SEGVs.
Before the program can terminate and create a core dump, WorkShop switches into Debug mode and loads the symbols for your program. You now have access to the full debugging functionality of WorkShop and can debug the program as if you had started debugging in Debug mode. Eventually, after making many changes, fixing them, and continuing, you rebuild your program.
You again select Quick Mode before running the program.
This time, no initial pause is noticeable, but, your program appears to be stuck in an infinite loop. Pressing the Interrupt button stops the program and loads the debugging symbols. You can now view data values, set breakpoints, and do any other needed debugging actions to track down your bug.
Convinced the third time is the charm, you rebuild your program, re-enable Quick mode, and run the program again. Your program runs without a flaw, and you never see the Debugging window at all.