problems using BFD to reproduce objdump functionality (--stabs)
Roul Oldenburger
oldenburger.roul@stn-atlas.de
Wed Aug 13 08:48:00 GMT 2003
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
More information about the Binutils
mailing list