3 Starting and Ending a Debugging Session: Graphical User Interface

The sections in this chapter are:

3.1 Starting the Debugger from Within CDE

The debugger is integrated with the common UNIX desktop user environment, CDE (Common Desktop Environment). For more information about using CDE, see the CDE User's Guide. This section explains the most common ways to start the debugger from within this environment. Section 3.2 explains optional ways to start the debugger.

To start the debugger and bring your program under debugger control:

  1. From the CDE Front Panel, click on the Application Manager icon (Figure 3-1).

    Figure 3-1 CDE Application Manager Icon

  2. From the CDE Application Manager group window, double click on the Developer's Toolkit icon (Figure 3-2) to open the Developer's Toolkit group.

    You can move icons from the Developer's Toolkit group into another group or to the front of the Control Panel depending on your preference. See the CDE User's Guide for more information.

    Figure 3-2 CDE Developer's Toolkit Icon

  3. From the Developer's Toolkit group, double click on the Ladebug icon (Figure 3-3).

    Figure 3-3 CDE Ladebug Icon

    To access the Ladebug release notes, double click on the README.Ladebug icon.

  4. When you double click on the Ladebug icon, a dialog box appears in which you can enter the name of the executable file you want to debug. You can drag an executable file from the CDE File Manager into the dialog box space for file name.

    Alternatively, you can drag an executable file from the CDE File Manager onto the Ladebug icon in the Developer's Toolkit group to start the debugger using that executable.

    If you do not specify a file to debug, click on OK and the debugger starts up as shown in Figure 3-4. The Main Window remains empty until you bring a program under debugger control (see step 6). Upon startup, the debugger executes any user-defined initialization file.

    Figure 3-4 Debugger Window at Startup

  5. Bring a specified program under debugger control by using the following steps:

    1. Choose File:Run New Program... on the Main Window. The Run New Program dialog box appears, listing the files in your working directory (see Figure 3-5). Figure 3-5 shows the Run New Program dialog box as it appears if the debugger is not invoked from within CDE. If you invoke the debugger from within CDE, this dialog box displays "Enter path or folder name" in place of "Filter", and an additional window section entitled "Folders".

      Figure 3-5 Running a Program by Specifying a Program File

    2. Click on Filter to display the programs available in the subdirectory. In Programs, click on the name of the program file to be debugged. The program field now shows the program file name.

    3. Enter any debugger options in Debugger Options: field. For more information, see the online help about Command Options or the ladebug (1) reference page.

    4. Enter any program arguments in the Program Arguments: field.

    5. Enter the name of the program core dump file in the Core File: field. If such a core file exists in the current directory, you can use the debugger to look at the state of the program when it failed.

    6. Toggle the Set Initial Breakpoint and Run button, if necessary.

      The default position for the Set Initial Breakpoint and Run toggle is on. If the toggle is on, the debugger:

      • Loads the program.

      • Sets the initial breakpoint on the program's main entry point.

      • Issues the run command to execute the program to that breakpoint.

      If the toggle is off:

      • The debugger loads the program. A breakpoint at the program's entry point is not set and execution of the program does not commence.

      • If you linked your program with the ald command or the amake command, both of which are specific to Ada programs, the command line will be initially case insensitive.

      • You must enter a run command or press the Continue button at the prompt to execute the program. This will cause the program to run to completion, if you have not set any breakpoints.

      The off toggle selection is useful for the following tasks:
      Type of Debugger User  Task 
      All debugger users  Examine a core file. 
      Expert debugger users  Set initial breakpoints in the command- line or window interface. 
      Ada debugger users  Debug Ada package elaboration routines. 

    7. Click on OK.

When the program is under debugger control and the Set Initial Breakpoint and Run toggle is on, the debugger:

You can now debug your program, (see Chapter 4).

3.2 Starting the Debugger from a Command-Line Prompt

You can start the debugger by specifying the program to be debugged with the shell command. For example, you can invoke the debugger from a terminal window and debug a program named eightqueens, by entering the following:

% dxladebug eightqueens

To display a separate Debugger I/O Window, specify the -iow option.

The source code is displayed if the module was compiled with -g.

By default, the debugger starts up as shown in Figure 4-1, executing any user-defined initialization file. The debugger inserts a breakpoint on the program's entry point and runs to that point, displaying the program's source code in the main window. The current-location pointer (to the left of the source code) shows the line whose code will be executed next.

You can now debug your program.

For more information about debugger startup, see Section 3.1.

3.3 When Your Program Completes Execution

When your program completes execution normally during a debugging session, the debugger issues the following message:

Process has exited with status...

You then have the following options:

3.4 Rerunning the Same Program from the Current Debugging Session

You can rerun the program currently under debugger control at any time during a debugging session. If you modified the program (created a new binary) during the debugging session, choosing File:Rerun Same Program will bring the new binary under debugger control. The Rerun Same Program dialog box appears (Figure 3-6).

Figure 3-6 Rerunning the Same Program

Enter any arguments to be passed to the program in the Arguments: field. Choose whether to keep or not to keep the user-set breakpoints that you previously set, activated, or deactivated (see Section 4.4). Click on OK. An initial breakpoint will be set unless you previously turned the Set Initial Breakpoint and Run button off in the Run New Program dialog box.

When you rerun a program, it is in the same initial state as when you first brought it under debugger control. Any breakpoints that were set in the program remain set. The source display and current location pointer are updated accordingly.

After you revise the program and create a new version of the program file with a new name, choose File:Run New Program... in the main window to bring the new version under debugger control.

3.5 Running Another Program from the Current Debugging Session

You can bring another program under debugger control at any time during a debugging session, if you started the debugger as explained in Section 3.1. Follow the procedure in that section to bring another program under debugger control.

3.6 Interrupting Program Execution and Aborting Debugger Operations

To interrupt program execution or to abort a debugger operation during a debugging session, click on the Interrupt button on the push-button panel (see Figure 2-4). This is useful if, for example, the program is in an infinite loop.

Clicking on Interrupt does not end the debugging session. Clicking on Interrupt has no effect when the program is not running nor does it have any affect when the debugger is not performing an operation. Click on Continue to resume program execution.

3.7 Ending a Debugging Session

To end a debugging session and terminate the debugger, choose File:Exit Debugger on the main window or enter quit from the command prompt. This returns control to system level.

To run another program from the current debugging session, see Section 3.5.