• Jiri Olsa's avatar
    perf tools: Fix module symbol processing · b2fe96a3
    Jiri Olsa authored
    The 'dso->kernel' condition is true also for kernel modules now,
    and there are several places that were omited by the initial change:
    
      - we need to identify modules separately in dso__process_kernel_symbol
      - we need to set 'dso->kernel' for module from buildid table
      - there's no need to use 'dso->kernel || kmodule' in one condition
    
    Committer testing:
    
    Before:
    
      # perf test -v object
      <SNIP>
      Objdump command is: objdump -z -d --start-address=0xffffffff813e682f --stop-address=0xffffffff813e68af /usr/lib/debug/lib/modules/5.7.14-200.fc32.x86_64/vmlinux
      Bytes read match those read by objdump
      Reading object code for memory address: 0xffffffffc02dc257
      File is: /lib/modules/5.7.14-200.fc32.x86_64/kernel/arch/x86/crypto/crc32c-intel.ko.xz
      On file address is: 0xffffffffc02dc2e7
      dso__data_read_offset failed
      test child finished with -1
      ---- end ----
      Object code reading: FAILED!
      #
    
    After:
    
      # perf test object
      26: Object code reading                                   : Ok
      # perf test object
      26: Object code reading                                   : Ok
      # perf test object
      26: Object code reading                                   : Ok
      # perf test object
      26: Object code reading                                   : Ok
      # perf test object
      26: Object code reading                                   : Ok
      #
    
    Fixes: 02213cec ("perf maps: Mark module DSOs with kernel type")
    Reported-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
    b2fe96a3
symbol-elf.c 52 KB