From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: "Pierre Muller" <muller@ics.u-strasbg.fr>,
"'Daniel Jacobowitz'" <drow@false.org>
Subject: Re: [RFC-v2] Add windows Thread Information Block
Date: Wed, 01 Jul 2009 15:42:00 -0000 [thread overview]
Message-ID: <200907011643.45759.pedro@codesourcery.com> (raw)
In-Reply-To: <001f01c9fa5a$0e1297f0$2a37c7d0$@u-strasbg.fr>
On Wednesday 01 July 2009 15:41:44, Pierre Muller wrote:
> I tried to look at the siginfo stuff as
> Daniel suggested, but found out finally that
> there is already a TARGET_OBJECT_OSDATA type
> that can be used for this case.
I'm not sure. osdata is meant to be used through the get_osdata interface,
which assumes the target returns xml encoded tabular form data. See
osdata.c, and the "info os" command (use and implementation). You
can try "info os processes" against linux native or gdbserver to
see it in action.
i386-cygwin-tdep.c (this is used for i386-mingw targets too)
is a better place for i386 specific structures. windows-tdep.c
should only hold code that is shareable with ARM Windows CE too,
or any other Windows arch. arm-wince configurations don't pull
in that file yet, but they will soon, so considering this now,
just avoids having to move the code later on.
Please be aware that with the xfer_partial interfaces, you have
to handle requests for fragments of the whole information. This
means that while this currently works for you:
+ if (len == 8)
+ {
+ uint64_t tlb = th->thread_local_base;
+ memcpy ((void *)readbuf, (void *) &tlb, len);
+ return len;
+ }
+ else if (len == 4)
+ {
+ uint32_t tlb = th->thread_local_base;
+ memcpy ((void *)readbuf, (void *) &tlb, len);
+ return len;
+ }
It is not correct. Nothing is preventing GDB from splitting
the read in two or more requests, say:
bytes [0,3[, then bytes [3, 8[. Take a look at
linux-low.c:linux_xfer_siginfo to see this being considered.
> Using such a convenience variable would then require that
> at each thread switch we reload the variable,
> or at least that we tag it as 'invalid' (or is 'lazy' OK or this?)
> I have no idea if/how this is possible?
The $_siginfo mechanism handles that by making the $_siginfo value
be a "computed" value. That is, the value is always re-fetched and
"computed" from the target. So if you switch threads, and then
print $_siginfo, the data is refetched in the context of the now
current thread. It's easier to see it in action. Try placing a
breakpoint on siginfo_make_value on an x86-linux box.
Finally, this makes me curious: how does this play with TLS (does
gcc's __thread support for Windows make use of Windows' standard
TLS mechanism's?) ? From the TIB you can fetch the TLS module pointer.
It may be something worth considering that when implementing this.
http://msdn.microsoft.com/en-us/library/aa908958.aspx
lpThreadLocalBase
Pointer to a block of data.
At offset 0x2C into this block is another pointer, called ThreadLocalStoragePointer, that points to an array of per-module thread local storage blocks.
This gives a debugger access to per-thread data in the threads of the process being debugged using the same algorithms that a compiler would use.
That is, it seems the effort to implement gdbarch_fetch_tls_load_module_address
on top of this fetching of the TLB is a small step.
--
Pedro Alves
next prev parent reply other threads:[~2009-07-01 15:42 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-25 23:47 [RFC] " Pierre Muller
2009-06-26 7:04 ` Eli Zaretskii
2009-06-26 15:45 ` Christopher Faylor
2009-06-26 16:08 ` Pierre Muller
2009-06-26 16:11 ` Christopher Faylor
2009-06-27 16:07 ` Doug Evans
2009-06-27 17:15 ` Eli Zaretskii
2009-06-29 1:58 ` Christopher Faylor
2009-06-26 15:53 ` Daniel Jacobowitz
2009-06-26 16:11 ` Pierre Muller
2009-06-26 16:18 ` 'Daniel Jacobowitz'
2009-06-26 16:14 ` Christopher Faylor
2009-07-01 14:41 ` [RFC-v2] " Pierre Muller
2009-07-01 15:42 ` Pedro Alves [this message]
2009-07-01 16:05 ` Pedro Alves
2009-07-01 16:18 ` Pierre Muller
2009-07-01 16:26 ` Pedro Alves
2009-07-01 16:09 ` Pierre Muller
2009-07-01 16:33 ` Pedro Alves
2009-07-01 16:39 ` Pedro Alves
2009-07-01 17:18 ` Pedro Alves
2009-07-01 17:43 ` Eli Zaretskii
2009-07-01 18:04 ` Christopher Faylor
2009-07-03 16:11 ` [RFC-v3] " Pierre Muller
2009-07-03 19:43 ` Christopher Faylor
2010-03-10 17:14 ` [PING] " Pierre Muller
2010-03-10 17:26 ` Pedro Alves
2010-03-10 22:23 ` Pierre Muller
2010-03-10 23:30 ` Daniel Jacobowitz
2010-03-11 0:11 ` Pedro Alves
2010-03-11 0:00 ` Pedro Alves
2010-03-11 8:13 ` Pierre Muller
2010-03-15 21:40 ` [RFC-v4] Add windows OS " Pierre Muller
2010-03-16 0:10 ` Christopher Faylor
2010-04-01 9:41 ` [PING][RFC-v4] " Pierre Muller
2010-04-01 11:21 ` Pedro Alves
2010-04-01 12:57 ` [RFC-v5] " Pierre Muller
2010-04-01 13:21 ` Pedro Alves
2010-04-01 13:31 ` Pierre Muller
2010-04-01 13:43 ` Pedro Alves
2010-04-11 15:10 ` Pedro Alves
2010-04-12 13:52 ` [RFC-v6] " Pierre Muller
2010-04-12 16:43 ` Pedro Alves
2010-04-13 8:38 ` [RFA-v7] " Pierre Muller
2010-04-13 11:14 ` Pedro Alves
2010-04-13 13:21 ` [RFA-v8] " Pierre Muller
2010-04-13 15:06 ` Pedro Alves
2010-04-13 17:42 ` Eli Zaretskii
2010-04-15 22:54 ` [RFA-v9] Add Windows " Pierre Muller
[not found] ` <000c01cadcee$7ffcedd0$7ff6c970$%muller@ics-cnrs.unistra.fr>
2010-04-16 6:29 ` Eli Zaretskii
2010-04-16 7:53 ` Pierre Muller
2010-04-16 20:30 ` Christopher Faylor
[not found] ` <002101cac0f2$a2298890$e67c99b0$%muller@ics-cnrs.unistra.fr>
[not found] ` <000e01cac488$27dcf970$7796ec50$%muller@ics-cnrs.unistra.fr>
[not found] ` <001201cad17f$6a058980$3e109c80$%muller@ics-cnrs.unistra.fr>
2010-04-01 13:30 ` [PING][RFC-v4] Add windows " Eli Zaretskii
2010-04-01 16:17 ` Pierre Muller
[not found] ` <003c01cad1b6$d69e44b0$83dace10$%muller@ics-cnrs.unistra.fr>
2010-04-01 16:58 ` Eli Zaretskii
2010-03-10 18:48 ` [PING] [RFC-v3] Add windows " Mark Kettenis
2010-03-10 22:25 ` Pierre Muller
2010-03-11 0:24 ` Pedro Alves
2010-03-11 8:01 ` Pierre Muller
2009-09-02 15:35 ` [PING][RFC-v3] " Pierre Muller
2009-07-01 18:10 ` [RFC-v2] " Christopher Faylor
2009-07-01 18:20 ` Pedro Alves
2009-07-01 19:10 ` Christopher Faylor
2009-07-01 19:18 ` Pedro Alves
2009-07-01 21:13 ` Christopher Faylor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200907011643.45759.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=muller@ics.u-strasbg.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox