perf enable demangling of callgraph

后端 未结 2 1380
旧时难觅i
旧时难觅i 2020-12-28 17:35

How do I enable C++ demangling for the perf callgraph? It seems to demangle symbols when I go into annotate mode, but not in the main callgraph.

Sample code (using G

相关标签:
2条回答
  • 2020-12-28 18:15

    I had the same problem on the Ubuntu 15.10 and I found the solution here: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1396654

    Update: works also for Ubuntu 18.10

    Here are the steps:

    sudo apt-get install libiberty-dev binutils-dev
    mkdir ~/install
    cd ~/install
    # If the following apt-get doesn't work on your system,
    # uncomment deb-src lines in your /etc/apt/sources.list,
    # as suggested by @ctitze
    # or you can download it manually from packages.ubuntu.com
    # as @aleixrocks suggested in the comment below
    apt-get source linux-tools-`uname -r`
    sudo apt-get build-dep linux-tools-`uname -r`
    cd linux-`uname -r | sed 's/-.*//'`/tools/perf
    make
    
    # now you should see the new "perf" executable here
    ./perf
    

    There should be also some way to create a new linux-tools-common package to really integrate it into your system. For now to override the official perf with your new one, just set your PATH:

    export PATH=~/install/linux-`uname -r | sed 's/-.*//'`/tools/perf:$PATH
    
    0 讨论(0)
  • 2020-12-28 18:17

    If you don't understand what to download from packages.ubuntu.com (as in the first answer), then you also can download linux kernel sources from git:

    sudo apt-get install libiberty-dev binutils-dev
    mkdir ~/install
    cd ~/install
    git clone https://github.com/torvalds/linux --depth 1
    cd linux/tools/perf
    make
    
    # now you should see the new "perf" executable here
    ./perf
    

    And modify path (as in the first answer):

    export PATH=~/install/linux/tools/perf:$PATH
    
    0 讨论(0)
提交回复
热议问题