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: problems using BFD to reproduce objdump functionality (--stabs)


Right! No problem with BFD only my mistake ... and apart from sec_size I handed over the wrong pointer (stabs instead of strstab).

Thanks for help.
Roul

Ian Lance Taylor wrote:
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


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