# US 2021/0279123 A1 · Systems and methods of detecting power bugs

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

- Number: US 2021/0279123 A1
- Document ID: US20210279123A1
- Status: Published application
- Kind: A1
- Application number: 17/074,611
- Filed: 2020-10-19
- Published: 2021-09-09
- Earliest claimed: 2013-06-25
- Assignees: Purdue Research Foundation
- Applicants: Purdue Research Foundation
- Inventors: Yu Charlie Hu; Abhilash Jindal; Samuel Midkiff; Abhinav Pathak
- Web page: https://patentgrep.com/patent/US20210279123A1

## CPC

- G06F 11/0742: {in a data processing system embedded in a mobile device, e.g. mobile phones, handheld devices}
- G06F 1/28: Supervision thereof, e.g. detecting power-supply failure by out of limits supervision
- G06F 1/3296: by lowering the supply or operating voltage
- G06F 8/20: Software design
- G06F 8/433: {Dependency analysis; Data or control flow analysis}
- G06F 11/0751: {Error or fault detection not based on redundancy (power supply failures G06F1/30; network fault management H04L41/06)}
- G06F 11/079: {Root cause analysis, i.e. error or fault diagnosis (in a hardware test environment G06F11/22; in a software test environment G06F11/36)}
- G06F 11/0793: {Remedial or corrective actions (recovery from an exception in an instruction pipeline G06F9/3861; by retry G06F11/1402; for recovering from a failure of a protocol instance or entity H04L69/40)}
- G06F 11/3604: Analysis of software for verifying properties of programs (testing of software G06F11/3668)
- G06F 11/3608: {using formal methods, e.g. model checking, abstract interpretation (theorem proving G06N5/013)}
- G06F 11/3636: {by tracing the execution of the program}
- G06F 11/3698: Environments for analysis, debugging or testing of software
- G06F 11/3466: {Performance evaluation by tracing or monitoring}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Embodiments of the present invention provide a system and methods for detecting power bugs. In one embodiment, a computer-implemented method for analyzing a computer code includes generating a control flow graph for at least a portion of the computer code at a processor. The method further includes identifying power bugs by traversing the control flow graph if the control flow graph exits without performing a function call to deactivate power to any component of a device configured to execute computer executable instructions based on the computer code after performing a function call to activate power.

## Claims

### Claim at position 1

1-19. (canceled)

### Claim 20

A computer-implemented method for analyzing a computer code, the method comprising:
at a processor, generating a control flow graph for at least a portion of the computer code; and
identifying power bugs by detecting if the control flowgraph or a variation of the control flow graph exits without performing a function call to deactivate power to any component of a device configured to execute computer executable instructions based on the computer code after performing a function call to activate power, wherein the step of identifying power bugs comprises applying a forward analysis, a backward analysis, or a combination thereof.

### Claim 21 (depends on 20)

The method of claim 20, further comprising generating an error message if the control flowgraph exits without performing a function call to deactivate power to any component.

### Claim 22 (depends on 21)

The method of claim 21, further comprising storing the error message in a non-transitory memory medium.

### Claim 23 (depends on 20)

The method of claim 20, wherein the computer executable instructions are configured to run on a power constrained device, wherein the function call to activate power comprises a function call to prevent the power constrained device from going to sleep, and wherein the function call to deactivate power comprises a function call to re-allow the power constrained device to go to sleep.

### Claim 24 (depends on 20)

The method of claim 20, further comprising:
receiving the computer code; and
removing the identified power bugs.

### Claim 25 (depends on 24)

The method of claim 24, further comprising:
after removing the identified power bugs, generating the computer executable instructions by compiling the computer code if the computer code exits after performing a function call to deactivate power to any component previously activated; and storing the computer executable instructions in a non-transitory memory medium.

### Claim 26 (depends on 25)

The method of claim 25, further comprising:
providing an application comprising the computer executable instructions to a user device at an online market place.

### Claim 27 (depends on 20)

The method of claim 20, wherein the backward dataflow analysis, comprising:
applying a reaching definitions analysis to identify any mismatch in definitions relating to function calls for activating or deactivating power.

### Claim 28 (depends on 27)

The method of claim 27, wherein the control flow graph is a reverse control flow graph in which edges of the control flow graph are reversed, wherein applying the reaching definitions analysis further comprises:
identifying steps in the reverse control flow graph relating to function calls for activating or deactivating power,
defining a power variable for each step with a function call for deactivation and for each step that is an EXIT,
assigning a first binary value to the power variable for each EXIT and assigning an opposite second binary value to the power variable for each function call for deactivation,
generating a set of definitions of the power variable reaching each function call for activation in the reverse control flow graph, and
identifying a power bug if any definition of the first binary value is identified in the set of definitions of the power variable at any function call for activation.

### Claim 29 (depends on 20)

The method of claim 20, wherein applying the backward analysis comprises applying a live variable analysis, an available expressions analysis, a constant propagation analysis, a depth first search analysis, a breadth first search analysis, or a combination thereof.

### Claim 30 (depends on 20)

The method of claim 20, wherein applying the forward analysis comprises:
applying a breadth first search analysis to the control flow graph.

### Claim 31 (depends on 20)

The method of claim 20, wherein the forward analysis comprises:
applying a constant propagation analysis to identify any mismatch in definitions relating to function calls for activating or deactivating power.

### Claim 32 (depends on 20)

The method of claim 20, wherein the computer code is configured to execute as a single threaded process.

### Claim 33 (depends on 20)

The method of claim 20, wherein generating the control flow graph comprises:
generating individual control flow graph for each event handler in the computer code comprising a plurality of event handlers; and
stitching together the individual control flow graphs.

### Claim 34 (depends on 20)

The method of claim 20, wherein computer code is configured to execute as a multi-threaded application and the control flow graph is configured for the multithreaded application.

### Claim 35 (depends on 34)

The method of claim 34, wherein generating the control flow graph further comprises:
generating individual control flow graph for each thread;
connecting a fork spawning each thread with an ENTRY block of the individual control flow graph for that thread; and
connecting an EXIT block of the individual control flow graph for that thread with a join node or with another ENTRY block of another individual control flow graph of another thread.

### Claim 36 (depends on 20)

The method of claim 20, where the variation of the control flow graph is a program graph that retains path information of the original control flow graph, wherein the reachability from any node that contains a function call for activation to any node that contains a function call for deactivation and to the EXIT node in the original control flow graph is preserved.

### Claim 37

A computing device comprising:
a processor configured to execute a debugging tool, the debugging tool configured to: generate a control flow graph for at least a portion of a computer code, and
identify power bugs by detecting if the control flow graph exits without performing a function call for deactivating power to any component of a device configured to execute computer executable instructions based on the computer code by traversing the control flow graph after performing a function call to activate power,
wherein the step of identify power bugs comprises applying a forward analysis, a backward analysis, or a combination thereof.

### Claim 38 (depends on 37)

The computing device of claim 37, wherein apply the backward analysis comprises:
apply a reaching definitions analysis to identify any mismatch in definitions relating to function calls for activating or deactivating power.

### Claim 39 (depends on 38)

The computing device of claim 38, wherein the control flow graph is a reverse control flow graph in which edges of the control flow graph are reversed, the method further comprising, wherein apply the reaching definitions analysis comprises:
identify steps in the reverse control flow graph relating to function calls for activating or deactivating power,
define a power variable for each step with a function call for deactivation and for each step that is an EXIT,
assign a first binary value to the power variable for each EXIT and assigning an opposite second binary value to the power variable for each function call for deactivation,
generate a set of definitions of the power variable reaching each function call for activation in the reverse control flow graph, and
identify a power bug if any definition of the first binary value is identified in the set of definitions of the power variable at any function call for activation.
