[LLVMdev] how to dump DSA graph in gdb?

Tianwei tianwei.sheng at gmail.com
Wed Apr 23 08:44:42 PDT 2008


Hi, all:
   Recently I am debugging the DSA and want to learn how it work, and now I
am checking the local datastructure analysis.
I use the following command to print the graph:
(gdb) p g.dump()
digraph DataStructures {
    label="Function addG";

    Node0xe1f3a0 [shape=record,shape=Mrecord,label="{ i32: MRE\n|{<g0>}}"];
    Node0xe1f4d0 [shape=record,shape=Mrecord,label="{ i32*:
SMR\n|{<g0>|<g1>}}"];
    Node0xe1f4d0:g0 -> Node0xe1f3a0;
    Node0xe20900 [shape=record,shape=Mrecord,label="{ i32: GR\n
@global\n|{<g0>}}"];
    Node0xe16530[  label =" %x_addr"];
    Node0xe16530 -> Node0xe1f4d0[arrowtail=tee,color=gray63];
    Node0xe162f0[  label =" %x"];
    Node0xe162f0 -> Node0xe1f3a0[arrowtail=tee,color=gray63];
    Node0xe16950[  label =" %tmp4"];
    Node0xe16950 -> Node0xe1f3a0[arrowtail=tee,color=gray63];
    Node0xe16730[  label =" %tmp"];
    Node0xe16730 -> Node0xe1f3a0[arrowtail=tee,color=gray63];
}

then I had to copy these lines out into a .dot file and use dot to convert
it into a ps file.
I note that it also provide a lot print and dump functions in Printer.cpp,
such as
void DSGraph::writeGraphToFile(std::ostream &O,
                               const std::string &GraphName) const {

but i don't know how to use it, also there are other functions:
// print - Print out the analysis results...
void LocalDataStructures::print(std::ostream &O, const Module *M) const {
  if (DontPrintAnything) return;
  printCollection(*this, O, M, "ds.");
}
..........
how these functions can be used in gdb? furthermore, are there any options
which i can type in command line for DSA?, such as:
opt -load=xxxxxx  -print_the_local_analysis_result  list.bc -o list-opt.bc

also any suggestions for how to debug DSA efficiently?

Thanks.

Tianwei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080423/92422805/attachment.html>


More information about the llvm-dev mailing list