# US 2010/0251026 A1 · Debugging program function

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

- Number: US 2010/0251026 A1
- Document ID: US20100251026A1
- Status: Published application
- Kind: A1
- Application number: 12/411,736
- Filed: 2009-03-26
- Published: 2010-09-30
- Earliest claimed: 2009-03-26
- Assignees: International Business Machines Corporation
- Inventors: Prasanna S. Panchamukhi; Vaddagiri Srivatsa
- Web page: https://patentgrep.com/patent/US20100251026A1

## CPC

- G06F 11/362: Debugging of software
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method of debugging a function upon function exit includes pausing program execution at the time of initializing the function, wherein the function initialization includes saving a set of registers on the stack, recording the value of the stack pointer, configuring a watchpoint register based on the recorded value, wherein the watchpoint register is configured to trap memory references of the function based on the recorded value of the stack pointer, and executing the function. Program execution will pause when it is exiting the function because of stack references made by the function epilogue to restore registers saved on the stack and the configured watchpoint registers.

## Claims

### Claim 1

A method for debugging in a computer system a function in an application upon function exit, the method comprising
pausing execution of an application on entering a function, the function being part of the application under execution;
determining a location of a variable stored in a stack, wherein the variable chosen can be read by a central processing unit before the function exits;
inserting a watchpoint on the variable stored in the stack, wherein the watchpoint instructs the central processing unit to pause execution of an application on encountering the variable chosen on the stack; and
resuming normal execution of the application.

### Claim 2 (depends on 1)

The method of claim 1, wherein the variable stored in the stack is a return address.

### Claim 3 (depends on 1)

The method of claim 1, further comprising
inserting a breakpoint on entry of a function in an application, wherein the breakpoint indicates the application to pause execution.

### Claim 4 (depends on 1)

The method of claim 1, wherein the application pauses execution when the CPU accesses the variable on the stack location during function exit.

### Claim 5 (depends on 1)

The method of claim 1, wherein the watchpoint can be implemented using at least one of a hardware support or software implemented.

### Claim 6 (depends on 1)

The method of claim 1, wherein a user is configured to define a handler to be executed when a function returns.

### Claim 7 (depends on 6)

The method of claim 6, further comprising
registering the handlers; and
executing the registered handlers.

### Claim 8 (depends on 7)

The method of claim 7, further comprises
removing the watchpoint; and
continuing execution of the application.

### Claim 9

A method of debugging a function in an application upon function exit, comprising:
pausing execution of the application on entering a function;
determining location of a variable in a stack, wherein the variable chosen can be read by the central processing unit before the function exits;
inserting a watchpoint on the variable stored in the stack, wherein the watchpoint instructs the central processing unit to pause execution of an application on encountering the variable chosen on the stack;
resuming normal execution of the application;
referencing stack at function exit to restore saved variables;
trapping any memory references using the watchpoint register;
pausing execution of the function in response to the trapping; and
transferring control to a debugger application in response to the halting.

### Claim 10

A system comprising:
a function to be debugged; and
a debugger application in operative communication with the function and configured to perform:
pausing execution of an application on entering a function, the function being part of the application under execution;
determining a location of a variable stored in a stack, wherein the variable chosen can be read by the central processing unit before the function exits;
inserting a watchpoint on the variable stored in the stack, wherein the watchpoint instructs the central processing unit to pause execution of an application on encountering the variable chosen on the stack; and
resuming normal execution of the application.

### Claim 11 (depends on 10)

The system of claim 10, wherein the variable stored in the stack is a return address.

### Claim 12 (depends on 10)

The system of claim 10, further comprising
inserting a breakpoint on entry of a function in an application, wherein the breakpoint indicates the application to pause execution.

### Claim 13 (depends on 10)

The system of claim 10, wherein the application pauses execution when the CPU accesses the variable on the stack location during function exit.

### Claim 14 (depends on 10)

The system of claim 10, wherein the watchpoint can be implemented using at least one of a hardware support or software implemented.

### Claim 15 (depends on 10)

The system of claim 10, wherein a user is configured to define a handler to be executed when a function returns.

### Claim 16 (depends on 15)

The system of claim 15, further comprising
registering the handlers; and
executing the registered handlers.

### Claim 17 (depends on 16)

The system of claim 16, further comprises
removing the watchpoint; and
continuing execution of the application.
