×

RECONSTRUCTING PROGRAM CONTROL FLOW

  • US 20120159458A1
  • Filed: 12/17/2010
  • Published: 06/21/2012
  • Est. Priority Date: 12/17/2010
  • Status: Active Grant
First Claim
Patent Images

1. At a computer system including one or more processors and system memory, a method for reconstructing control flow for higher level code from the contents of lower level code, the method comprising:

  • an act of accessing a plurality of instructions of lower level code that were translated from corresponding statements and expressions of first higher level code, the first higher level code in a first format, the plurality of instructions of lower level code representing a control flow of the first higher level code, a portion of the control flow defined by one or more branch instructions, the branch instructions selected from among conditional branch instructions and unconditional branch instructions; and

    an act of translating the plurality of instructions of lower level code into a corresponding plurality of statements and expressions of second higher level code that have control flow equivalent to the control flow of the first higher level code, the second higher level code in a second different higher level format, the translation including;

    an act of identifying a plurality of basic blocks within the lower level code based on the arrangement of the one or more branch instructions within the plurality of instructions of lower level code, each basic block including one or more instructions of the lower level code configured to execute as a group;

    an act of defining a block guard variable for each basic block in the plurality of basic blocks;

    for each basic block in the plurality of basic blocks subsequent to defining the block guard variables;

    an act of generating statements and expressions in the second higher level format to represent the functionality expressed in the basic block;

    an act of generating statements and expressions in the second higher level format to represent assignment of values to a plurality of the block guard variables, the plurality of block guard variables including the block guard variable for the basic block and a block guard variable for at least one other basic block, assignments to the plurality of block guard variables for implementing the control flow of the first higher level code, including the portion of the control flow defined by the one or more branch instructions;

    an act of generating statements and expressions in the second higher level format to represent a conditional statement, satisfying the conditional statement dependent on the value assigned to the block guard variable for the basic block; and

    an act of nesting the functionality expressed in the basic block and the assignment of values to the plurality of the block guard variables within the conditional statement;

    an act of generating statements and expressions in the second higher level format representing a while statement, the condition on the while statement set to TRUE; and

    an act of nesting any conditional statements within the while statement.

View all claims
  • 2 Assignments
Timeline View
Assignment View
    ×
    ×