• Keine Ergebnisse gefunden

Object Inspector windows

Im Dokument . Turbo Debugger " (Seite 170-174)

Figure 11.3 An Object Inspector window

The Object Inspector windows SpeedMenus

While Class Inspector windows provide information about the structure of a class, they say nothing about the data contained in a particular class instance. To view the structure and the values of a specific class instance, use the Object Inspector window.

To open an Object Inspector window, place the cursor on an object name in the Module window, and press Ctrl+l.

Data Member pane Member Function pane Type pane

An Object Inspector window contains three panes. The Data Member pane displays the current values of the object's data members. The Member Function pane shows the current values and code addresses of the object's member functions. The Type pane displays the data type of the highlighted data member or member function.

The Object Inspector window's Data Member and Member Function panes both contain a SpeedMenu. Each menu contains identical commands, except that the Data Member pane contains the additional Change command.

Range •••

Change •••

Methods Yes

Show inherited Yes Inspect

Descend

New express ion •••

Type cast Hierarchy

Chapter 11, Debugging object-oriented programs 161

Range

Change

Methods

Show Inherited

Inspect

Descend

New Expression

Type Cast

The Range command lets you specify a range of array elements to be displayed. If the currently highlighted item is not an array or a pointer, the item cannot be accessed.

The Change command, available only from the Data Member pane, lets you modify the value of the highlighted data member.

The Methods command can be toggled between Yes and No; Yes is the default setting. When set to Yes, Turbo Debugger opens the middle pane of the Object Inspector window, where member functions are summarized.

When Methods is set to No, the middle pane is not displayed. The Methods setting is carried forward to the next opened Object Inspector window.

The Show Inherited command is also a Yes/No toggle. When it's set to Yes,

all data members and all member functions are shown, whether they are defined within the class being inspected or inherited from a base class.

When the command is set to No, orily those data members and member functions defined within the class being inspected are displayed.

The Inspect command (which can be opened from the SpeedMenu or by pressing Enter) opens an Inspector window on the currently highlighted data member or member function. Inspecting a member function opens the Module view, with the cursor positioned on the code that defines the member function.

The Descend command works like the Inspect SpeedMenu command, except that it replaces the current Inspector window with the new item you want to examine. Using this command reduces the number of Inspector windows onscreen; however, you can't return to a previous Inspector window as you could if you use the Inspect command.

Use the New Expression command to inspect a different expression. The data in the current Inspector window is replaced with the data relating to the new expression you enter.

The Type Cast command lets you specify a different data type for the currently highlighted item. This. command is useful if your class, contains a symbol for which there is no type information, as well as for explicitly setting the type of pointers.

Hierarchy

Exceptions

Figure 11.4 The Specify C and C++ Exception Handling dialog box

c++ exception handling

The Hierarchy command opens the Hierarchy window, displaying the heritage of the class being inspected. The Hierarchy window is described on page 157.

The Exceptions command is found on the SpeedMenu of the Module window. If you have implemented C or C++ exception handling in your program, the Exception command becomes active. Choosing this command opens the Specify C and C++ Exception Handling dialog box:

If your program implements C++ exception handling using try, catch, and throw statements, you can specify how you want Turbo Debugger to treat the exceptions your program generates.

Using the C++ Exceptions radio buttons, specify the exception handling in the following ways:

None

Types

Specifies that Turbo Debugger should not interfere with your program's exception handling.

Lets you specify the exception data types you want to trap with Turbo Debugger. Enter the data types of the exceptions you want to trap into the Exception Types input box.

If you want Turbo Debugger to trap exceptions in classes derived from the ones you enter into the Exception Types input box, check the Derived Classes check box.

All Specifies that you want Turbo Debugger to trap all exceptions generated by your program.

Chapter 11 J Debugging object-oriented programs 163

C exception handling

If, for example, you specify that Turbo Debugger should trap char*

exceptions, then Turbo Debugger will pause whenever program execution encounters a throw (char *) statement. Once your program has paused, you can examine the Stack window and other views to determine why the exception occurred.

If your C program implements C exception handling, you can control how Turbo Debugger handles the exceptions that your program generates.

Using the

c:

Exceptions radio buttons, specify the C exception handling in the following ways:

None

Values

All

Specifies that Turbo Debugger should not interfere with your program's exception handling.

Lets you specify the exception values you want to trap with Turbo Debugger. Enter the numbers of the exceptions you want to trap into the Exception values input box.

Specifies that you want Turbo Debugger to trap all exceptions generated by your program.

Im Dokument . Turbo Debugger " (Seite 170-174)