burtonator
burtonator

Reputation: 443

Weird characters in perf output...

I'm trying to debug a webkit build with Linux perf that I compiled with symbols.

The output of "perf report -g" has the symbols with half human readable and the other half alphanumeric values.

For example:

_ZN7WebCore12RenderObject18setAnimatableStyleEN3WTF10PassRefPtrINS_11RenderStyleEEE
    |
    |--91.30%-- _ZN7WebCore4Node14setRenderStyleEN3WTF10PassRefPtrINS_11RenderStyleEEE
    |          _ZN7WebCore7Element11recalcStyleENS_4Node11StyleChangeE
    |          _ZN7WebCore7Element11recalcStyleENS_4Node11StyleChangeE
    |          _ZN7WebCore7Element11recalcStyleENS_4Node11StyleChangeE

What's happening here?

What's _ZN7?

My hunch is that this is something to do with C++ and maybe I need to compile with more options to get the symbols to be represented in perf correctly.

ANY pointers here would be appreciated. I can't find anything about this anywhere in the documentation.

Upvotes: 2

Views: 1194

Answers (1)

Joe Z
Joe Z

Reputation: 17936

These are so-called "mangled names": The C++ compiler encodes type information into symbol names, so that the linker can correctly implement overloading, class scoping and namespaces without having to actually understand the C++ type system, and without having to support characters outside of basic alphanumerics and underscores.

You can turn these back into human-readable names with tools such as c++filt under Linux.

For example:

$ echo _ZN7WebCore12RenderObject18setAnimatableStyleEN3WTF10PassRefPtrINS_11RenderStyleEEE | c++filt 
WebCore::RenderObject::setAnimatableStyle(WTF::PassRefPtr<WebCore::RenderStyle>)

Or in your case, perf report -g | c++filt will probably do what you want.

Upvotes: 8

Related Questions