* [rfa] qSymbol in remote_wait
@ 2004-10-15 2:17 Jim Blandy
2004-10-15 14:46 ` Daniel Jacobowitz
0 siblings, 1 reply; 5+ messages in thread
From: Jim Blandy @ 2004-10-15 2:17 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
> As Amit Kale mentioned in December, to support NPTL gdbserver needs to
> look up symbols during remote_wait. The existing qSymbol model
> assumes that only at objfile loads (i.e. during td_ta_new) do we need
> to look up symbols; NPTL looks up symbols lazily when it needs them,
> which includes at the creation of the first child thread. This patch
> (which, I know, needs a matching change for the manual) allows
> qSymbol: queries as a response to remote_wait, in much the same way as
> the file I/O protocol.
>
> 2004-01-31 Daniel Jacobowitz <drow@mvista.com>
>
> * remote.c (handle_remote_qsymbol): New function, broken out
> from remote_check_symbols.
> (remote_check_symbols): Call it.
> (remote_wait): Handle qSymbol.
> (remote_async_wait): Likewise.
I was struggling with this too until I noticed the function
td_symbol_list, which gives you an à priori list of all the symbols
libthread_db may ever request. Unless I've missed something, this is
exactly what's needed to fit ps_pglobal_lookup into the existing
remote protocol's qSymbol dance: you can look up all the symbols
libthread_db needs as soon as the inferior loads libpthread.so, and
then have ps_pglobal_lookup just provide values from a cache.
I think this has been present in NPTL's libthread_db from the
beginning; it's present in some versions of LinuxThreads' as well, but
I don't think it was there initially.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [rfa] qSymbol in remote_wait
2004-10-15 2:17 [rfa] qSymbol in remote_wait Jim Blandy
@ 2004-10-15 14:46 ` Daniel Jacobowitz
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2004-10-15 14:46 UTC (permalink / raw)
To: Jim Blandy; +Cc: gdb-patches
On Thu, Oct 14, 2004 at 09:16:25PM -0500, Jim Blandy wrote:
>
> > As Amit Kale mentioned in December, to support NPTL gdbserver needs to
> > look up symbols during remote_wait. The existing qSymbol model
> > assumes that only at objfile loads (i.e. during td_ta_new) do we need
> > to look up symbols; NPTL looks up symbols lazily when it needs them,
> > which includes at the creation of the first child thread. This patch
> > (which, I know, needs a matching change for the manual) allows
> > qSymbol: queries as a response to remote_wait, in much the same way as
> > the file I/O protocol.
> >
> > 2004-01-31 Daniel Jacobowitz <drow@mvista.com>
> >
> > * remote.c (handle_remote_qsymbol): New function, broken out
> > from remote_check_symbols.
> > (remote_check_symbols): Call it.
> > (remote_wait): Handle qSymbol.
> > (remote_async_wait): Likewise.
>
> I was struggling with this too until I noticed the function
> td_symbol_list, which gives you an à priori list of all the symbols
> libthread_db may ever request. Unless I've missed something, this is
> exactly what's needed to fit ps_pglobal_lookup into the existing
> remote protocol's qSymbol dance: you can look up all the symbols
> libthread_db needs as soon as the inferior loads libpthread.so, and
> then have ps_pglobal_lookup just provide values from a cache.
>
> I think this has been present in NPTL's libthread_db from the
> beginning; it's present in some versions of LinuxThreads' as well, but
> I don't think it was there initially.
Woah! I never noticed that was there. Thank you very, very much, Jim.
Since I assume that all the symbols in td_symbol_list - or at least,
most of them - will be defined, I can just try the first one every time
that GDB offers to look up symbols for me.
--
Daniel Jacobowitz
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [rfa] qSymbol in remote_wait
2004-02-11 17:32 ` Daniel Jacobowitz
@ 2004-02-12 15:58 ` Andrew Cagney
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2004-02-12 15:58 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches, cagney
> On Sat, Jan 31, 2004 at 08:22:30PM -0500, Daniel Jacobowitz wrote:
>
>> Hi Andrew,
>>
>> As Amit Kale mentioned in December, to support NPTL gdbserver needs to look
>> up symbols during remote_wait. The existing qSymbol model assumes that only
>> at objfile loads (i.e. during td_ta_new) do we need to look up symbols; NPTL
>> looks up symbols lazily when it needs them, which includes at the creation
>> of the first child thread. This patch (which, I know, needs a matching
>> change for the manual) allows qSymbol: queries as a response to remote_wait,
>> in much the same way as the file I/O protocol.
>>
>> Is this OK? If so I'll write up the documentation change.
>
>
> Ping.
Can you please post the proposed protocol change to gdb@.
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [rfa] qSymbol in remote_wait
2004-02-01 1:22 Daniel Jacobowitz
@ 2004-02-11 17:32 ` Daniel Jacobowitz
2004-02-12 15:58 ` Andrew Cagney
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2004-02-11 17:32 UTC (permalink / raw)
To: gdb-patches, cagney
On Sat, Jan 31, 2004 at 08:22:30PM -0500, Daniel Jacobowitz wrote:
> Hi Andrew,
>
> As Amit Kale mentioned in December, to support NPTL gdbserver needs to look
> up symbols during remote_wait. The existing qSymbol model assumes that only
> at objfile loads (i.e. during td_ta_new) do we need to look up symbols; NPTL
> looks up symbols lazily when it needs them, which includes at the creation
> of the first child thread. This patch (which, I know, needs a matching
> change for the manual) allows qSymbol: queries as a response to remote_wait,
> in much the same way as the file I/O protocol.
>
> Is this OK? If so I'll write up the documentation change.
Ping.
> 2004-01-31 Daniel Jacobowitz <drow@mvista.com>
>
> * remote.c (handle_remote_qsymbol): New function, broken out
> from remote_check_symbols.
> (remote_check_symbols): Call it.
> (remote_wait): Handle qSymbol.
> (remote_async_wait): Likewise.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 5+ messages in thread
* [rfa] qSymbol in remote_wait
@ 2004-02-01 1:22 Daniel Jacobowitz
2004-02-11 17:32 ` Daniel Jacobowitz
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2004-02-01 1:22 UTC (permalink / raw)
To: gdb-patches; +Cc: cagney
Hi Andrew,
As Amit Kale mentioned in December, to support NPTL gdbserver needs to look
up symbols during remote_wait. The existing qSymbol model assumes that only
at objfile loads (i.e. during td_ta_new) do we need to look up symbols; NPTL
looks up symbols lazily when it needs them, which includes at the creation
of the first child thread. This patch (which, I know, needs a matching
change for the manual) allows qSymbol: queries as a response to remote_wait,
in much the same way as the file I/O protocol.
Is this OK? If so I'll write up the documentation change.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2004-01-31 Daniel Jacobowitz <drow@mvista.com>
* remote.c (handle_remote_qsymbol): New function, broken out
from remote_check_symbols.
(remote_check_symbols): Call it.
(remote_wait): Handle qSymbol.
(remote_async_wait): Likewise.
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.128
diff -u -p -r1.128 remote.c
--- remote.c 26 Jan 2004 23:07:00 -0000 1.128
+++ remote.c 1 Feb 2004 01:18:27 -0000
@@ -2075,17 +2075,36 @@ init_all_packet_configs (void)
/* Symbol look-up. */
static void
-remote_check_symbols (struct objfile *objfile)
+handle_remote_qsymbol (char *reply)
{
struct remote_state *rs = get_remote_state ();
- char *msg, *reply, *tmp;
+ char *msg = alloca (rs->remote_packet_size);
+ char *tmp;
struct minimal_symbol *sym;
int end;
+ tmp = &reply[8];
+ end = hex2bin (tmp, msg, strlen (tmp) / 2);
+ msg[end] = '\0';
+ sym = lookup_minimal_symbol (msg, NULL, NULL);
+ if (sym == NULL)
+ sprintf (msg, "qSymbol::%s", &reply[8]);
+ else
+ sprintf (msg, "qSymbol:%s:%s",
+ paddr_nz (SYMBOL_VALUE_ADDRESS (sym)),
+ &reply[8]);
+ putpkt (msg);
+}
+
+static void
+remote_check_symbols (struct objfile *objfile)
+{
+ struct remote_state *rs = get_remote_state ();
+ char *reply;
+
if (remote_protocol_qSymbol.support == PACKET_DISABLE)
return;
- msg = alloca (rs->remote_packet_size);
reply = alloca (rs->remote_packet_size);
/* Invite target to request symbol lookups. */
@@ -2096,18 +2115,8 @@ remote_check_symbols (struct objfile *ob
while (strncmp (reply, "qSymbol:", 8) == 0)
{
- tmp = &reply[8];
- end = hex2bin (tmp, msg, strlen (tmp) / 2);
- msg[end] = '\0';
- sym = lookup_minimal_symbol (msg, NULL, NULL);
- if (sym == NULL)
- sprintf (msg, "qSymbol::%s", &reply[8]);
- else
- sprintf (msg, "qSymbol:%s:%s",
- paddr_nz (SYMBOL_VALUE_ADDRESS (sym)),
- &reply[8]);
- putpkt (msg);
- getpkt (reply, (rs->remote_packet_size), 0);
+ handle_remote_qsymbol (reply);
+ getpkt (reply, rs->remote_packet_size, 0);
}
}
@@ -2993,6 +3002,11 @@ Packet: '%s'\n",
case 'O': /* Console output */
remote_console_output (buf + 1);
continue;
+ case 'q':
+ if (strncmp (buf, "qSymbol:", 8) != 0)
+ goto invalid;
+ handle_remote_qsymbol (buf);
+ continue;
case '\0':
if (last_sent_signal != TARGET_SIGNAL_0)
{
@@ -3011,6 +3025,7 @@ Packet: '%s'\n",
}
/* else fallthrough */
default:
+invalid:
warning ("Invalid remote reply: %s", buf);
continue;
}
@@ -3185,6 +3200,11 @@ remote_async_wait (ptid_t ptid, struct t
still be waiting on the inferior afterwards. */
status->kind = TARGET_WAITKIND_IGNORE;
goto got_status;
+ case 'q':
+ if (strncmp (buf, "qSymbol:", 8) != 0)
+ goto invalid;
+ handle_remote_qsymbol (buf);
+ continue;
case '\0':
if (last_sent_signal != TARGET_SIGNAL_0)
{
@@ -3203,6 +3223,7 @@ remote_async_wait (ptid_t ptid, struct t
}
/* else fallthrough */
default:
+invalid:
warning ("Invalid remote reply: %s", buf);
continue;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-10-15 14:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-15 2:17 [rfa] qSymbol in remote_wait Jim Blandy
2004-10-15 14:46 ` Daniel Jacobowitz
-- strict thread matches above, loose matches on Subject: below --
2004-02-01 1:22 Daniel Jacobowitz
2004-02-11 17:32 ` Daniel Jacobowitz
2004-02-12 15:58 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox