Skip to content
endeav0r edited this page Oct 20, 2012 · 3 revisions

Loader Graphs

Loaders return a graph where each node is a list of struct _ins objects, and edges are of type struct _ins_edge. This is the most common type of graph used by rdis.

The following example code prints out every instruction, in order by address, in a loader graph:

// create the graph from a loader
struct _graph * graph = loader_graph(loader);

// iterate over each element in the graph
struct _graph_it * git;
for (git = graph_iterator(graph); git != NULL; git = git->next) {
    struct _graph_node * node = graph_it_node(git);

    // iterate over each instruction in the node
    struct _list * ins_list = node->data;
    struct _list_it * iit;
    for (iit = list_iterator(ins_list); iit != NULL; iit = iit->next) {

        // print out the instruction
        struct _ins * ins = iit->data;

        printf("%llx  %s\n",
               (unsigned long long) ins->address,
               ins->description);

    }
}

Function Tree

Loader returns a tree where each node is of type struct _index. The index is the address of the function. To get the label of the function, see Label Tree.

Label Tree

Loader returns a map where the key is the address of the label and each node is of type struct _label.

Clone this wiki locally