HPlogo HP WDB-GUI Reference Manual: HP-UX 11i v2 > Chapter 3 Debugging with WDB GUI

Using Breakpoints

» 

Technical documentation

Complete book in PDF

 » Table of Contents

You can set breakpoints that pause program execution prior to the breakpoint location. In this way, you can evaluate variables, set breakpoints, view the call stack, or perform other debug actions at specific locations during the debug process.

In addition, you can specify the following:

  • The commands that you want to execute when a breakpoint is reached

  • The conditions when the breakpoint is active

  • The number of times a breakpoint to be ignored before execution is paused

Table 3-1 Breakpoint dialog box description

Field/Button

Action

Break at text box

Type the location of the breakpoint you want to set. You can enter a line number for the file displayed in the Source view, file and line number in the form file:line, a function name, or an address in the form *address.

Stop at breakpoint only if the following expression is true text box

Type the conditions under which you want the debugger to break at the location in the Break at text box.

Enabled check box

Toggle to enable or disable a selected breakpoint.

Temporary check box

Check this box if you want the breakpoint to be removed when it is reached.

Enter WDB commands to invoke at breakpoint text box

Type a WDB command into the text box. This command will be executed each time the selected breakpoint is reached. Type one command per line.

Number of breakpoint hits to ignore before stopping text box

Type the number of times you want to skip the selected breakpoint. This means that during execution, the WDB GUI will ignore the breakpoint “n” times and then pause at the breakpoint before executing “n+1.”

Breakpoints list

Displays all breakpoints that you have set. You can select a breakpoint that you want to perform an action upon.

OK button

Click to submit the information in this dialog box.

Cancel button

Click to exit this dialog box without submitting any of the information that is entered.

Goto Code button

Click to go to the location in the code where the selected breakpoint is set.

Remove All button

Click to remove all breakpoints.

Remove button

Click to remove the selected breakpoint.

 

NOTE: The breakpoints you add, delete, or modify in this dialog box are not actually changed until you click OK.

Tip

You can insert a breakpoint using the Breakpoints dialog box. You can also insert a breakpoint at the current cursor location in the Source or Disassembly view by doing one of the following:

  • Right-click in either the Source or Disassembly view, and on the pop-up menu, click Insert Breakpoint.

  • Or, click the toolbar button.

Inserting breakpoints

To insert a breakpoint

  1. On the left side of the text in the Source or Disassembly view, place your cursor at the line where you want to insert a breakpoint.

  2. Click M1. A breakpoint marker (a solid red octagon) appears in the left margin of the view, indicating that the breakpoint is set.

Or

  1. In the text column of the Source or Disassembly view, place your cursor where you want to insert a breakpoint.

  2. Right-click and click Insert Breakpoint. A breakpoint marker (a solid red octagon) appears in the left margin of the view, indicating that the breakpoint is set.

NOTE: You may set a breakpoint in a file that is part of your executable but is not located in the source paths that you have specified. Add the appropriate source path in the Source File Paths dialog box.

Removing breakpoints

  1. In the Source or Disassembly view, place your cursor on the breakpoint symbol for the breakpoint you want to remove.

  2. Click M1 to remove the breakpoint.

Or

  1. On the Edit menu, click Breakpoints.

  2. From the Breakpoints list in the Breakpoints dialog box, select the breakpoint you want to remove.

  3. Click Remove. The selected breakpoint disappears from the list. To remove all the breakpoints that you have set, click Remove All.

  4. Click OK.

Viewing and modifying breakpoints

The Breakpoints dialog box allows you to view and modify breakpoint attributes. You can also use this dialog box to add and remove breakpoints.

To bring up the Breakpoints dialog box

  1. Place the cursor on a breakpoint symbol.

  2. Click M2. The Breakpoints dialog appears with the breakpoint you clicked on selected.

Or

  1. On the Edit menu, click Breakpoints.

  2. You can use the dialog box to view, modify, add, and remove breakpoints.

  3. Click OK to commit your changes and exit the dialog box.

To view attributes of a breakpoint

Select a breakpoint. The Breakpoints list in the Breakpoints dialog box lists all the breakpoints that are set. Click on a specific breakpoint in the list to view its attributes

To modify attributes of a breakpoint

  1. Select a breakpoint. The Breakpoints list in the Breakpoints dialog box lists all the breakpoints that are set. Click on a specific breakpoint in the list to view its attributes.

  2. You can modify any of the following attributes:

    • To change the breakpoint location, edit the text in the Break at area.

    • WARNING! If you erase the text in the Break at text area, the breakpoint will be removed.
    • If you want to break only under a certain condition, enter that condition in the Stop at breakpoint only if the following condition is true text area.

    • To enable or disable a breakpoint, toggle the Enabled check box to set the breakpoint as enabled or disabled. See Tips for shortcuts for enabling and disabling breakpoints.

    • NOTE:

      Indicates an enabled breakpoint.

      Indicates a disabled breakpoint.

    • To break at a location only once, check the Temporary check box. Once a temporary breakpoint has been reached, it is removed automatically from the list.

    • To execute WDB commands when a breakpoint is reached, enter the commands in the Enter WDB commands to invoke at breakpoint text area. Type each command on a separate line.

    • To skip a breakpoint, enter the number of times you want to skip the breakpoint in the Number of breakpoint hits to ignore before stopping text box.

    • Click OK to commit your changes.

    • NOTE: The breakpoints you add, delete, or modify in this dialog box are not actually changed until you click OK.

Working with deferred breakpoints

You set a deferred breakpoint when you set a breakpoint in a file or location that is part of a shared library but is not part of the current executable. This breakpoint will appear in the Breakpoints dialog list, but it will not actually be set until you load the shared library that contains the file.

Tips

  • To use pop-up menus to insert, remove, enable, and disable breakpoints:

    1. In the Source or Disassembly view, select a breakpoint or place your cursor where you want to insert a breakpoint.

    2. Right-click and click the command you want to invoke. The command will be automatically performed for the selected item without displaying the Breakpoints dialog box.

  • To use the toolbar to insert and remove breakpoints:

    1. Click the toolbar button to Insert or Remove a breakpoint at the current cursor location.

  • You can automatically set breakpoints every time the WDB GUI starts by specifying them in the .gdbinit file. To automatically load breakpoints, add the following line to the .gdbinit file:

    break function_call 

  • You can save the breakpoints you have set by saving the debug session. You can later restore the breakpoints you have saved by restoring the debug session.

© 2004-2005 Hewlett-Packard Development Company, L.P.