• Arnaldo Carvalho de Melo's avatar
    perf annotate: Support jumping from one function to another · e4cc91b8
    Arnaldo Carvalho de Melo authored
    For instance:
    
      entry_SYSCALL_64  /lib/modules/4.16.0-rc5-00086-gdf09348f/build/vmlinux
        5.50 │     → callq  do_syscall_64
       14.56 │       mov    0x58(%rsp),%rcx
        7.44 │       mov    0x80(%rsp),%r11
        0.32 │       cmp    %rcx,%r11
             │     → jne    swapgs_restore_regs_and_return_to_usermode
        0.32 │       shl    $0x10,%rcx
        0.32 │       sar    $0x10,%rcx
        3.24 │       cmp    %rcx,%r11
             │     → jne    swapgs_restore_regs_and_return_to_usermode
        2.27 │       cmpq   $0x33,0x88(%rsp)
        1.29 │     → jne    swapgs_restore_regs_and_return_to_usermode
             │       mov    0x30(%rsp),%r11
        8.74 │       cmp    %r11,0x90(%rsp)
             │     → jne    swapgs_restore_regs_and_return_to_usermode
        0.32 │       test   $0x10100,%r11
             │     → jne    swapgs_restore_regs_and_return_to_usermode
        0.32 │       cmpq   $0x2b,0xa0(%rsp)
        0.65 │     → jne    swapgs_restore_regs_and_return_to_usermode
    
    It'll behave just like a "call" instruction, i.e. press enter or right
    arrow over one such line and the browser will navigate to the annotated
    disassembly of that function, which when exited, via left arrow or esc,
    will come back to the calling function.
    
    Now to support jump to an offset on a different function...
    Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Jin Yao <yao.jin@linux.intel.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: https://lkml.kernel.org/n/tip-78o508mqvr8inhj63ddtw7mo@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    e4cc91b8
annotate.c 22.5 KB