This chapter provides an overview of the Ladebug Debugger's features and capabilities. For detailed information on tasks using this tool, choose Help: On Debugger. You can print Help topics using the HyperHelp Viewer.
You locate errors with the Ladebug Debugger by observing and manipulating your program interactively as it executes.
Figure Figure 12-1 shows the Ladebug main window.
Key elements are the major window panes running from the top to the bottom of the window:
Displays the line numbers of your source file and lets you click next to a line number to insert a breakpoint.
Displays your source code.
Provides you with ways to display and manipulate such features as the call stack, processes, and threads. Also provides buttons for stepping through your program.
Displays status information that results from work you do using the Debugger.
The Debugger helps you locate run-time programming or logic errors. You use the debugger with a program that has been compiled and linked successfully but does not run correctly. For example, the program might give incorrect output, go into an infinite loop, or terminate prematurely.
Support for debugging multiprocess applications. Multiple processes can run in the background while the user is at the ladebug prompt. Ladebug allows you to display a list of processes, change the current context, load image and core files, and debug programs that fork a child process and/or execute a program.
Support for debugging multithreaded applications. The Debugger supports the debugging of native threads (for example, Digital UNIX kernel [machine] level threads) and DECthreads.
Support for local and remote kernel debugging. When you have a problem with a process, you can debug the running kernel or examine the values assigned to system parameters.
Support for remote client/server debugging. You can debug porgrams running on remote systems.
Multilanguage support. The Debugger supports C, C++, FORTRAN, Ada, and COBOL.
Support for debugging shared libraries. You can debug shared libraries if the library was compiled and linked withthe option that makes symbolic table information available to the Debugger.
Support for debugging programs with limited symbolic information. The Debugger can debug programs that contain various levels of symbolic debugging information.
Display your program's source code and browse through the code to locate points of interest where you might test for certain conditions.
Set breakpoints to suspend program execution or enter command sequences at such points.
Execute your program, including stepping through one source line or machine instruction at a time and restarting from the beginning of the program.
Display, monitor, and change the values of program variables and data structures and examine their types.
Examine and manipulate the currently active routines on the call stack.
Examine and manipulate your program's multiple processes and threads.
Disassemble and examine machine code; examine and modify machine-register values.
These are the basic debugging techniques. When you find errors in the program, you can edit the source code and compile, link, execute, and test the corrected version. As you use the Debugger, you will discover variations on these techniques.
Ability to set and deactivate breakpoints by clicking the mouse on source lines in the source view.
Optional windows for displaying breakpoints, the current values of monitored variables, local variables, decoded instructions, and register values.
Push buttons for common Debugger operations, such as stepping to the next line and displaying the value of a variable.
Convenient access to your default editor so that you can efficiently modify the source and set breakpoints in the editor window.
Ability to customize the interface to your individual preference (view layout, choice of push buttons and corresponding actions, and so on).
The complete documentation for the Debugger is contained in other manuals, FUSE online Help, and reference pages installed with your system (see Section Section 12.6). The rest of this chapter is mostly confined to information you might need to set up and start your debugging environment on FUSE and a general orientation to the following:
Debugger engines
Debugger user interfaces
Debugger documentation
The basic requirement for using the Debugger is to have access
to the complete symbolic information in your program while debugging.
You must compile its source files with the debug option (-g
on most systems).
See your compiler documentation for complete information
about compiler options.
You can start the Debugger in several ways:
Use the command line.
If you have CDE installed, use the Debugger icon.
Use the FUSE Control Panel once FUSE is running.
Use the Tools menu from most FUSE tools.
You can start the Debugger from the command line using the following command:
% fusedebug [Xt-Options] [filepath]
See Appendix Appendix D and the specific reference pages for the command syntax and options.
If the Control Panel is not running, it starts automatically as a minimized icon. If FUSE is already running, the Debugger is placed in the current tool group.
When you have CDE installed, FUSE provides a FUSE application group icon and icons for the individual tools that make up the FUSE environment.
To invoke the Debugger:
Double click on the Application Manager icon in the CDE Front Panel to display the application group icons.
Double click on the FUSE application group icon to display the icons in the FUSE application group.
Double click on the Debugger icon to start the tool.
To start Debugger from the FUSE Control Panel, select Ladebug Debugger from the Tools menu.
Most FUSE tools have a Tools menu. To start a tool, select the tool from the Tools menu.
When you start the Debugger, the Debugger main window appears, along with the Run New Program dialog box.
To complete the Run New Program dialog box:
Enter the pathname of the executable target to be debugged in the Select a program to run field.
If applicable, enter debugger command-line options, program arguments, and a core file name in the corresponding fields.
Click on OK. This causes the source code of the program to appear in the source pane of the Debugger main window (see Figure Figure 12-1). The User Program I/O window is also displayed to the right of the main window. It separates program I/O from debugger I/O, which is displayed in the communications pane of the main window.
You can now debug your program.
The Debugger consists of a window interface (see Figure Figure 12-1) layered on a command-driven debugger engine that is provided with the operating system. The Ladebug engine determines the exact behavior of the Debugger (language support, response to user input, and so on). The window interface provides the basic debugging and convenience features that you will probably need most of the time.
The Debugger provides a command interface that is accessible from the window interface. You can enter debugger engine commands at a command-entry prompt in the Command Message view of the Debugger main window.
The command interface is useful under the following circumstances:
To do debugging tasks not available through the window interface
As an alternative to using the window interface for certain operations
Because the two interfaces are integrated, in many cases you can use either to achieve the same result. Mouse actions cause the underlying commands to be displayed to help you associate the two.
You can customize the window interface with many of the special features of the command interface by modifying the push buttons and their associated Debugger commands or by adding new push buttons.
The Debugger is a symbolic debugger; thus, you can specify variable names, function names, and so on, precisely as they appear in your source code. In most cases, the Debugger recognizes the syntax, data types, operators, expressions, scoping rules, and other constructs of a supported language.
Ladebug supports C, DEC C++, DEC Ada, and DEC COBOL. Therefore, use only C, C++, DEC Ada, or DEC COBOL mixed-language applications.
For a complete description of the language support and restrictions, see:
The Debugger's documentation (listed in Section Section 12.6)
The compiler documentation
Ladebug Debugger Manual: Window and Command-Line Interface
This manual is part of the Digital UNIX operating system documentation kit, available with the optional Developers' Toolkit for Digital UNIX. It documents both the window and command line-interfaces.
Online Help
Available from FUSE Help menus. Choose On Ladebug from the Debugger Help menu to display a reference page, or enter help at the debugger prompt.
The Help command lists the commands for the Debugger as if it were invoked from the shell. Some of these commands are disabled within the window interface, typically because they are irrelevant to that interface. Conversely, certain other (internal) commands are available from within the window interface, but not when the debugger engine is invoked from the shell. See the Ladebug Debugger Manual: Window and Command-Line Interface or the FUSE online Help for a list of disabled and internal commands.
When you start up the Debugger, you specify an executable target. The Debugger displays the source file for that target.
The Debugger source view is read-only. To edit a source file, you can access the editor either directly from the Debugger or from the Tools menu.
If you want to edit the source file whose code is currently being displayed by the Debugger, the quickest way is to choose Edit File from the Debugger's Commands menu. This invokes your default FUSE editor (FUSE Editor, Emacs, or vi). The editor displays the target's source code in its own window. As in the Debugger main window, the source code in the editor window is positioned where execution is currently paused.
You can also invoke an editor from the Tools menu, but the executable target set for the project (which the editor inherits) must be the same as the target that is being debugged. If this is the case, the editor displays the source code, which is also positioned where execution is currently paused.
When you then execute the program with the Debugger, the breakpoints are updated in both the Debugger and the editor.
If you are using the FUSE Editor or emacs, you can set breakpoints from within the editor:
To set a breakpoint on a source line, click in the annotation area to the left of that line. The editor displays a red stop sign symbol (hexagon) at the breakpoint, and the Debugger window shows that a breakpoint has been set.
To deactivate a breakpoint, click on the hexagon. The Debugger shows that the breakpoint has been deactivated.
Similarly, when you set or deactivate a breakpoint from within the Debugger, the FUSE or emacs editor's annotation area is updated accordingly. No breakpoints set before the editor was invoked are visible in the annotation area.
In addition to the standard FUSE customizations that are available from the FUSE control panel, the Debugger offers several options for customizing your debugging environment:
For information about customizing the window interface, see the Ladebug Debugger Manual: Window and Command-Line Interface.
For information about using a Debugger initialization file or recording and playing back a command script, see the Ladebug Debugger Manual: Window and Command-Line Interface.