diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2023-12-01 11:27:14 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2023-12-14 16:04:49 +0000 |
commit | c3a03de70fd373c0f8fc4ba5df1c0db29445112c (patch) | |
tree | fcf6af29ebec724411273970601430b588c53f39 | |
parent | 1d2f86b6b74e6caae77951353a4c353ce9816374 (diff) | |
download | gdb-c3a03de70fd373c0f8fc4ba5df1c0db29445112c.zip gdb-c3a03de70fd373c0f8fc4ba5df1c0db29445112c.tar.gz gdb-c3a03de70fd373c0f8fc4ba5df1c0db29445112c.tar.bz2 |
gdb: don't handle i386 k registers as pseudo registers
I think that i386 k registers are raw registers, and therefore shouldn't
be handled in the various functions handling pseudo registers.
What tipped me off is the code in i386_pseudo_register_read_into_value:
else if (i386_k_regnum_p (gdbarch, regnum))
{
regnum -= tdep->k0_regnum;
/* Extract (always little endian). */
status = regcache->raw_read (tdep->k0_regnum + regnum, raw_buf);
We take regnum (the pseudo register number we want to read), subtract
k0_regnum, add k0_regnum, and pass the result to raw_read. So we would
end up calling raw_read with the same regnum as the function received
which is supposedly a pseudo register number.
Other hints are:
- The command `maint print raw-registers` shows the k registers.
- Printing $k0 doesn't cause i386_pseudo_register_read_into_value to be
called.
- There's code in i387-tdep.c to save/restore the k registers.
Remove handling of the k registers from:
- i386_pseudo_register_read_into_value
- i386_pseudo_register_write
- i386_ax_pseudo_register_collect
Change-Id: Ic97956ed59af6099fef6d36a0b61464172694562
Reviewed-by: John Baldwin <jhb@FreeBSD.org>
-rw-r--r-- | gdb/i386-tdep.c | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index e379c17..f425fcb 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -3464,17 +3464,6 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch, memcpy (buf + size, &upper, size); } } - else if (i386_k_regnum_p (gdbarch, regnum)) - { - regnum -= tdep->k0_regnum; - - /* Extract (always little endian). */ - status = regcache->raw_read (tdep->k0_regnum + regnum, raw_buf); - if (status != REG_VALID) - result_value->mark_bytes_unavailable (0, 8); - else - memcpy (buf, raw_buf, 8); - } else if (i386_zmm_regnum_p (gdbarch, regnum)) { regnum -= tdep->zmm0_regnum; @@ -3656,12 +3645,6 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, regcache->raw_write (I387_BND0R_REGNUM (tdep) + regnum, raw_buf); } - else if (i386_k_regnum_p (gdbarch, regnum)) - { - regnum -= tdep->k0_regnum; - - regcache->raw_write (tdep->k0_regnum + regnum, buf); - } else if (i386_zmm_regnum_p (gdbarch, regnum)) { regnum -= tdep->zmm0_regnum; @@ -3758,12 +3741,6 @@ i386_ax_pseudo_register_collect (struct gdbarch *gdbarch, ax_reg_mask (ax, I387_BND0R_REGNUM (tdep) + regnum); return 0; } - else if (i386_k_regnum_p (gdbarch, regnum)) - { - regnum -= tdep->k0_regnum; - ax_reg_mask (ax, tdep->k0_regnum + regnum); - return 0; - } else if (i386_zmm_regnum_p (gdbarch, regnum)) { regnum -= tdep->zmm0_regnum; |