1

Consider the following example:

struct S {
    void foo() { bar(); }
    void bar() { }
};

int main() {
    S{}.foo();
}

I compiled it using:

g++ -std=c++11 -g -pg main.cpp

Then I run it to get the gmon.out file. Once compiled, I invoked gprof with the following line:

gprof -q -b a.out gmon.out

Thus I found that there were two symbols:

[8] S::bar()      [9] S::foo()

Their names if not demangled (option --no-demangle) are (at least, on my laptop):

[8] _ZN1S3barEv      [9] _ZN1S3fooEv

Now I'd want to exclude a symbol from the call graph and it works fine using the command below:

gprof -q_ZN1S3barEv -b a.out gmon.out

Anyway, it doesn't work using the actual name once demangled, as suggested by the manpage that states about symspec without specifying that they have not to be demangled (it doesn't work neither using S::bar() nor S::bar\(\) and so on).

Is there any way to use the actual not demangled name in order to filter the call graph?

skypjack
  • 49,335
  • 19
  • 95
  • 187

0 Answers0