From: John Williams <jwilliams@itee.uq.edu.au>
To: gdb@sourceware.org
Subject: Triggering qSymbol packets
Date: Thu, 19 Jan 2006 00:19:00 -0000 [thread overview]
Message-ID: <43CED634.4050503@itee.uq.edu.au> (raw)
Hi,
The short version:
Is there a way to trigger GDB to issue a remote qSymbol packet, other
than the "symbol" command?
The long version:
I am working on multithreaded gdbserver support for a noMMU
embedded Linux target (uClinux). The thread library is linuxthreads
(and linuxthreads_db) in uClibc 0.9.x. gdbserver has all of the
multithreading hooks and proc-service etc.
The cross-gdb is version 5.3, which should have the necessary remote
thread code in it.
gdbserver initialises linuxthreads_db hooks in response to a qSymbol
packet (generated by the gdb "sym" command). This necessarily must come
after initial remote target connection.
Here's the catch - in uClinux we use qOffset to find out where
in the flat memory space is the application loaded - qOffset is
triggered by gdb/remote.c:remote_start_remote()
To trigger the qSymbol packet (and thus initialise gdbserver's
linuxthreads_db stuff), requires the gdb "sym" command.
From my searching, it seems the recommended sequence for gdbserver +
pthreads should be
1. gdb% target remote host:port
(connect to gdbserver, send qOffset packet, relocate the objfile
accordingly)
2. gdb% sym myapp.elf
(send qSymbol packet to gdbserver, to initialise the linuxthreads_db)
Here's the problem - the sym command resets gdb's symbol table, thus
undoing the relocation done in response to the qOffset packet. This
means that when linuxthreads_db sends symbol query packets, gdb replies
with *unrelocated* symbol addresses, and everything falls apart.
This is a pretty specific issue - not sure if gdbserver+threads+noMMU
Linux has ever been done before. So, I suppose my question(s) are:
1. has this been reported as an issue before, maybe resolved in a newer
gdb? (I've googled for 2 days and found no direct answer, just many
different pieces of the puzzle)
2. Am I correct thinking that for gdbserver+threads the user must
manually do the gdb "sym" command to trigger the qSymbol packet, and
thus initialise linuxthreads_db?
I'm torn on the cleanest way to fix this, if (1) and (2) are true. For
now I've added a call to remote_check_symbols() inside
remote_start_remote(), after get_offsets(), and that seems to do what I
expect. At least it gets further this time, but still doesn't quite work.
Do my ramblings above ring any bells with anyone? Any suggestions or
advice greatfully appreciated.
Thanks,
John
next reply other threads:[~2006-01-18 23:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-19 0:19 John Williams [this message]
2006-01-19 0:46 ` Daniel Jacobowitz
2006-01-19 0:50 ` John Williams
2006-01-19 1:18 ` Jim Blandy
2006-01-19 3:26 ` Daniel Jacobowitz
2006-01-20 4:42 ` John Williams
2006-01-20 20:29 ` Jie Zhang
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=43CED634.4050503@itee.uq.edu.au \
--to=jwilliams@itee.uq.edu.au \
--cc=gdb@sourceware.org \
/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