This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: STABS API..
- From: Ian Lance Taylor <ian at airs dot com>
- To: Justin McCann <jneilm at yahoo dot com>
- Cc: Guy Shepherd <gshepherd7 at yahoo dot com>, binutils at sources dot redhat dot com
- Date: 10 May 2005 21:33:58 -0400
- Subject: Re: STABS API..
- References: <20050511012716.7925.qmail@web30408.mail.mud.yahoo.com>
Justin McCann <jneilm@yahoo.com> writes:
> So, you:
> 1. Read in the file and create abfd (ex. in objdump.c)
> 2. Get the symbols out of the file (from debug.c)
>
> Then:
> A. Create your own functions to handle each symbol
> type
> B. Call write_debug (or a function that does something
> similar) with your function pointers to do whatever it
> is you want.
>
> Or:
> Write your own code that combines A & B. I'm sure I'm
> skipping a lot of steps, and am overcomplicating it.
> But that's what I've come up with so far.
I don't think you need to call write_debug for the specific case of
handling fields offsets in structs. Once you have the parsed debug
information, I think you can call debug_find_tagged_type to find the
struct, debug_get_fields to get the fields of the struct,
debug_get_field_name to get the field name, and debug_get_field_bitpos
to get the bit offset.
By the way, the reason it doesn't work on GNU/Linux is that GNU/Linux
tools generate DWARF these days by default, and nobody has implemented
a DWARF version of the debug.h interface. It should work on GNU/Linux
if you compile with -gstabs.
Ian