• Masami Hiramatsu's avatar
    perf probe: Fix to get correct modname from elf header · 1f2ed153
    Masami Hiramatsu authored
    Since 'perf probe' supports cross-arch probes, it is possible to analyze
    different arch kernel image which has different bits-per-long.
    
    In that case, it fails to get the module name because it uses the
    MOD_NAME_OFFSET macro based on the host machine bits-per-long, instead
    of the target arch bits-per-long.
    
    This fixes above issue by changing modname-offset based on the target
    archs bit width. This is ok because linux kernel uses LP64 model on
    64bit arch.
    
    E.g. without this (on x86_64, and target module is arm32):
    
      $ perf probe -m build-arm/fs/configfs/configfs.ko -D configfs_lookup
      p:probe/configfs_lookup :configfs_lookup+0
                              ^-Here is an empty module name.
    
    With this fix, you can see correct module name:
    
      $ perf probe -m build-arm/fs/configfs/configfs.ko -D configfs_lookup
      p:probe/configfs_lookup configfs:configfs_lookup+0
    Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: http://lkml.kernel.org/r/148337043836.6752.383495516397005695.stgit@devboxSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    1f2ed153
probe-event.c 77.3 KB