IBM Support

Referencing members when setting watch breakpoints

Troubleshooting


Problem

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.

[{"Product":{"code":"SSDNAS","label":"IBM Debuggers"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Component":"Compiled Language Debugger","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF012","label":"IBM i"},{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"},{"code":"PF035","label":"z\/OS"}],"Version":"Version Independent","Edition":"","Line of Business":{"code":"","label":""}}]

Document Information

Modified date:
08 August 2018

UID

swg21181046