1

I tried this example problem:

How to Generate a calling graph for C++ code

Input using C++:

static void D() { }
static void Y() { D(); }
static void X() { Y(); }
static void C() { D(); X(); }
static void B() { C(); }
static void S() { D(); }
static void P() { S(); }
static void O() { P(); }
static void N() { O(); }
static void M() { N(); }
static void G() { M(); }
static void A() { B(); G(); }

int main() {
  A();
}

Terminal Command to receive output:

$ clang++ -Xclang -analyze -Xclang -analyzer-checker=debug.ViewCallGraph main1.cpp

I'm looking for a way to explicitly state the function names/calls in the output.

After trying the solution for the link above (I tried the solution with the 8 answers), I received the following output:

digraph unnamed {

     Node0x7fb2086013b0 [shape=record,label="{\< root \>}"];
     Node0x7fb2086013b0 -> Node0x7fb2086013f0;
     Node0x7fb2086013b0 -> Node0x7fb208601430;
     Node0x7fb2086013b0 -> Node0x7fb208601470;
     Node0x7fb2086013b0 -> Node0x7fb2086014b0;
     Node0x7fb2086013b0 -> Node0x7fb2086014f0;
     Node0x7fb2086013b0 -> Node0x7fb208601530;
     Node0x7fb2086013b0 -> Node0x7fb2086015d0;
     Node0x7fb2086013b0 -> Node0x7fb208601610;
     Node0x7fb2086013b0 -> Node0x7fb208601650;
     Node0x7fb2086013b0 -> Node0x7fb208601690;
     Node0x7fb2086013b0 -> Node0x7fb2086016d0;
     Node0x7fb2086013b0 -> Node0x7fb208601710;
     Node0x7fb2086013b0 -> Node0x7fb208601810;
     Node0x7fb208601470 [shape=record,label="{X}"];
     Node0x7fb208601470 -> Node0x7fb208601430;
     Node0x7fb2086014f0 [shape=record,label="{B}"];
     Node0x7fb2086014f0 -> Node0x7fb2086014b0;
     Node0x7fb208601650 [shape=record,label="{N}"];
     Node0x7fb208601650 -> Node0x7fb208601610;
     Node0x7fb208601430 [shape=record,label="{Y}"];
     Node0x7fb208601430 -> Node0x7fb2086013f0;
     Node0x7fb2086015d0 [shape=record,label="{P}"];
     Node0x7fb2086015d0 -> Node0x7fb208601530;
     Node0x7fb208601710 [shape=record,label="{A}"];
     Node0x7fb208601710 -> Node0x7fb2086014f0;
     Node0x7fb208601710 -> Node0x7fb2086016d0;
     Node0x7fb208601690 [shape=record,label="{M}"];
     Node0x7fb208601690 -> Node0x7fb208601650;
     Node0x7fb2086014b0 [shape=record,label="{C}"];
     Node0x7fb2086014b0 -> Node0x7fb2086013f0;
     Node0x7fb2086014b0 -> Node0x7fb208601470;
     Node0x7fb2086016d0 [shape=record,label="{G}"];
     Node0x7fb2086016d0 -> Node0x7fb208601690;
     Node0x7fb208601530 [shape=record,label="{S}"];
     Node0x7fb208601530 -> Node0x7fb2086013f0;
     Node0x7fb2086013f0 [shape=record,label="{D}"];
     Node0x7fb208601610 [shape=record,label="{O}"];
     Node0x7fb208601610 -> Node0x7fb2086015d0;
     Node0x7fb208601810 [shape=record,label="{main}"];
     Node0x7fb208601810 -> Node0x7fb208601710;
}

I'm looking for the nodes to have specific names and not just "Node".

What's a good way to start parsing nodes and edges for specific names. I'm looking for something like: X->Y->Z etc.

jj1
  • 11
  • 3
  • essentially I want to translate edges into X -> Y -> Z -> A – jj1 Jul 03 '19 at 16:43
  • Your commands don't seem to match with what the answers say to do. – jxh Jul 03 '19 at 21:29
  • *"I'm looking for the nodes to have specific names and not just "Node"."* Well, the output file contains a name for each node. Parsing the output and getting the names doesn't seem too hard. – HolyBlackCat Jul 08 '19 at 23:28
  • This does not seem to be a programming question. If you wish to transform text format of the dot output into different text, you need to write a program that does it. If the program doesn't do what you want, you can ask questions about that. – jxh Jul 08 '19 at 23:55

0 Answers0