# US 6,295,613 B1 · Debug watch mechanism and method for debugging a computer program

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 6,295,613 B1
- Document ID: US6295613B1
- Status: Granted
- Kind: B1
- Application number: 09/067,463
- Filed: 1998-04-28
- Granted: 2001-09-25
- Earliest claimed: 1998-04-28
- Assignees: International Business Machines Corporation
- Inventors: Cary Lee Bates; Paul Reuben Day
- Web page: https://patentgrep.com/patent/US6295613B1

## CPC

- G06F 11/3644: {by instrumenting at runtime}
- G06F 11/3636: {by tracing the execution of the program}
- G06F 11/3698: Environments for analysis, debugging or testing of software
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A watch signature for a debug watch mechanism indicates one or more allowable events, which represent allowable accesses to a watched variable. The allowed accesses implicitly include thread information by limiting the allowable operations to a single thread that first performs an allowed operation. Any operations on the watched variable that are caused by a different thread, and any operations that are caused by the same thread other than those specified in the watch signature will create a notification that an unauthorized operation on the watched variable has occurred. The debug watch mechanism of the present invention thus does not notify the user for expected operations on the variable, but provides notification for other events that do not fall within the anticipated behavior of the computer program as specified by the watch signature.

## Claims

### Claim 1

An apparatus comprising:
at least one processor;
a memory coupled to the at least one processor;
a computer program residing in the memory; and
a debug watch mechanism residing in the memory and executed by the at least one processor, the debug watch mechanism operating according to a watch signature that defines at least one allowable operation on at least one program variable in the computer program and providing notification of any operations on the at least one program variable that are not specified in the watch signature.

### Claim 2 (depends on 1)

The apparatus of claim 1 wherein the watch signature defines at least one allowable event, each allowable event comprising an expected operation on a program variable during execution of the computer program.

### Claim 3 (depends on 1)

The apparatus of claim 1 wherein the debug watch mechanism is enabled by specifying the watch signature for a range of instructions, and wherein the debug watch mechanism becomes active when the first instruction in the range is executed.

### Claim 4 (depends on 1)

The apparatus of claim 1 wherein the watch signature defines a plurality of allowable events, each allowable event comprising an expected operation on a program variable during execution of the computer program, and wherein the debug watch mechanism is activated by a first thread performiing a first of the plurality of allowable events and is deactivated by the first thread performing a last of the plurality of allowable events, the debug watch mechanism providing the notification while the debug watch mechanism is activated for:
any operations by the first thread that are not specified in the watch signature; and
any operations made by a second thread on the at least one program variable.

### Claim 5

An apparatus comprising:
a computer program residing in a memory;
a debug watch mechanism residing in the memory;
means for enabling the debug watch mechanism by specifying a watch signature that defines at least one allowable operation on at least one program variable in the computer program;
means for activating the debug watch mechanism when a first instruction is executed;
the debug watch mechanism providing notification of any operations on the at least one program variable that are not specified in the watch signature while the debug watch signature is activated.

### Claim 6 (depends on 5)

The apparatus of claim 5 further comprising a watch signature for the debug watch mechanism, the watch signature defining at least one allowable event, each allowable event comprising an expected operation on a program variable during execution of the computer program.

### Claim 7

A method for debugging a computer program comprising the steps of:
defining a watch signature that defines at least one allowable operation on at least one program variable in the computer program; and
providing notification of any operations on the at least one program variable that are not specified in the watch signature.

### Claim 8 (depends on 7)

The method of claim 7 wherein the watch signature defines at least one allowable event, each allowable event comprising an expected operation on a program variable during execution of the computer program.

### Claim 9 (depends on 7)

The method of claim 7 further comprising the steps of:
enabling a watch in accordance with the watch signature for a range of instructions; and
activating the watch when a thread executes the first instruction in the range.

### Claim 10 (depends on 7)

The method of claim 7 wherein the watch signature defines a plurality of allowable events, each allowable event comprising an expected operation on a program variable during execution of the computer program, the method further comprising the steps of:
activating a watch by a first thread performing a first of the plurality of allowable events;
deactivated the watch by the first thread performing a last of the plurality of allowable events;
providing the notification while the watch is activated for:
any operations by the first thread that are not specified in the watch signature; and
any operations by a second thread on the at least one program variable.

### Claim 11

A method for debugging a computer program that is executed by multiple threads, the method comprising the steps of:
defining a watch signature for at least one program variable in the computer program, the watch signature defining a plurality of allowable events, each allowable event comprising an expected operation on a program variable during execution of the computer program;
enabling a watch in accordance with the watch signature for a range of instructions defined by the plurality of allowable events;
activating the watch when a first thread executes the first instruction in the range;
deactivated the watch by the first thread performing a last of the plurality of allowable events;
providing the notification while the watch is activated for:
any operations by the first thread that are not specified in the watch signature; and
any operations by a second thread on the at least one program variable.

### Claim 12

A program product comprising:
a debug watch mechanism that operates according to a watch signature that defines at least one allowable operation on at least one program variable in a computer program and provides notification of any operations on the at least one program variable that are not specified in the watch signature; and
signal bearing media bearing the debug watch mechanism.

### Claim 13 (depends on 12)

The program product of claim 12 wherein the signal bearing media comprises recordable media.

### Claim 14 (depends on 12)

The program product of claim 12 wherein the signal bearing media comprises transmission media.

### Claim 15 (depends on 12)

The program product of claim 12 wherein the watch signature defines at least one allowable event, each allowable event comprising an expected operation on a program variable during execution of the computer program.

### Claim 16 (depends on 12)

The program product of claim 12 wherein the debug watch mechanism is enabled by specifying the watch signature for a range of instructions, and wherein the debug watch mechanism becomes active when a thread executes the first instruction in the range.

### Claim 17 (depends on 12)

The program product of claim 12 wherein the watch signature defines a plurality of allowable events, each allowable event comprising an expected operation on a program variable during execution of the computer program, and wherein the debug watch mechanism is activated by a first thread performing a first of the plurality of allowable events and is deactivated by the first thread performing a last of the plurality of allowable events, the debug watch mechanism providing the notification while the debug watch mechanism is activated for:
any operations by the first thread that are not specified in the watch signature; and
any operations by a second thread on the at least one program variable.

### Claim 18

A program product comprising:
(A) a debug watch mechanism that operates according to a watch signature for at least one program variable in a computer program and provides notification of any operations on the at least one program variable that are not specified in the watch signature, the watch signature defining a plurality of allowable events, each allowable event comprising an expected operation on a program variable during execution of the computer program, the debug watch mechanism being enabled by specifying the watch signature for a range of instructions, and wherein the debug watch mechanism becomes active when a thread executes the first instruction in the range, wherein the watch signature defines a plurality of allowable events, and wherein the debug watch mechanism is activated by a first thread performing a first of the plurality of allowable events and is deactivated by the first thread performing a last of the plurality of allowable events, the debug watch mechanism providing the notification while the debug watch mechanism is activated for:
(1) any operations by the first thread that are not specified in the watch signature; and
(2) any operations by a second thread on the at least one program variable; and
(B) signal bearing media bearing the debug watch mechanism.

### Claim 19 (depends on 18)

The program product of claim 18 wherein the signal bearing media comprises recordable media.

### Claim 20 (depends on 18)

The program product of claim 18 wherein the signal bearing media comprises transmission media.
