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

How can I locate a variable in TLS of another process or thread


Apologies up front for a question not specifically about gdb.  Still I
cannot imagine another mailing list as likely to have a participant
familiar with the relevant subject matter.

I have a system that allocates a piece of per thread state as a TLS
variable declared using gcc's __thread extension. I want to write a
utility that, without invoking gdb, will dump that variable for every
thread in every process of my application. I have no trouble iterating
over processes and threads. But how do I locate my TLS variable?

I believe that there are two parts to the problem:

1) Given a process figure out the offset of my variable within TLS. I
assume that this offset will be identical for all threads in that
process. Is that correct?

2) Given a thread locate the base of its TLS segment within its
process address space.

(For what it is worth this is on a fairly recent x86_64 Linux platform.)


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