Motif-Based MAINSAIL Tools Reference Guide, Chapter 4

previous   next   top   contents   index   framed top   this page unframed


4. Data Browsers

A data browser is a self-contained window, displayed by the debugger, that supports browsing of data structures. It is generally far more convenient to peruse data structures with a browser than with the line- or display-oriented debugger commands. Data browsers are one of the main advantages of the GUI debugger as compared to the other interfaces.

Data browsers are often created automatically when a breakpoint is reached in a debuggable program, or can created explicitly with the Show->Data Browser menu item; see Section 6.7.6.

A browser can display individual variable values, whole dynamic objects, stacks, and individual stack frames. A data browser also can also set watch conditions that are evaluated periodically during execution and can cause your program to break when the condition is met; see Section 4.3.

Figure 4–1. Data Browser Window

The data browser window contains a display area in which it displays the current object; initially, only one object at a time is visible in a data browser. However, you can create multiple panes within the same data browser window, each pane showing a different object. You can also create multiple data browsers; a new one is created each time you choose Show->Data browser.

The browser's display area can be scrolled horizontally and vertically so that you can view large objects. The display area also gets larger when you increase the size of the data browser window, so that you can see more of a large object at once.

Each displayed object is assigned a number and a title, such as “Record of class C”. All displayed objects are remembered (unless deleted) and can be redisplayed in various ways. Displayed objects are updated whenever they are redisplayed (including each time the debugger gets control).

Figure 4–2. A Program That Creates Records That Can Be Viewed in a Data Browser

A “POINTER button” is drawn beside each non-Zero POINTER that is a component of a displayed object, e.g., a POINTER record field. You can click on a POINTER button to display the entity pointed to; the newly displayed object becomes the currently displayed object. This allows you to traverse a data structure quickly. A POINTER button is also displayed beside each non-Zero ADDRESS or CHARADR value; clicking on the button displays raw memory starting at the specified location.

Clicking on a POINTER button next to a PROCEDURE name in the stack object sets the debugger's command context to that invocation of the PROCEDURE.

Figure 4–3. Local Variables of Program in Figure 4–2 Displayed with POINTER Buttons Shown Next to POINTER Variables

Figure 4–4. Record Displayed after Clicking on a POINTER Button in Figure 4–3

In the object that is the list of watched expressions, an additional button (the “watch button”) appears beside each expression (farther to the left than the POINTER button, if the watched expression is a POINTER). By clicking on the watch button for an expression, you bring up a dialog box where you can see the context where the expression is defined, set any break conditions associated with the expression, or remove the expression from the list of watched expressions.

Figure 4–5. Four Watch Buttons and One POINTER Button

4.1. Navigation Controls

A data browser window contains the following navigation controls (the bottom two rows of the three rows of buttons):

Figure 4–6. Browser with Multiple Panes

If the Display Local Variables option of the Show->Options command is set and the current PROCEDURE is compiled debuggable, the local variables for the current PROCEDURE context are shown in a data browser window as object number zero (so it can be quickly found using the first button). When the values are first shown, a new data browser window is created if one does not already exist; otherwise, the most recently created data browser window is used. This data browser window is then used for subsequent local variable displays, with a new local variable display updating the old one.

If the Display Interface and Outer Variables option of the Show->Options command is set, the interface and outer variables for the current debugger MODULE context are shown in a data browser window selected as described above for Display Local Variables.

If both Display Local Variables and Display Interface and Outer Variables are set, the local variable and interface and outer variable displays are shown together in the same data browser window as if they are values of a single object. Both options are set by default.

4.2. Display Object or Display Memory

The dspy obj and dspy mem buttons display an object's contents or arbitrary memory in the current pane of the data browser. Each expects its argument to be a valid POINTER, ADDRESS, or CHARADR expression. The argument is the expression entered in the text widget in the upper right of the browser window.

4.3. Watch Expression Controls

Watch expressions are expressions that can be displayed in a data browser. The expressions need not be POINTER-valued expressions.

When you define a watch expression, it must be legal in the current context (unless you use a bracketed watch expression specifier, as described below). You usually define a watch expression after having set and reached a breakpoint that puts you in the context in which the expression is meaningful.

4.3.1. Break Conditions for Watch Expressions

Break conditions can be associated with each watch expression. The break condition is evaluated periodically, either at PROCEDURE entry or at the execution of each statement, to see whether the break condition is TRUE. These break conditions are different from the conditions associated with a breakpoint, which are evaluated only when control reaches the location of the breakpoint. Watch expression break conditions can be evaluated in any context where the watch expression is valid.

Watch expression break conditions can cause the debugger to break when the expression becomes non-Zero (or TRUE) or Zero (or FALSE). They can also cause a break when the expression's value changes. This is especially useful if a variable or memory location is being set to an incorrect value, but you do not know where the value was set.

4.3.2. Controlling the Data Section or Coroutine in Which an Expression Is Watched

By default, an expression containing a local variable is watched only in the coroutine and data section where you started watching it, and an expression that does not contain local variables only in the data section where you started watching it (if there is a MODULE context but no data section for that MODULE, an expression without local variables is watched for every data section of the MODULE). For example, if you have a local variable named i in the PROCEDURE proc that is the debugger's current command context, and you specify a watch expression as i, you watch i only for the current data section (say, the data section for MYMOD at 'H123450) and current coroutine (say, CO1). If you call proc in a different data section of MYMOD (say, 'H234560), or in a different coroutine (say CO2), the watched value of i is not updated.

You can have control over the data section and coroutine in which an expression is watched by prefixing the expression with a bracketed watch expression specifier of the form:

[{coroutineName:}moduleName{.procedureName}]

where the parts in curly braces are optional. procedureName is required if the expression contains local variables.

For example, to watch the variable i mentioned above in all data sections of MYMOD and in all coroutines, use:

[myMod.proc]i

To watch i in all data sections of MYMOD but only in the coroutine CO2, use:

[co2:myMod.proc]i

(There is currently no way to watch a local variable in a particular data section but in all coroutines.)

To watch an outer variable ov of MYMOD in all data sections for MYMOD, use:

[myMod]ov

4.4. The Watch Controls

The watch controls display information based on the expression entered in the text widget in the upper right of the browser window. For example, to see the value of an INTEGER i, type i in the text area and click on the expr button.

The data browser contains the following controls for watching expressions:

4.4.1. The Watch Expr Window

The Watch Expr window allows break conditions to be associated with a watched expression.

Break conditions can be evaluated at each statement, or at each PROCEDURE entry (the default). All break conditions are evaluated at the same time; i.e., it is not possible to define some break conditions that are evaluated only at PROCEDURE entries and others that are evaluated at statements.

The Watch Expr window contains the following displays and controls:


previous   next   top   contents   index   framed top   this page unframed

Motif-Based MAINSAIL Tools Reference Guide, Chapter 4