From: Tavis Ormandy <taviso@sdf.lonestar.org>
To: gdb@sources.redhat.com
Subject: importing symbols from unsupported BFD target
Date: Tue, 30 Jun 2009 17:05:00 -0000 [thread overview]
Message-ID: <gemini.km29uh00uogsw08ad.taviso@sdf.lonestar.org> (raw)
Hello, I'm trying to setup remote debugging of a partially supported BFD
target. Accessing the target via a GDB stub works perfectly, and I can
examine memory, set breakpoints, etc, but I'm stuck without symbols as BFD
cannot read the symbol table from the input file.
I feel pretty close to getting this working, but I must be missing a minor
detail.
So on the unsupported target system using the native vendor-provided tools,
I export a list of symbols, their (approximate) sizes, and absolute
addresses. Now I need to make gdb understand these, so my first thought was
trying to create a relocatable ELF with a bunch of abs sym definitions and
loading it via symbol-file (I'm happy without type information and so on for
now).
This basically works, `info address symname`, `b symname`, `x/i symname` all
work, but `info symbol address` fails, and stacktraces, info breakpoints,
etc, etc are not symbolised.
Can anyone suggest what I might be missing?
Thanks, Tavis.
Some more detailed information:
The target system is Windows, and I'm trying to debug a kernel issue from a
Linux x86 host using the VMWare GDB guest stub.
So on the guest I can create a list of symbols and convert them into
gas-style absolute symbol declarations:
$ kd -z c:\\windows\\memory.dmp -c 'x /a nt!*;q' \
| bash kd2as.sh > ntoskrnlsyms.s
This command generates a list of declarations from the vendor's native
debugger output, the result looks like this:
...
.global NtCreateFile
.set NtCreateFile, 0x8056e2fc
.size NtCreateFile, 426
.type NtCreateFile, @function
.func NtCreateFile
.endfunc
.global NtCreateNamedPipeFile
.set NtCreateNamedPipeFile, 0x8056e336
.size NtCreateNamedPipeFile, 58
.type NtCreateNamedPipeFile, @function
.func NtCreateNamedPipeFile
.endfunc
...
Currently i mark all symbols as STT_FUNC, which is fine for now, and i can
assemble it on Linux, which generates symbols like so:
$ as -gstabs+ -o ntoskrnlsyms.o ntoskrnlsyms.s
$ readelf --syms ntoskrnlsyms.o | grep NtCreateFile
4993: 8056e2fc 426 FUNC GLOBAL DEFAULT ABS NtCreateFile
gdb accepts it, and it works:
$ gdb -q
(gdb) show version
GNU gdb Fedora (6.8-27.el5)
(gdb) target remote localhost:8832
[New Thread 1]
0x806d0d34 in ?? ()
(gdb) symbol-file ntoskrnlsyms.o
(gdb) info address NtCreateFile
Symbol "NtCreateFile" is a function at address 0x8056e2fc.
(gdb) x/2i NtCreateFile
0x8056e2fc: mov edi,edi
0x8056e2fe: push ebp
(gdb) b NtCreateFile
Breakpoint 1 at 0x8056e301
etc, etc, however:
(gdb) info symbol 0x8056e2fc
No symbol matches 0x8056e2fc.
(gdb) bt
#0 0x8056e301 in ?? ()
#1 0xedb88b44 in ?? ()
#2 0x8053d648 in ?? ()
...
Which is limiting the usefulness of having symbols, if anyone can spot the
problem I'd really appreciate a pointer.
Thanks, Tavis.
--
-------------------------------------
taviso@sdf.lonestar.org | finger me for my pgp key.
-------------------------------------------------------
next reply other threads:[~2009-06-30 17:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-30 17:05 Tavis Ormandy [this message]
2009-06-30 17:17 ` Daniel Jacobowitz
2009-06-30 20:54 ` Tavis Ormandy
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=gemini.km29uh00uogsw08ad.taviso@sdf.lonestar.org \
--to=taviso@sdf.lonestar.org \
--cc=gdb@sources.redhat.com \
/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