* [PATCH 0/2] xtensa: support THREADPTR register @ 2017-01-18 23:57 Max Filippov 2017-01-18 23:57 ` [PATCH 1/2] gdb: xtensa-linux: " Max Filippov ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: Max Filippov @ 2017-01-18 23:57 UTC (permalink / raw) To: gdb-patches; +Cc: Maxim Grigoriev, Woody LaRue, Marc Gauthier, Max Filippov Hello, this series makes THREADPTR register (used for TLS in xtensa linux) available to native and remote gdb. Max Filippov (2): gdb: xtensa-linux: support THREADPTR register gdbserver: xtensa: support THREADPTR register gdb/gdbserver/linux-xtensa-low.c | 9 +++++++++ gdb/xtensa-linux-nat.c | 8 ++++++++ gdb/xtensa-tdep.c | 3 +++ gdb/xtensa-tdep.h | 1 + 4 files changed, 21 insertions(+) -- 2.1.4 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] gdb: xtensa-linux: support THREADPTR register 2017-01-18 23:57 [PATCH 0/2] xtensa: support THREADPTR register Max Filippov @ 2017-01-18 23:57 ` Max Filippov 2017-02-13 18:17 ` Luis Machado 2017-01-18 23:57 ` [PATCH 2/2] gdbserver: xtensa: " Max Filippov 2017-01-26 19:12 ` [PATCH 0/2] " Max Filippov 2 siblings, 1 reply; 9+ messages in thread From: Max Filippov @ 2017-01-18 23:57 UTC (permalink / raw) To: gdb-patches; +Cc: Maxim Grigoriev, Woody LaRue, Marc Gauthier, Max Filippov Make THREADPTR user register accessible. 2017-01-18 Max Filippov <jcmvbkbc@gmail.com> gdb/ * xtensa-linux-nat.c (fill_gregset): Call regcache_raw_collect for THREADPTR register. (supply_gregset_reg): Call regcache_raw_supply for THREADPTR register. * xtensa-tdep.c (XTENSA_DBREGN_UREG): New definition. (xtensa_derive_tdep): Initialize tdep->threadptr_regnum. * xtensa-tdep.h (gdbarch_tdep::threadptr_regnum): New field. --- gdb/xtensa-linux-nat.c | 8 ++++++++ gdb/xtensa-tdep.c | 3 +++ gdb/xtensa-tdep.h | 1 + 3 files changed, 12 insertions(+) diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c index 2693939..0f77be7 100644 --- a/gdb/xtensa-linux-nat.c +++ b/gdb/xtensa-linux-nat.c @@ -84,6 +84,10 @@ fill_gregset (const struct regcache *regcache, regcache_raw_collect (regcache, gdbarch_tdep (gdbarch)->sar_regnum, ®s->sar); + if (regnum == gdbarch_tdep (gdbarch)->threadptr_regnum || regnum == -1) + regcache_raw_collect (regcache, + gdbarch_tdep (gdbarch)->threadptr_regnum, + ®s->threadptr); if (regnum >=gdbarch_tdep (gdbarch)->ar_base && regnum < gdbarch_tdep (gdbarch)->ar_base + gdbarch_tdep (gdbarch)->num_aregs) @@ -150,6 +154,10 @@ supply_gregset_reg (struct regcache *regcache, regcache_raw_supply (regcache, gdbarch_tdep (gdbarch)->sar_regnum, ®s->sar); + if (regnum == gdbarch_tdep (gdbarch)->threadptr_regnum || regnum == -1) + regcache_raw_supply (regcache, + gdbarch_tdep (gdbarch)->threadptr_regnum, + ®s->threadptr); if (regnum >=gdbarch_tdep (gdbarch)->ar_base && regnum < gdbarch_tdep (gdbarch)->ar_base + gdbarch_tdep (gdbarch)->num_aregs) diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c index 797e728..2c3e41e 100644 --- a/gdb/xtensa-tdep.c +++ b/gdb/xtensa-tdep.c @@ -3120,6 +3120,7 @@ xtensa_derive_tdep (struct gdbarch_tdep *tdep) /* Special registers 0..255 (core). */ #define XTENSA_DBREGN_SREG(n) (0x0200+(n)) +#define XTENSA_DBREGN_UREG(n) (0x0300+(n)) for (rmap = tdep->regmap, n = 0; rmap->target_number != -1; n++, rmap++) { @@ -3151,6 +3152,8 @@ xtensa_derive_tdep (struct gdbarch_tdep *tdep) tdep->litbase_regnum = n; else if (rmap->target_number == XTENSA_DBREGN_SREG(230)) tdep->ps_regnum = n; + else if (rmap->target_number == XTENSA_DBREGN_UREG(231)) + tdep->threadptr_regnum = n; #if 0 else if (rmap->target_number == XTENSA_DBREGN_SREG(226)) tdep->interrupt_regnum = n; diff --git a/gdb/xtensa-tdep.h b/gdb/xtensa-tdep.h index 46aeecb..986aa68 100644 --- a/gdb/xtensa-tdep.h +++ b/gdb/xtensa-tdep.h @@ -204,6 +204,7 @@ struct gdbarch_tdep int lcount_regnum; int sar_regnum; /* Register number of SAR. */ int litbase_regnum; /* Register number of LITBASE. */ + int threadptr_regnum; /* Register number of THREADPTR. */ int interrupt_regnum; /* Register number for interrupt. */ int interrupt2_regnum; /* Register number for interrupt2. */ -- 2.1.4 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] gdb: xtensa-linux: support THREADPTR register 2017-01-18 23:57 ` [PATCH 1/2] gdb: xtensa-linux: " Max Filippov @ 2017-02-13 18:17 ` Luis Machado 2017-02-14 9:06 ` Max Filippov 0 siblings, 1 reply; 9+ messages in thread From: Luis Machado @ 2017-02-13 18:17 UTC (permalink / raw) To: Max Filippov, gdb-patches; +Cc: Maxim Grigoriev, Woody LaRue, Marc Gauthier On 01/18/2017 05:56 PM, Max Filippov wrote: > Make THREADPTR user register accessible. > > 2017-01-18 Max Filippov <jcmvbkbc@gmail.com> > gdb/ Drop gdb/ from the ChangeLog. > diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c > index 797e728..2c3e41e 100644 > --- a/gdb/xtensa-tdep.c > +++ b/gdb/xtensa-tdep.c > @@ -3120,6 +3120,7 @@ xtensa_derive_tdep (struct gdbarch_tdep *tdep) > > /* Special registers 0..255 (core). */ > #define XTENSA_DBREGN_SREG(n) (0x0200+(n)) > +#define XTENSA_DBREGN_UREG(n) (0x0300+(n)) Maybe add a little comment about what UREG is and its use? Otherwise i have no further comments on this particular patch. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] gdb: xtensa-linux: support THREADPTR register 2017-02-13 18:17 ` Luis Machado @ 2017-02-14 9:06 ` Max Filippov 2017-02-14 9:58 ` Luis Machado 0 siblings, 1 reply; 9+ messages in thread From: Max Filippov @ 2017-02-14 9:06 UTC (permalink / raw) To: Luis Machado; +Cc: gdb-patches, Maxim Grigoriev, Woody LaRue, Marc Gauthier On Mon, Feb 13, 2017 at 10:17 AM, Luis Machado <lgustavo@codesourcery.com> wrote: > On 01/18/2017 05:56 PM, Max Filippov wrote: >> >> Make THREADPTR user register accessible. >> >> 2017-01-18 Max Filippov <jcmvbkbc@gmail.com> >> gdb/ > > > Drop gdb/ from the ChangeLog. It's the commit message, not the actual ChangeLog. I see that specifying location of the ChangeLog file where a section of the commit message goes is common practice, is it considered bad? Of course I will not put it to the ChangeLog. >> diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c >> index 797e728..2c3e41e 100644 >> --- a/gdb/xtensa-tdep.c >> +++ b/gdb/xtensa-tdep.c >> @@ -3120,6 +3120,7 @@ xtensa_derive_tdep (struct gdbarch_tdep *tdep) >> >> /* Special registers 0..255 (core). */ >> #define XTENSA_DBREGN_SREG(n) (0x0200+(n)) >> +#define XTENSA_DBREGN_UREG(n) (0x0300+(n)) > > > Maybe add a little comment about what UREG is and its use? Will add. > Otherwise i have no further comments on this particular patch. -- Thanks. -- Max ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] gdb: xtensa-linux: support THREADPTR register 2017-02-14 9:06 ` Max Filippov @ 2017-02-14 9:58 ` Luis Machado 0 siblings, 0 replies; 9+ messages in thread From: Luis Machado @ 2017-02-14 9:58 UTC (permalink / raw) To: Max Filippov; +Cc: gdb-patches, Maxim Grigoriev, Woody LaRue, Marc Gauthier On 02/14/2017 03:06 AM, Max Filippov wrote: > On Mon, Feb 13, 2017 at 10:17 AM, Luis Machado > <lgustavo@codesourcery.com> wrote: >> On 01/18/2017 05:56 PM, Max Filippov wrote: >>> >>> Make THREADPTR user register accessible. >>> >>> 2017-01-18 Max Filippov <jcmvbkbc@gmail.com> >>> gdb/ >> >> >> Drop gdb/ from the ChangeLog. It is fine for the commit log, but we usually put it before the date: gdb/ 2017-01-18 Max Filippov <jcmvbkbc@gmail.com> ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/2] gdbserver: xtensa: support THREADPTR register 2017-01-18 23:57 [PATCH 0/2] xtensa: support THREADPTR register Max Filippov 2017-01-18 23:57 ` [PATCH 1/2] gdb: xtensa-linux: " Max Filippov @ 2017-01-18 23:57 ` Max Filippov 2017-02-13 18:26 ` Luis Machado 2017-01-26 19:12 ` [PATCH 0/2] " Max Filippov 2 siblings, 1 reply; 9+ messages in thread From: Max Filippov @ 2017-01-18 23:57 UTC (permalink / raw) To: gdb-patches; +Cc: Maxim Grigoriev, Woody LaRue, Marc Gauthier, Max Filippov Provide aceess to the THREADPTR register to remote gdb. 2017-01-18 Max Filippov <jcmvbkbc@gmail.com> 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 }; @@ -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]); +#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]); +#endif } /* Xtensa GNU/Linux PTRACE interface includes extended register set. */ -- 2.1.4 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] gdbserver: xtensa: support THREADPTR register 2017-01-18 23:57 ` [PATCH 2/2] gdbserver: xtensa: " Max Filippov @ 2017-02-13 18:26 ` Luis Machado 2017-02-14 9:37 ` Max Filippov 0 siblings, 1 reply; 9+ messages in thread From: Luis Machado @ 2017-02-13 18:26 UTC (permalink / raw) To: Max Filippov, gdb-patches; +Cc: Maxim Grigoriev, Woody LaRue, Marc Gauthier 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. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] gdbserver: xtensa: support THREADPTR register 2017-02-13 18:26 ` Luis Machado @ 2017-02-14 9:37 ` Max Filippov 0 siblings, 0 replies; 9+ messages in thread From: Max Filippov @ 2017-02-14 9:37 UTC (permalink / raw) To: Luis Machado; +Cc: gdb-patches, Maxim Grigoriev, Woody LaRue, Marc Gauthier On Mon, Feb 13, 2017 at 10:26 AM, Luis Machado <lgustavo@codesourcery.com> wrote: > 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? AFAIK no. > 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]" Will add. > How is XCHAL_HAVE_THREADPTR set? It is defined in the core configuration overlay, include/xtensa-config.h This file is generated for each Xtensa core and is copied over to the source tree before building gdb for that specific core. > Is it a reliable way of confirming the presence of this register? This is the primary source of configuration-specific information. > Can a runtime check be used instead? AFAIK this information is not provided anywhere else. >> +#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. Will fix. -- Thanks. -- Max ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/2] xtensa: support THREADPTR register 2017-01-18 23:57 [PATCH 0/2] xtensa: support THREADPTR register Max Filippov 2017-01-18 23:57 ` [PATCH 1/2] gdb: xtensa-linux: " Max Filippov 2017-01-18 23:57 ` [PATCH 2/2] gdbserver: xtensa: " Max Filippov @ 2017-01-26 19:12 ` Max Filippov 2 siblings, 0 replies; 9+ messages in thread From: Max Filippov @ 2017-01-26 19:12 UTC (permalink / raw) To: gdb-patches; +Cc: Maxim Grigoriev, Woody LaRue, Marc Gauthier, Max Filippov ping? On Wed, Jan 18, 2017 at 3:56 PM, Max Filippov <jcmvbkbc@gmail.com> wrote: > Hello, > > this series makes THREADPTR register (used for TLS in xtensa linux) > available to native and remote gdb. > > Max Filippov (2): > gdb: xtensa-linux: support THREADPTR register > gdbserver: xtensa: support THREADPTR register > > gdb/gdbserver/linux-xtensa-low.c | 9 +++++++++ > gdb/xtensa-linux-nat.c | 8 ++++++++ > gdb/xtensa-tdep.c | 3 +++ > gdb/xtensa-tdep.h | 1 + > 4 files changed, 21 insertions(+) > -- Thanks. -- Max ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-02-14 9:58 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-01-18 23:57 [PATCH 0/2] xtensa: support THREADPTR register Max Filippov 2017-01-18 23:57 ` [PATCH 1/2] gdb: xtensa-linux: " Max Filippov 2017-02-13 18:17 ` Luis Machado 2017-02-14 9:06 ` Max Filippov 2017-02-14 9:58 ` Luis Machado 2017-01-18 23:57 ` [PATCH 2/2] gdbserver: xtensa: " Max Filippov 2017-02-13 18:26 ` Luis Machado 2017-02-14 9:37 ` Max Filippov 2017-01-26 19:12 ` [PATCH 0/2] " Max Filippov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).