Using Sun WorkShop

Quick Mode

Quick Mode is a debugging feature that allows you to run your program normally but with debugging ready in the background to take over the process at any point. If your program terminates abnormally, the debugger is there to save the program before it core dumps.

If all you want to do is run your program as quickly as possible, but you might still need to do some debugging, select Quick Mode when you start the debugger. The Debugging window opens, but otherwise your program runs exactly as if you were running it from the shell; the symbols for the program are not loaded.

If the program encounters a condition that would cause it to terminate, the debugger switches to Debug Mode, and the symbols for the program are loaded. This causes a delay, but leaves you with an active program and full debugging functionality.

When you are running your program in Quick Mode, you can switch to Debug mode whenever execution is interrupted--for example, at a breakpoint or when you manually interrupt execution by clicking on the Interrupt button.

Advantages of Quick Mode

Quick Mode offers the following advantages:

When to Use Quick Mode

Use Quick Mode when you:

As you debug your program, you can toggle between Debug Mode and Quick Mode to take advantage of the best features of each.

How to Switch to Quick Mode

You can choose to run your program in Quick Mode or Debug Mode whenever you select a program to run or debug.

You can toggle between Quick Mode and Debug Mode for the current program from the Debug menu in the Sun 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 Options > Debugging Options in the Sun WorkShop main window. Then choose Debugging Performance from the Category list in the Debugging Options window and click Save As Defaults.

Quick Mode Example

Suppose you made a change to a program and are confident that the change works. After rebuilding the program, you choose Quick Mode from the Debug menu, so that the program runs with minimal overhead. As this is the first time you have run or debugged a program since opening Sun WorkShop, there is a slight delay as the Debugging window opens.

You start your program by clicking the Start button or choosing Execute > Start in the Debugging window. It runs normally until it encounters a segmentation fault.

Before the program can terminate and create a core dump, Sun WorkShop switches into Debug Mode and loads the symbols for your program. You now have access to the full debugging functionality of Sun 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. Clicking on 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.