From a12e714b775ce025444af15dcfbd5a420363ad53 Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Fri, 18 Nov 2016 16:08:48 -0800 Subject: [PATCH] gdbserver: xtensa: support THREADPTR register Provide aceess to the THREADPTR register to remote gdb. gdb/gdbserver/ 2017-03-27 Max Filippov * 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/ChangeLog | 8 ++++++++ gdb/gdbserver/linux-xtensa-low.c | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 7b4c4439646..693b5e0ff16 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,11 @@ +2017-03-27 Max Filippov + + * 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. + 2017-03-27 Max Filippov * linux-xtensa-low.c (xtensa_fill_gregset): Call collect_register diff --git a/gdb/gdbserver/linux-xtensa-low.c b/gdb/gdbserver/linux-xtensa-low.c index 80b5d33bfa0..214abdc938b 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 }; @@ -86,6 +87,11 @@ xtensa_fill_gregset (struct regcache *regcache, void *buf) collect_register_by_name (regcache, "ps", (char*)&rset[R_PS]); collect_register_by_name (regcache, "windowbase", (char*)&rset[R_WB]); collect_register_by_name (regcache, "windowstart", (char*)&rset[R_WS]); + +#if XCHAL_HAVE_THREADPTR + collect_register_by_name (regcache, "threadptr", + (char *) &rset[R_THREADPTR]); +#endif } static void @@ -135,6 +141,11 @@ 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]); +#endif } /* Xtensa GNU/Linux PTRACE interface includes extended register set. */ -- 2.30.2