From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6959 invoked by alias); 30 Jun 2009 17:05:18 -0000 Received: (qmail 6947 invoked by uid 22791); 30 Jun 2009 17:05:17 -0000 X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=BAYES_00,J_CHICKENPOX_33,RCVD_IN_DNSWL_LOW,RCVD_NUMERIC_HELO,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 30 Jun 2009 17:05:06 +0000 Received: from root by ciao.gmane.org with local (Exim 4.43) id 1MLglT-0005m7-1z for gdb@sources.redhat.com; Tue, 30 Jun 2009 17:05:03 +0000 Received: from 74.125.57.33 ([74.125.57.33]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 30 Jun 2009 17:05:03 +0000 Received: from taviso by 74.125.57.33 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 30 Jun 2009 17:05:03 +0000 To: gdb@sources.redhat.com From: Tavis Ormandy Subject: importing symbols from unsupported BFD target Date: Tue, 30 Jun 2009 17:05:00 -0000 Message-ID: Content-Type: text/plain; charset=us-ascii User-Agent: Gemini/2.29i (Qt/3.3.6) (Linux-i686) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-06/txt/msg00327.txt.bz2 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. -------------------------------------------------------