This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: STABS API..


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]