This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] gdb: xtensa: fix test for privileged register number
- From: Max Filippov <jcmvbkbc at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 27 Mar 2017 20:07:33 -0000
- Subject: [binutils-gdb] gdb: xtensa: fix test for privileged register number
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0d0bf81a6729478563c3851ccfca435222ddfa25
commit 0d0bf81a6729478563c3851ccfca435222ddfa25
Author: Max Filippov <jcmvbkbc@gmail.com>
Date: Tue Feb 21 15:41:31 2017 -0800
gdb: xtensa: fix test for privileged register number
There are no a0-a15 pseudoregisters at the top of the register set in
call0 registers layout. All registers above gdbarch_num_regs (gdbarch)
are privileged. Treat them as such. This fixes the following gdb
assertion seen when 'finish' command is invoked:
regcache.c:649: internal-error: register_status
regcache_raw_read(regcache*, int, gdb_byte*):
Assertion `regnum >= 0 && regnum < regcache->descr->nr_raw_registers'
failed.
gdb/
2017-03-27 Max Filippov <jcmvbkbc@gmail.com>
* xtensa-tdep.c (xtensa_pseudo_register_read): Treat all
registers above gdbarch_num_regs (gdbarch) as privileged in
call0 ABI.
Diff:
---
gdb/ChangeLog | 6 ++++++
gdb/xtensa-tdep.c | 3 ++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2faf489..2cebe10 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2017-03-27 Max Filippov <jcmvbkbc@gmail.com>
+ * xtensa-tdep.c (xtensa_pseudo_register_read): Treat all
+ registers above gdbarch_num_regs (gdbarch) as privileged in
+ call0 ABI.
+
+2017-03-27 Max Filippov <jcmvbkbc@gmail.com>
+
* xtensa-linux-nat.c (fill_gregset): Call regcache_raw_collect
for a single specified register or for all registers in
a0_base..a0_base + C0_NREGS range.
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 0000155..2338ac1 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -578,7 +578,8 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
/* We have to find out how to deal with priveleged registers.
Let's treat them as pseudo-registers, but we cannot read/write them. */
- else if (regnum < gdbarch_tdep (gdbarch)->a0_base)
+ else if (gdbarch_tdep (gdbarch)->call_abi == CallAbiCall0Only
+ || regnum < gdbarch_tdep (gdbarch)->a0_base)
{
buffer[0] = (gdb_byte)0;
buffer[1] = (gdb_byte)0;