problems using BFD to reproduce objdump functionality (--stabs)

Roul Oldenburger oldenburger.roul@stn-atlas.de
Tue Aug 12 09:48:00 GMT 2003


Hello everyone,

could you please advice me in my attempt to reproduce 'objdump --stabs 
xyz' functionality.

I like to extract the same information objdump delivers from 
executables, but don't want to parse objdump's output, so I like to use 
the BFD lib, but my programm's output looks different and omits the most 
important part (the string information / last column of 'objdump 
--stabs' output) and I have almost no idea why.

I am compiling on a suse linux 8.1 system with
linux kernel 2.4.19,
a Pentium 4 processor and
I do link libbfd and libiberty to my program and of course I include bfd.h.

I don't use any special compile options and gcc seems to be satisfied.

This is what the output should look like (objdump's output from a simple 
testfile):
.
.
318    LSYM   0      0      00000000 12677 
my_date:T(0,20)=s12Tag:(0,1),0,32;Monat:(0,1),32,32;Jahr:(0,1),64,32;;
319    LSYM   0      0      00000000 12748  my_date:t(0,21)=(0,20)
320    LSYM   0      0      00000000 12771 
my_time:T(0,22)=s8Minute:(0,1),0,32;Stunde:(0,1),32,32;;
321    LSYM   0      0      00000000 12828  my_time:t(0,23)=(0,22)
322    LSYM   0      0      00000000 12851 
my_date_time:T(0,24)=s20Datum:(0,21),0,96;Zeit:(0,23),96,64;;
323    LSYM   0      0      00000000 12913  my_date_time:t(0,25)=(0,24)
324    FUN    0      0      08048460 12941  main:F(0,1)
.
.

This is my program's output (from the same testfile):

.
.
318    107    95     14964  2c392874 1668246638 *
319    LCSYM  48     12588  74700029 1026110002 *
320    SO     95     24930  65697272 1634038376 *
321    116    40     11321  3d293332 980705138 *
322    NOMAP  41     29501  5f5f3032 841759016 *
323    111    99     14955  312c3928 1818190178 *
324    54     52     24379  5f61625f 741354537 *
.
.

A colleague of mine thinks certain defines are maybe missing or there 
are more header to be include than only bfd.h.

Could you please help me with this question what is missing or point me 
to someone or other mailing list who can?

Thankyou very much!!
I have attached my program and beneath is my makefile.

Thanks
Roul Oldenburger


------------------
OBJS = $(patsubst %.c, %.o, $(wildcard *.c))
CFLAGS = -g -gstabs -Wall

bfd_test : $(OBJS)
         $(CC) $(CFLAGS) -o $@ $^ -lbfd -liberty

clean :
         rm *~ $(OBJS) bfd_test
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: main.c
URL: <https://sourceware.org/pipermail/binutils/attachments/20030812/4a2bbc7e/attachment.c>


More information about the Binutils mailing list