RE: [RFC-v5] Add windows OS Thread Information Block

Pierre Muller
2010-04-01T13:31:19Z

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : Thursday, April 01, 2010 3:21 PM
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [RFC-v5] Add windows OS Thread Information Block
>
> On Thursday 01 April 2010 13:56:50, Pierre Muller wrote:
> > > Does the new packet return the TIB, or the TLB?
> > The thread local base is the address of
> > the Thread Information Block which itself
> > is a block of memory (usually of size 0x1000)
> > containing thread specific information.
>
> Okay, thanks, that makes the terminology clearer.
>
> > > The object is $_tlb now, isn't it?
> > This object is a pointer in debuggee memory
> > to the Thread Information Block.
>
> If the TLB is a pointer to the TIB, then if "ptype $_tlb" shows
> something not a pointer, something isn't right, wouldn't
> you say? Isn't "ptype $_tlb"/"p $_tib" printing the _TIB_
> instead? This is where things are still confusing.

(top-gdb) start
Temporary breakpoint 3 at 0x40107a: file ../../src/gdb/gdb.c, line 28.
Starting program: /usr/local/src/gdbcvs/build-norm/gdb/gdb.exe
[New Thread 5136.0x16b4]
[New Thread 5136.0x2b4]

Temporary breakpoint 3, main (argc=1, argv=0x1d82428)
at ../../src/gdb/gdb.c:28
28 memset (&args, 0, sizeof args);
(top-gdb) p $_tlb
$3 = (tib *) 0x7ffdf000
(top-gdb) ptyp $_tlb
type = struct {
seh *current_seh;
void *current_top_of_stack;
void *current_bottom_of_stack;
void *sub_system_tib;
void *fiber_data;
void *arbitrary_data_slot;
void *linear_address_tib;
void *environment_pointer;
DWORD_PTR process_id;
DWORD_PTR thread_id;
DWORD_PTR active_rpc_handle;
void *thread_local_storage;
peb *process_environment_block;
DWORD_PTR last_error_number;
} *

This seems correct to me.

> > +@item $_tlb
> > +@vindex $_tlb@r{, convenience variable}
> > +The variable @code{$_tlb} is automatically set for Windows OS
> running
> > +applications in native mode or connected to a gdbserver that
> supports
> > +@code{qGetTIBAddr} requests. This variable contains the address of
> the
> > thread
> > +information block.
>
> Does the variable really contain an address?

I hope the output above is enough to convince you,
to get the display of the Thread information Block you need to use
p *$_tlb

Pierre