This is the mail archive of the gdb-patches@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]

Re: [PATCH 2/2] gdbserver: xtensa: support THREADPTR register


On 01/18/2017 05:56 PM, Max Filippov wrote:
Provide aceess to the THREADPTR register to remote gdb.

2017-01-18  Max Filippov  <jcmvbkbc@gmail.com>
gdb/gdbserver/


Similarly, drop the gdb/gdbserver/

	* linux-xtensa-low.c (regnum::R_THREADPTR): New enum member.
	(xtensa_fill_gregset): Call collect_register_by_name for
	threadptr register.
	(xtensa_store_gregset): Call supply_register_by_name for
	threadptr register.
---
 gdb/gdbserver/linux-xtensa-low.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gdb/gdbserver/linux-xtensa-low.c b/gdb/gdbserver/linux-xtensa-low.c
index 73fbfe2..eca0289 100644
--- a/gdb/gdbserver/linux-xtensa-low.c
+++ b/gdb/gdbserver/linux-xtensa-low.c
@@ -36,6 +36,7 @@ enum regnum {
 	R_LBEG,	R_LEND,	R_LCOUNT,
 	R_SAR,
 	R_WS, R_WB,
+	R_THREADPTR,
 	R_A0 = 64
 };

Does xtensa have xml register description support? It would be nice to have those described instead of hardcoding the entries like this.


@@ -86,6 +87,10 @@ xtensa_fill_gregset (struct regcache *regcache, void *buf)
       collect_register (regcache, i, ptr);
       ptr += register_size (tdesc, i);
     }
+
+#if XCHAL_HAVE_THREADPTR
+  collect_register_by_name (regcache, "threadptr", (char*)&rset[R_THREADPTR]);

Missing spaces in the cast. "(char *) &rset[R_THREADPTR]"

How is XCHAL_HAVE_THREADPTR set? Is it a reliable way of confirming the presence of this register? Can a runtime check be used instead?

+#endif
 }

 static void
@@ -133,6 +138,10 @@ xtensa_store_gregset (struct regcache *regcache, const void *buf)
   supply_register_by_name (regcache, "ps", (char*)&rset[R_PS]);
   supply_register_by_name (regcache, "windowbase", (char*)&rset[R_WB]);
   supply_register_by_name (regcache, "windowstart", (char*)&rset[R_WS]);
+
+#if XCHAL_HAVE_THREADPTR
+  supply_register_by_name (regcache, "threadptr", (char*)&rset[R_THREADPTR]);

Same as above regarding spaces and the cast construct and the XCHAL_HAVE_THREADPTR check.


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