• Namhyung Kim's avatar
    perf dwarf-aux: Add die_find_variable_by_addr() · d60469d7
    Namhyung Kim authored
    The die_find_variable_by_addr() is to find a variables in the given DIE
    using given (PC-relative) address.  Global variables will have a
    location expression with DW_OP_addr which has an address so can simply
    compare it with the address.
    
      <1><143a7>: Abbrev Number: 2 (DW_TAG_variable)
          <143a8>   DW_AT_name        : loops_per_jiffy
          <143ac>   DW_AT_type        : <0x1cca>
          <143b0>   DW_AT_external    : 1
          <143b0>   DW_AT_decl_file   : 193
          <143b1>   DW_AT_decl_line   : 213
          <143b2>   DW_AT_location    : 9 byte block: 3 b0 46 41 82 ff ff ff ff
                                         (DW_OP_addr: ffffffff824146b0)
    
    Note that the type-offset should be calculated from the base address of
    the global variable.
    Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: linux-toolchains@vger.kernel.org
    Cc: linux-trace-devel@vger.kernel.org
    Link: https://lore.kernel.org/r/20231110000012.3538610-33-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    d60469d7
dwarf-aux.c 41.2 KB