• Namhyung Kim's avatar
    perf dwarf-aux: Add die_find_variable_by_reg() helper · 3f5928e4
    Namhyung Kim authored
    The die_find_variable_by_reg() will search for a variable or a parameter
    sub-DIE in the given scope DIE where the location matches to the given
    register.
    
    For the simplest and most common case, memory access usually happens
    with a base register and an offset to the field so the register holds a
    pointer in a variable or function parameter.  Then we can find one if it
    has a location expression at the (instruction) address.  This function
    only handles such a simple case for now.
    
    In this case, the expression has a DW_OP_regN operation where N < 32.
    If the register index (N) is greater than or equal to 32, DW_OP_regx
    operation with an operand which saves the value for the N would be used.
    It rejects expressions with more operations.
    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-8-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    3f5928e4
dwarf-aux.h 5.39 KB