# US 2015/0106602 A1 · Randomly branching using hardware watchpoints

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

- Number: US 2015/0106602 A1
- Document ID: US20150106602A1
- Status: Published application
- Kind: A1
- Application number: 14/054,356
- Filed: 2013-10-15
- Published: 2015-04-16
- Earliest claimed: 2013-10-15
- Assignees: Advanced Micro Devices, Inc.
- Applicants: Advanced Micro Devices, Inc.
- Inventors: Joseph L. Greathouse; David S. Christie
- Web page: https://patentgrep.com/patent/US20150106602A1

## CPC

- G06F 11/36: Prevention of errors by analysis, debugging or testing of software
- G06F 11/3065: {Monitoring arrangements determined by the means or processing involved in reporting the monitored data (error or fault reporting or logging G06F11/0766)}
- G06F 11/3072: {where the reporting involves data filtering, e.g. pattern matching, time or event triggered, adaptive or policy-based reporting}
- G06F 11/3093: {Configuration details thereof, e.g. installation, enabling, spatial arrangement of the probes}
- G06F 11/3466: {Performance evaluation by tracing or monitoring}
- G06F 11/3471: {Address tracing}
- G06F 11/3476: {Data logging (G06F11/14, G06F11/2205 take precedence)}
- G06F 11/3495: {for systems}
- G06F 11/3636: {by tracing the execution of the program}
- G06F 2201/81: Threshold
- G06F 2201/865: Monitoring of software
- G06F 2201/88: Monitoring involving counting
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A system and method for efficiently performing program instrumentation. A processor processes instructions stored in a memory. The processor allocates a memory region for the purpose of creating “random branches” in the computer code utilizing existing memory access instructions. When the processor processes a given instruction, the processor both accesses a first location in the memory region and may determine a condition is satisfied. In response, the processor generates an interrupt. The corresponding interrupt handler may transfer control flow from the computer program to instrumentation code. The condition may include a pointer storing an address pointing to locations within the memory region equals a given address after the point is updated. Alternatively, the condition may include an updated data value stored in a location pointed to by the given address equals a threshold value.

## Claims

### Claim 1

A computing system comprising:
a memory configured to store a computer program;
a processor coupled to the memory, wherein the processor is configured to:
process instructions of the stored computer program; and
allocate in the memory a memory region comprising a plurality of locations; and
responsive to determining a predetermined instruction is being processed in a predetermined pipeline stage:
forego processing of instructions following the predetermined instruction and process the instrumentation code, in response to determining both the predetermined instruction accesses a first location of the plurality of locations and a condition is satisfied.

### Claim 2 (depends on 1)

The computing system as recited in claim 1, wherein in further response to determining the predetermined instruction is being processed in the predetermined pipeline stage, the processor is further configured to process an instruction following the predetermined instruction in program order without processing instrumentation code, in response to determining the predetermined instruction does not access any of the plurality of locations.

### Claim 3 (depends on 2)

The computing system as recited in claim 2, wherein in response to processing the instrumentation code, the processor is further configured to collect information about a plurality of instructions in the computer program.

### Claim 4 (depends on 2)

The computing system as recited in claim 2, wherein the processor is further configured to:
generate an interrupt in response to determining both the predetermined instruction accesses the first location and the condition is satisfied; and
transfer control flow from the computer program to the instrumentation code in response to processing instructions of a handler routine corresponding to the interrupt.

### Claim 5 (depends on 4)

The computing system as recited in claim 4, wherein the processor is further configured to:
set a watchpoint address register to a first address pointing to the first location of the plurality of locations in the memory region; and
initialize a pointer to store a second address pointing to a second location of the plurality of locations in the memory region, wherein the pointer is configured to store an address pointing to one of the plurality of locations in the memory region.

### Claim 6 (depends on 4)

The computing system as recited in claim 4, wherein the processor is further configured to:
update the pointer to store a third address pointing to a third location of the plurality of locations in the memory region responsive to executing the predetermined instruction; and
determine the condition is satisfied responsive to determining the first address and the third address are the same.

### Claim 7 (depends on 3)

The computing system as recited in claim 3, wherein the processor is further configured to:
set a watchpoint address register to a first address pointing to the first location of the plurality of locations in the memory region; and
initialize each of a watchpoint data register and the first location to store a threshold data value and a first data value, respectively.

### Claim 8 (depends on 7)

The computing system as recited in claim 7, wherein the processor is further configured to:
update the first location of the plurality of locations to store a second data value responsive to executing the predetermined instruction; and
determine the condition is satisfied responsive to determining the second data value and the threshold data value are the same.

### Claim 9 (depends on 8)

The computing system as recited in claim 8, wherein the processor is further configured to:
initialize a third location of the plurality of locations to store a third data value, wherein the first address points to at least the third location when one or more bits of the first address are masked;
update the third location of the plurality of locations to store a fourth data value responsive to executing the predetermined instruction; and
determine the condition is satisfied responsive to determining the fourth data value and the threshold data value are the same and one or more bits of the first address are masked.

### Claim 10

A method executable by at least one processor in a computing system, the method comprising:
processing instructions of a computer program stored in a memory;
allocating in the memory a memory region comprising a plurality of locations;
responsive to determining a predetermined instruction is being processed in a predetermined pipeline stage:
foregoing processing of instructions following the predetermined instruction and processing the instrumentation code, in response to determining both the predetermined instruction accesses a first location of the plurality of locations and a condition is satisfied.

### Claim 11 (depends on 10)

The method as recited in claim 10, wherein in further response to determining the predetermined instruction is being processed in the predetermined pipeline stage, the method further comprises processing an instruction following the predetermined instruction in program order without processing instrumentation code, in response to determining the predetermined instruction does not access any of the plurality of locations.

### Claim 12 (depends on 11)

The method as recited in claim 11, further comprising:
generating an interrupt in response to determining both the predetermined instruction accesses the first location and the condition is satisfied; and
transferring control flow from the computer program to the instrumentation code in response to processing instructions of a handler routine corresponding to the interrupt.

### Claim 13 (depends on 12)

The method as recited in claim 12, further comprising:
setting a watchpoint address register to a first address pointing to the first location of the plurality of locations in the memory region; and
initializing a pointer to store a second address pointing to a second location of the plurality of locations in the memory region, wherein the pointer is configured to store an address pointing to one of the plurality of locations in the memory region.

### Claim 14 (depends on 12)

The method as recited in claim 12, further comprising:
updating the pointer to store a third address pointing to a third location of the plurality of locations in the memory region responsive to executing the predetermined instruction; and
determining the condition is satisfied responsive to determining the first address and the third address are the same.

### Claim 15 (depends on 11)

The method as recited in claim 11, further comprising:
setting a watchpoint address register to a first address pointing to the first location of the plurality of locations in the memory region; and
initializing each of a watchpoint data register and the first location to store a threshold data value and a first data value, respectively.

### Claim 16 (depends on 15)

The method as recited in claim 15, further comprising:
updating the first location of the plurality of locations to store a second data value responsive to executing the predetermined instruction; and
determining the condition is satisfied responsive to determining the second data value and the threshold data value are the same.

### Claim 17

A non-transitory computer readable storage medium storing program instructions, wherein the program instructions are executable to:
processing instructions of a computer program stored in a memory;
allocating in the memory a memory region comprising a plurality of locations;
responsive to determining a predetermined instruction is being processed in a predetermined pipeline stage:
forego processing of instructions following the predetermined instruction and process the instrumentation code, in response to determining both the predetermined instruction accesses a first location of the plurality of locations and a condition is satisfied.

### Claim 18 (depends on 17)

The non-transitory computer readable storage medium as recited in claim 17, wherein in further response to determining the predetermined instruction is being processed in the predetermined pipeline stage, the program instructions are further executable to process an instruction following the predetermined instruction in program order without processing instrumentation code, in response to determining the predetermined instruction does not access any of the plurality of locations.

### Claim 19 (depends on 18)

The non-transitory computer readable storage medium as recited in claim 18, wherein the program instructions are further executable to:
set a watchpoint address register to a first address pointing to the first location of the plurality of locations in the memory region; and
initialize a pointer to store a second address pointing to a second location of the plurality of locations in the memory region, wherein the pointer is configured to store an address pointing to one of the plurality of locations in the memory region.

### Claim 20 (depends on 18)

The non-transitory computer readable storage medium as recited in claim 18, wherein the program instructions are further executable to:
update the pointer to store a third address pointing to a third location of the plurality of locations in the memory region responsive to executing the predetermined instruction; and
determine the condition is satisfied responsive to determining the first address and the third address are the same.
