This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: problems using BFD to reproduce objdump functionality (--stabs)
- From: Ian Lance Taylor <ian at airs dot com>
- To: Roul Oldenburger <oldenburger dot roul at stn-atlas dot de>
- Cc: binutils at sources dot redhat dot com
- Date: 12 Aug 2003 09:51:06 -0700
- Subject: Re: problems using BFD to reproduce objdump functionality (--stabs)
- References: <3F38B847.8090504@stn-atlas.de>
Roul Oldenburger <oldenburger.roul@stn-atlas.de> writes:
> void retrieve_stabstr(bfd *abfd, asection *section, char *sec_name)
> {
> printf("Der Sektionsname ist: %s\n", sec_name);
> stabstr_size = bfd_section_size (abfd, section);
> strtab = (char *) xmalloc (stabstr_size);
> printf("stabstr_size ist %d\n", (int) stabstr_size);
> if (! bfd_get_section_contents (abfd, section, (PTR) stabs, 0, sec_size))
> {
> if (sec_name == ".stabstr")
> free (strtab);
> bfd_errmsg( bfd_get_error() );
> return;
> }
> }
Why are you using sec_size rather than stabstr_size in the call to
bfd_get_section_contents()?
This mistake could easily have been caught by using a debugger, or by
careful reading of the code.
Ian