aboutsummaryrefslogtreecommitdiff
path: root/gdb/regcache.h
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2018-10-08 14:47:33 -0700
committerJohn Baldwin <jhb@FreeBSD.org>2018-10-08 14:47:33 -0700
commit498f740792fe0edd2955c5cee6bb864f60a5b173 (patch)
tree56db02e95c7d485ce96880dfb7069ca6803a4e27 /gdb/regcache.h
parent9f6b697b0efd4ba4e2cb21ac17d2b18a23f81abd (diff)
downloadgdb-498f740792fe0edd2955c5cee6bb864f60a5b173.zip
gdb-498f740792fe0edd2955c5cee6bb864f60a5b173.tar.gz
gdb-498f740792fe0edd2955c5cee6bb864f60a5b173.tar.bz2
Add a helper function to trad_frame to support register cache maps.
Currently, signal frame handlers require explicitly coded calls to trad_frame_set_reg_addr() to describe the location of saved registers within a signal frame. This change permits the regcache_map_entry arrays used with regcache::supply_regset and regcache::collect_regset to be used to describe a block of saved registers given an initial address for the register block. Some systems use the same layout for registers in core dump notes, native register sets with ptrace(), and the register contexts saved in signal frames. On these systems, a single register map can now be used to describe the layout of registers in all three places. If a register map entry's size does not match the native size of a register, try to match the semantics used by regcache::transfer_regset. If a register slot is too large, assume that the register's value is stored in the first N bytes and ignore the remaning bytes. If the register slot is smaller than the register, assume the slot holds the low N bytes of the register's value. Read these low N bytes from the target and zero-extend them to generate a register value. While here, document the semantics for both regcache::transfer_regset and trad_frame with respect to register slot's whose size does not match the register's size. gdb/ChangeLog: * regcache.h (struct regcache_map_entry): Note that this type can be used with traditional frame caches. * trad-frame.c (trad_frame_set_reg_regmap): New. * trad-frame.h (trad_frame_set_reg_regmap): New.
Diffstat (limited to 'gdb/regcache.h')
-rw-r--r--gdb/regcache.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/gdb/regcache.h b/gdb/regcache.h
index 4a45f33..374826c 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -72,14 +72,31 @@ extern void regcache_cooked_write_unsigned (struct regcache *regcache,
extern void regcache_write_pc (struct regcache *regcache, CORE_ADDR pc);
/* Mapping between register numbers and offsets in a buffer, for use
- in the '*regset' functions below. In an array of
- 'regcache_map_entry' each element is interpreted like follows:
+ in the '*regset' functions below and with traditional frame caches.
+ In an array of 'regcache_map_entry' each element is interpreted
+ like follows:
- If 'regno' is a register number: Map register 'regno' to the
current offset (starting with 0) and increase the current offset
by 'size' (or the register's size, if 'size' is zero). Repeat
this with consecutive register numbers up to 'regno+count-1'.
+ For each described register, if 'size' is larger than the
+ register's size, the register's value is assumed to be stored in
+ the first N (where N is the register size) bytes at the current
+ offset. The remaining 'size' - N bytes are filled with zeroes by
+ 'regcache_collect_regset' and ignored by other consumers.
+
+ If 'size' is smaller than the register's size, only the first
+ 'size' bytes of a register's value are assumed to be stored at
+ the current offset. 'regcache_collect_regset' copies the first
+ 'size' bytes of a register's value to the output buffer.
+ 'regcache_supply_regset' copies the bytes from the input buffer
+ into the first 'size' bytes of the register's value leaving the
+ remaining bytes of the register's value unchanged. Frame caches
+ read the 'size' bytes from the stack frame and zero extend them
+ to generate the register's value.
+
- If 'regno' is REGCACHE_MAP_SKIP: Add 'count*size' to the current
offset.