Referencing members when setting watch breakpoints
When you set a watch breakpoint for a variable or expression, it must be in scope and referenced correctly in the Add a Watch Breakpoint dialog box.
This information applies to the Compiled Language Debugger that is shipped as the IBM Debugger for AIX, IBM Debugger for z/TPF, and IBM WebSphere Developer Debugger for zSeries - and in other IBM Application Development Environments.
Resolving the problem
Before you can set a watch breakpoint for a variable or expression, you must be in a context where the expression can be evaluated. One way to ensure that the variable is in scope is to set a breakpoint on the line after the declaration of the variable and then, when you are stopped on that breakpoint, create the watch breakpoint.
After ensuring that the variable is in scope, you can proceed with creating the watch breakpoint in the Add a Watch Breakpoint dialog box. When the Breakpoints view is in the foreground, you can right-click inside of it and select Add Breakpoint from the pop-up menu. This menu item opens to a sub-menu that allows you to choose from a variety of breakpoint types to add. In the sub-menu, select Watch to open the Add a Watch Breakpoint dialog box.
In the dialog box, complete the Address or expression field with the variable name. The variable must also be referenced correctly if it is a member. For example,
- If you are debugging C or C++ and you want to watch member2 which is a member of class/struct var1, enter var1.member2 in the Address or expression field.
- If you are debugging COBOL and you want to watch elementary item variable2 which is belongs to group item groupitem1, enter variable2 of groupitem1 as the expression.
After you complete the Address or expression field correctly, select the number of bytes to watch and then click Finish to set the breakpoint - or click Next if you want the breakpoint to be conditional.
More support for:
Compiled Language Debugger
Software version: Version Independent
Operating system(s): AIX, IBM i, Linux, Windows, z/OS
Reference #: 1181046
Modified date: 03 April 2006
Translate this page: