Download Paper - STS
Transcript
5.3 Back End Figure 5.3 provides a description of the general structure of GDL files generated for control flow graphs with IDA. The textual representation of the graph can roughly be distinguished into the following three parts: Graph Attributes: The first part purely consists of graph attributes specifying the layout of the graph visualization and the palette of colors that are to be used in it. IDA adds this part with the same attribute values per default to each produced GDL file. These attribute values are recommended in the aiSee manual for making the graphs look like typical control flow graphs. However, the information contained in this part is irrelevant for the purpose pursued here: In order to compute the control flow blocks visualization it is necessary to know about the basic blocks and the flow of control between them. Nodes: The second part lists the nodes of the control flow graph. Each node has the two mandatory attributes title and label; the latter contains the assembly instructions of the basic block that the node represents in form of a string, while the former is the node’s unique numerical identifier. The nodes of the graph are listed in the GDL file in ascending order of their identifiers. Information on how exactly the numbers are assigned to the nodes is not available. Judging from example GDL files, depth-first search (DFS) seems to be a pretty close guess. The information about whether a node is either an entry point or an exit point in the control flow graph is given with the attribute vertical order. In case the node is an entry point this attribute is assigned the value 0. If the node is an exit point, however, the vertical order is equal to the highest numerical identifier assigned to a node within the control flow graph incremented by one. Optionally, there is an attribute for setting the background color of the node in the graph visualization. Edges: The third part in the GDL file contains the edges. A directed edge is specified by its adjacent nodes. The title of the source node of an edge is assigned to the attribute sourcename, whereas the title of the target node of an edge is assigned to the attribute targetname. In the file, the entries for the edges are sorted by the sourcename attribute in ascending order. In case of an if-else pattern in the control flow graph, the optional label and color attributes come to use: The label is a Boolean value. Each possible Boolean value annotates one of the two edges originating from the basic block, where the condition is evaluated. An edge is traversed if the evaluation of the condition yields a Boolean value matching its label. The edge labeled with true is assigned the color value green, the other edge has the color value red. Control Flow Graph Figure 5.4 is a class diagram illustrating the structure and the main components of the CFG object created from the textual specification of the control flow graph. Knowing about the nodes and the edges of the control flow graph is all 45