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

Pierre Muller
2010-04-01T16:17:42Z

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Eli Zaretskii
> Envoyé : Thursday, April 01, 2010 3:30 PM
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [PING][RFC-v4] Add windows OS Thread Information Block
>
> > From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> > Date: Thu, 1 Apr 2010 11:40:50 +0200
> >
> > I am still waiting for a comment from any global
> > maintainer concerning the non-(windows specific) parts
> > of that patch. Christopher approved the windows part.
>
> Sorry I missed that.
>
> > > + if (target_get_tib_address (ptid, &thread_local_base) == 0)
> > > + {
> > > + printf_filtered ("Unable to get thread local base for
> ThreadId
> > > %s\n",
> > > + pulongest (ptid_get_tid(ptid)));
>
> Please add _() around the user messages.
OK.
> > > + add_prefix_cmd ("w32", class_info, info_w32_command,
> > > + _("Print information specific to Win32 debugging."),
>
> RMS would say "don't call Windows ``a win''".

This is just displaced code from windows-nat.c to windows-tdep.c,
so I am not sure I should touch this.

> > > +If enabled, all non-zero fields of thread information block are
> displayed,\n\
> > > +even if its meaning is unknown."),
>
> "its" is inappropriate here, as "fields" are in plural. I suggest
> "their" instead.

I completely agree with you!

> > > +@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
>
> This is backwards: it makes it sound like we set the variable for
> Windows, not for the application. I suggest the following alternative
> wording:
>
> The variable @code{$_tlb} is automatically set when debugging
> applications running on MS-Windows in native mode or connected to
> gdbserver that supports the @code{qGetTIBAddr} request.
>
> Please also add an @xref to where the qGetTIBAddr packet is
> described.

The node I found is called "General Query Packets", should I refer
to this general section, or add a new node just for qGetTIBAddr?

> > > +@code{qGetTIBAddr} requests. This variable contains the address of
> the
> ^^
> Two spaces between sentences, please.
Disappeared with my @xref addition.
> > > +@tab Display Windows OS Thread Information Block.
>
> "Display MS-Windows Thread Information Block."
OK.
> > > +An error occured. This means that either the thread was not found,
> or
> ^^
> Two spaces.
Done.
> The patch for the manual is okay with the above changes.

Thanks, I attach the modified doc/gdb.texinfo diff

Pierre

$ cvs diff -u doc/gdb.texinfo
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.693
diff -u -r1.693 gdb.texinfo
--- doc/gdb.texinfo 1 Apr 2010 14:11:23 -0000 1.693
+++ doc/gdb.texinfo 1 Apr 2010 16:07:57 -0000
@@ -8055,6 +8055,15 @@
(@pxref{extra signal information}). Note that @code{$_siginfo}
could be empty, if the application has not yet received any signals.
For example, it will be empty before you execute the @code{run} command.
+
+@item $_tlb
+@vindex $_tlb@r{, convenience variable}
+The variable @code{$_tlb} is automatically set when debugging
+applications running on MS-Windows in native mode or connected to
+gdbserver that supports the @code{qGetTIBAddr} request.
+@xref{General Query Packets}.
+This variable contains the address of the thread information block.
+
@end table

On HP-UX systems, if you refer to a function or variable name that
@@ -15730,6 +15739,10 @@
@tab @code{qGetTLSAddr}
@tab Displaying @code{__thread} variables

+@item @code{w32 thread-information-block}
+@tab @code{qGetTIBAddr}
+@tab Display MS-Windows Thread Information Block.
+
@item @code{search-memory}
@tab @code{qSearch:memory}
@tab @code{find}
@@ -16509,6 +16522,11 @@
Without argument, this command displays information
about the six segment registers.

+@item info w32 thread-information-block
+This command displays thread specific information stored in the
+Thread Information Block (readable using @code{$fs} selector for 32-bit
+programs and @code{$gs} for 64-bit programs).
+
@kindex info dll
@item info dll
This is a Cygwin-specific alias of @code{info shared}.
@@ -29174,6 +29192,14 @@
removes a hardware breakpoint or watchpoint, and when the inferior
triggers a hardware-assisted breakpoint or watchpoint.

+@kindex maint set show-all-tib
+@kindex maint show show-all-tib
+@item maint set show-all-tib
+@itemx maint show show-all-tib
+Control whether to show all non zero areas within a 1k block starting
+at thread local base, when using @samp{info w32 thread-information-block}
+command.
+
@kindex maint space
@cindex memory used by commands
@item maint space
@@ -30387,6 +30413,28 @@
An empty reply indicates that @samp{qGetTLSAddr} is not supported by the
stub.
@end table

+@item qGetTIBAddr:@var{thread-id}:
+@cindex get thread information block address
+@cindex @samp{qGetTIBAddr} packet
+Fetch address of the Windows OS specific Thread Information Block.
+
+@var{thread-id} is the thread ID associated with the thread.
+
+Reply:
+@table @samp
+@item @var{XX}@dots{}
+Hex encoded (big endian) bytes representing the linear address of the
+thread information block.
+
+@item E @var{nn}
+An error occured. This means that either the thread was not found, or the
+address could not be retrieved.
+
+@item
+An empty reply indicates that @samp{qGetTIBAddr} is not supported by the
stub.
+@end table
+
+
@item qL @var{startflag} @var{threadcount} @var{nextthread}
Obtain thread information from RTOS. Where: @var{startflag} (one hex
digit) is one to indicate the first query and zero to indicate a