Using SoftBench Debugger

Interacting with Your Program

Interacting with Your Program

Many UNIX programs function quite well when their standard input and output are redirected. These programs are easy to debug using SoftBench Debugger, since SoftBench Debugger redirecting their I/O to the User Program I/O area does not affect them.

Some programs are designed to be invoked from a terminal environment. They may use the terminal for program input and output, perhaps even using cursor-movement commands. (The screen editor vi is an example of this.) When you run a program in the SoftBench Debugger environment, it does not have access to a terminal environment. SoftBench Debugger intercepts the I/O streams to the program. You must interact with your program differently when it is running under SoftBench Debugger.

Finally, X-based programs may or may not use standard I/O, but may conflict with SoftBench Debugger's use of the display.

All these types of programs can be debugged using SoftBench Debugger.

Interacting with a Standard I/O Program

The User Program I/O Area provides access to the UNIX stdin, stdout, and stderr file descriptors. If the program uses standard UNIX I/O, you can see your program's output and provide input in this area. If the program performs input or output using other file descriptors, or if you redirect input or output, it happens at the specified place.

The PC Location shows "Running…" while your program is in control, whether executing or waiting for input. The PC Location stays "Running…" after you have started execution of your program until control passes back to SoftBench Debugger.

If the program requires input, enter it in the User Program I/O Area, just as you would in a terminal window. (Remember, however, that it is not a full terminal emulator.) SoftBench Debugger sends the input line to your program when you press Return. Your program has control while it executes under SoftBench Debugger. When your program encounters a breakpoint, control passes back to SoftBench Debugger, and your program no longer accepts keyboard events. SoftBench Debugger buffers any program input entered when the program is not "Running…" until SoftBench Debugger passes control back to the program.

174

Chapter 7