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

Re: Getting offset of inital-exec TLS variables on GNU/Linux

On 2019-05-17 10:34 a.m., Florian Weimer wrote:
> * Simon Marchi:
>> On 2019-05-17 6:21 a.m., Florian Weimer wrote:
>>> Is it possible to obtain the offset of initial-exec TLS variable on
>>> GNU/Linux?
>>> It doesn't seem so because GDB executes the DWARF to access the TLS
>>> variable, so the offset is an implementation detail.  Although it is
>>> often visible at the ELF layer.
>>> Thanks,
>>> Florian
>> Can you clarify a little bit?
>> You are looking for the offset the variable from which point of reference:
>> - The start of the TLS area of this module?
>> - The start of the TLS area of the current thread?
> The offset from something related to the thread pointer to the variable,
> for cases where this is constant (specifically, initial-exec TLS
> variables).
>> Also, are you looking for something you can find statically, with just the
>> executable, or are you working in the context of the live process?
> I have a live process, and it would be best if the information matched
> that process (even if it uses different libraries than those currently
> installed in the file system).

Hi Florian,

I am still a bit unsure of what you are looking for concretely.  Are you looking for
a GDB command to print this offset?  Do you need to compute the offset in an external
tool?  what information are you starting with? I think that a bit more context would
help us help you.

GDB uses libthread_db to get the location of TLS variables, which leaves all
implementation details about this to glibc.  And since you are a glibc maintainer, I
am not too sure what I can teach you about this, as you probably know more about this
than I do.


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