RE: [PING] [RFC-v3] Add windows Thread Information Block

Pierre Muller
2010-03-11T08:01:47Z

Hi Pedro,

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : Thursday, March 11, 2010 1:24 AM
> À : gdb-patches@sourceware.org
> Cc : Pierre Muller
> Objet : Re: [PING] [RFC-v3] Add windows Thread Information Block
>
> On Wednesday 10 March 2010 17:14:19, Pierre Muller wrote:
> > +typedef struct thread_information_block_32
> > + {
> > + uint32_t current_seh; /* %fs:0x0000 */
> > + uint32_t current_top_of_stack; /* %fs:0x0004 */
> > + uint32_t current_bottom_of_stack; /* %fs:0x0008 */
> > + uint32_t sub_system_tib; /* %fs:0x000c */
> > + uint32_t fiber_data; /* %fs:0x0010 */
> > + uint32_t arbitrary_data_slot; /* %fs:0x0014 */
> > + uint32_t linear_address_tib; /* %fs:0x0018 */
> > + uint32_t environment_pointer; /* %fs:0x001c */
> > + uint32_t process_id; /* %fs:0x0020 */
> > + uint32_t current_thread_id; /* %fs:0x0024
> */
> > + uint32_t thread_local_storage; /* %fs:0x0028 */
> > + uint32_t active_rpc_handle; /* %fs:0x002c
> */
> > + uint32_t process_environment_block; /* %fs:0x0030
> */
> > + uint32_t last_error_number; /* %fs:0x0034
> */
> > + }
> > +thread_information_32;
>
> Where did you get these offsets from?
> According to
> <http://en.wikipedia.org/wiki/Win32_Thread_Information_Block>,
> thread_local_storage should be 0x2c, and active_rpc_handle 0x28, as in,
> someone has it swapped.

Strange because, IIRC, this is the source where I got the offsets too...

> I think I actually tested that wikipedia had
> it
> right last time I asked you this, but in any case, can you confirm?

I checked it on gdb itself, but both fields are zeroed.
Now I remember having read somewhere that
for newer Windows OS, the Thread Local Storage block is inside the
Thread Information block itself:
see same Wikipedia page:
address : FS[0xE10] length : 256 description : TLS slots, 4 bytes per slot
so I will need to check on an older Win9X virtual machine
before I can answer this question.

Pierre