]> git.ipfire.org Git - thirdparty/linux.git/commit
perf dwarf-regs: Add get_dwarf_regnum_for_perf_regnum() and use for x86 unwinding
authorIan Rogers <irogers@google.com>
Sat, 17 Jan 2026 05:28:38 +0000 (21:28 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 20 Jan 2026 18:43:56 +0000 (15:43 -0300)
commitd3ab52c31efab9e8a29b8fc1ae4c09ab41e0cf84
tree962a3b3486e07165e463c5c7359d559f1228a48a
parentc31040085914f1188720073baa43d1483693c0a3
perf dwarf-regs: Add get_dwarf_regnum_for_perf_regnum() and use for x86 unwinding

Add a utility to map a perf register number to a DWARF register number
for a particular ELF machine type.

Create a generic unwind-libdw initial register initialization routine
that uses this function and thereby avoids arch specific
initialization. The unwind-libdw code does:

1) compute the maximum DWARF register from the set of sampled user registers,
2) allocates a set of DWARF registers,
3) copies the sample registers into the appropriate DWARF registers.

This generic solution is initially implemented for use with x86 as
only get_dwarf_regnum_for_perf_regnum() support for x86 is currently present.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Aditya Bodkhe <aditya.b1@linux.ibm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Athira Rajeev <atrajeev@linux.ibm.com>
Cc: Chun-Tse Shao <ctshao@google.com>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Dr. David Alan Gilbert <linux@treblig.org>
Cc: Guo Ren <guoren@kernel.org>
Cc: Haibo Xu <haibo1.xu@intel.com>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Krzysztof Ɓopatowski <krzysztof.m.lopatowski@gmail.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Mark Wielaard <mark@klomp.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sergei Trofimovich <slyich@gmail.com>
Cc: Shimin Guo <shimin.guo@skydio.com>
Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
Cc: Thomas Falcon <thomas.falcon@intel.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/dwarf-regs-arch/dwarf-regs-x86.c
tools/perf/util/dwarf-regs.c
tools/perf/util/include/dwarf-regs.h
tools/perf/util/unwind-libdw-arch/Build
tools/perf/util/unwind-libdw-arch/unwind-libdw-x86.c [deleted file]
tools/perf/util/unwind-libdw.c
tools/perf/util/unwind-libdw.h