]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libebl: api for perf register handling, start with x86_64
authorSerhei Makarov <serhei@serhei.io>
Fri, 29 Nov 2024 21:30:43 +0000 (16:30 -0500)
committerSerhei Makarov <serhei@serhei.io>
Thu, 5 Dec 2024 21:03:46 +0000 (16:03 -0500)
commite3d48e2c45321cd169f7868fdaf92966828c751d
tree3e1c6fe1ec2893bc1f11b48e4fba772bf9b9d735
parentfad8a0380f8af51f2cacc87d7de8e45d4b5eb84c
libebl: api for perf register handling, start with x86_64

As it happens, Linux perf_events and DWARF can prescribe completely
different layouts for the register file, requiring non-obvious code
for translation. This makes sense to put in libebl if we want
profilers to handle perf sample data with elfutils.

Start with the x86_64 implementation taken from eu-stacktrace. Needs
some additional testing as the code has been generalized to accept
other perf register masks besides the 'preferred' one.

* backends/Makefile.am (x86_64_SRCS): Add x86_64_initreg_sample.c.
* backends/libebl_PERF_FLAGS.h: New file.
* backends/x86_64_initreg_sample.c: New file, implements a generalized
  version of the eu-stacktrace register shuffling for x86_64.
* backends/x86_64_init.c (x86_64_init): Add initialization for
  set_initial_registers_sample, perf_frame_regs_mask.
* libebl/Makefile.am (libebl_a_SOURCES): Add eblinitreg_sample.c.
* libebl/ebl-hooks.h (set_initial_registers_sample): New hook.
* libebl/eblinitreg_sample.c: New file, implements ebl interface to
  set_initial_registers_sample backend hook.
* libebl/libebl.h (ebl_set_initial_registers_sample): New function.
  (ebl_perf_frame_regs_mask): New function.
* libebl/libeblP.h (struct ebl): Add perf_frame_regs_mask field
  giving the preferred register mask.
backends/Makefile.am
backends/libebl_PERF_FLAGS.h [new file with mode: 0644]
backends/x86_64_init.c
backends/x86_64_initreg_sample.c [new file with mode: 0644]
libebl/Makefile.am
libebl/ebl-hooks.h
libebl/eblinitreg_sample.c [new file with mode: 0644]
libebl/libebl.h
libebl/libeblP.h