This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] RISC-V: Don't use ps_get_thread_area in libthread_db (bug 23402)
- From: Palmer Dabbelt <palmer at dabbelt dot com>
- To: dj at redhat dot com
- Cc: schwab at suse dot de, libc-alpha at sourceware dot org, Jim Wilson <jimw at sifive dot com>
- Date: Fri, 03 Aug 2018 14:37:55 -0700 (PDT)
- Subject: Re: [PATCH] RISC-V: Don't use ps_get_thread_area in libthread_db (bug 23402)
On Fri, 27 Jul 2018 16:28:06 PDT (-0700), dj@redhat.com wrote:
Andreas Schwab <schwab@suse.de> writes:
Since RISC-V stores the thread pointer in a general register libthread_db
can just ask the debugger for the register contents instead of trying to
call ps_get_thread_area. This enables thread debugging in gdb.
* sysdeps/riscv/nptl/tls.h (DB_THREAD_SELF): Use REGISTER instead
of CONST_THREAD_AREA.
I'm OK with this but... will the definition be the same for riscv32 ?
It looks like this got lost in the shuffle, but as far as I can tell it makes
sense. Is anyone opposed to this, which differs only in the comment?
commit 6a54cad00025f1513068c161e332434b9556293b
gpg: Signature made Fri 03 Aug 2018 02:35:12 PM PDT
gpg: using RSA key 00CE76D1834960DFCE886DF8EF4CA1502CCBAB41
gpg: issuer "palmer@dabbelt.com"
gpg: Good signature from "Palmer Dabbelt <palmer@dabbelt.com>" [ultimate]
gpg: aka "Palmer Dabbelt <palmer@sifive.com>" [ultimate]
Author: Andreas Schwab <schwab@suse.de>
Date: Thu Jul 12 09:24:36 2018 +0200
RISC-V: Don't use ps_get_thread_area in libthread_db (bug 23402)
Since RISC-V stores the thread pointer in a general register libthread_db
can just ask the debugger for the register contents instead of trying to
call ps_get_thread_area. This enables thread debugging in gdb.
* sysdeps/riscv/nptl/tls.h (DB_THREAD_SELF): Use REGISTER instead
of CONST_THREAD_AREA.
diff --git a/sysdeps/riscv/nptl/tls.h b/sysdeps/riscv/nptl/tls.h
index 7745d5904455..a82fd71488c9 100644
--- a/sysdeps/riscv/nptl/tls.h
+++ b/sysdeps/riscv/nptl/tls.h
@@ -99,9 +99,10 @@ typedef struct
# define TLS_DEFINE_INIT_TP(tp, pd) \
void *tp = (void *) (pd) + TLS_TCB_OFFSET + TLS_PRE_TCB_SIZE
-/* Magic for libthread_db to know how to do THREAD_SELF. */
+/* Informats libthread_db that the therad pointer is register 4, which is used
+ * to to know how to do THREAD_SELF. */
# define DB_THREAD_SELF \
- CONST_THREAD_AREA (32, TLS_TCB_OFFSET + TLS_PRE_TCB_SIZE)
+ REGISTER (64, 64, 4 * 8, - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
/* Access to data in the thread descriptor is easy. */
# define THREAD_GETMEM(descr, member) \