This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] gdb: xtensa-linux: add call0 support


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0ce4291e3ffd90d2b94e02b4557d716c043bf02e

commit 0ce4291e3ffd90d2b94e02b4557d716c043bf02e
Author: Max Filippov <jcmvbkbc@gmail.com>
Date:   Fri Nov 18 09:48:01 2016 -0800

    gdb: xtensa-linux: add call0 support
    
    Correctly handle a0- registers. This allows debugging call0 code in
    linux natively.
    The register structure is the same for windowed and call0 ABIs because
    currently linux kernel internally requires windowed registers, so they are
    always present.
    
    gdb/
    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.
    	(supply_gregset_reg): Call regcache_raw_supply for a single
    	specified register or for all registers in a0_base..a0_base +
    	C0_NREGS range.

Diff:
---
 gdb/ChangeLog          |  9 +++++++++
 gdb/xtensa-linux-nat.c | 28 ++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5687fad..2faf489 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
 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.
+	(supply_gregset_reg): Call regcache_raw_supply for a single
+	specified register or for all registers in a0_base..a0_base +
+	C0_NREGS range.
+
+2017-03-27  Max Filippov  <jcmvbkbc@gmail.com>
+
 	* arch/xtensa.h (C0_NREGS): Add definition.
 	* xtensa-tdep.c (C0_NREGS): Remove definition.
 
diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c
index 69c7eef..a4b001e 100644
--- a/gdb/xtensa-linux-nat.c
+++ b/gdb/xtensa-linux-nat.c
@@ -94,6 +94,20 @@ fill_gregset (const struct regcache *regcache,
 			      gdbarch_tdep (gdbarch)->ar_base + i,
 			      &regs->ar[i]);
     }
+  if (regnum >= gdbarch_tdep (gdbarch)->a0_base
+      && regnum < gdbarch_tdep (gdbarch)->a0_base + C0_NREGS)
+    regcache_raw_collect (regcache, regnum,
+			  &regs->ar[(4 * regs->windowbase + regnum
+				     - gdbarch_tdep (gdbarch)->a0_base)
+			  % gdbarch_tdep (gdbarch)->num_aregs]);
+  else if (regnum == -1)
+    {
+      for (i = 0; i < C0_NREGS; ++i)
+	regcache_raw_collect (regcache,
+			      gdbarch_tdep (gdbarch)->a0_base + i,
+			      &regs->ar[(4 * regs->windowbase + i)
+			      % gdbarch_tdep (gdbarch)->num_aregs]);
+    }
 }
 
 static void
@@ -146,6 +160,20 @@ supply_gregset_reg (struct regcache *regcache,
 			      gdbarch_tdep (gdbarch)->ar_base + i,
 			      &regs->ar[i]);
     }
+  if (regnum >= gdbarch_tdep (gdbarch)->a0_base
+      && regnum < gdbarch_tdep (gdbarch)->a0_base + C0_NREGS)
+    regcache_raw_supply (regcache, regnum,
+			 &regs->ar[(4 * regs->windowbase + regnum
+				    - gdbarch_tdep (gdbarch)->a0_base)
+			 % gdbarch_tdep (gdbarch)->num_aregs]);
+  else if (regnum == -1)
+    {
+      for (i = 0; i < C0_NREGS; ++i)
+	regcache_raw_supply (regcache,
+			     gdbarch_tdep (gdbarch)->a0_base + i,
+			     &regs->ar[(4 * regs->windowbase + i)
+			     % gdbarch_tdep (gdbarch)->num_aregs]);
+    }
 }
 
 void


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]