]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[gdb] Add gdbarch_dwarf2_reg_piece_offset hook
authorTom de Vries <tdevries@suse.de>
Wed, 15 Jan 2025 16:02:00 +0000 (17:02 +0100)
committerTom de Vries <tdevries@suse.de>
Wed, 15 Jan 2025 16:02:00 +0000 (17:02 +0100)
commitb034bb38772a0e1c16153ee7c68b4206421548d0
tree836fa162b902adfb35e17cc4f1675b74f5c64aa7
parentc4606bdbd580237478b6d6b4cdf4927134d31e5a
[gdb] Add gdbarch_dwarf2_reg_piece_offset hook

In rw_pieced_value, when reading/writing part of a register, DW_OP_piece and
DW_OP_bit_piece are handled the same, but the standard tells us:
- DW_OP_piece: if the piece is located in a register, but does not occupy the
  entire register, the placement of the piece within that register is defined
  by the ABI.
- DW_OP_bit_piece: if the location is a register, the offset is from the least
  significant bit end of the register.

Add a new hook gdbarch_dwarf2_reg_piece_offset that allows us to define the
ABI-specific behaviour for DW_OP_piece.

The default implementation of the hook is the behaviour of DW_OP_bit_piece, so
there should not be any functional changes.

Tested on s390x-linux.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/dwarf2/expr.c
gdb/findvar.c
gdb/gdbarch-gen.c
gdb/gdbarch-gen.h
gdb/gdbarch_components.py
gdb/value.h