GDB: retrieving pthread local values from a core?

Paul Smith paul@mad-scientist.net
Thu Nov 15 20:16:00 GMT 2018


Hi all;

Does anyone have any macros or GDB Python scripting that will allow me
to retrieve the value of a pthread TLS key for the current thread?  I
have the key number returned from pthread_key_create() and I'd like to
do the equivalent of pthread_getspecific(), from a core file.

I've googled around and found a lot of "if you have this or that you
can do it", but I don't really have this or that.  In the code in
question a function failed and stashed a bunch of details about the
failure in a TLS key, then returned up the stack a ways before dumping
core due to a SEGV.  Now I have the core and I'd really like to see
what that error information is, but I can't find a way to get at it...
since all the action around the TLS value was down-stack it's all gone
now (other than the key itself which is in a global variable).

FWIW, I'm using GCC 8.1 on a fairly modern GNU/Linux 64bit system, with
glibc 2.26 and Linux 4.15.

Thanks!



More information about the Gdb mailing list