Re: [RFC-v5] Fix .text section offset for windows DLL (was Calling __stdcall functions in the inferior)

Pedro Alves
2012-12-13T11:07:32Z

On 12/13/2012 10:56 AM, Pierre Muller wrote:
>
>
>> -----Message d'origine-----
>> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
>> owner@sourceware.org] De la part de Pedro Alves
>> EnvoyÃ© : vendredi 7 dÃ©cembre 2012 18:49
>> Cc : Pierre Muller; 'asmwarrior'; 'Joel Brobecker'; 'Eli Zaretskii'; gdb-
>> patches@sourceware.org
>> Objet : Re: [RFC-v5] Fix .text section offset for windows DLL (was Calling
>> __stdcall functions in the inferior)
>>
>> On 12/07/2012 05:09 PM, Pedro Alves wrote:
>>> I haven't tried to grok the patch, but Kai tells me that a section name in
>> PE headers
>>> are stored in 8 character arrays, and are not necessarily zero-terminated.
>>> He was wondering, and now I am too, if it wouldn't be possible to make use
>>> of bfd routines to get at the necessary info, like the .text section
>> offset.
>>> E.g., bfd handles the long section name PE extension to coff (see
>> coffcode.h in
>>> bfd), though I'm not sure that needs to apply here.
>>
>> Hmm, looking at:
>>

...

> Pedro,
> you are right that my just committed patch does not
> fix the issue for windows gdbserver...
> So your idea to share the new function between gdb and gdbserver
> seemed indeed appealing, but when I looked at the new function pe_text_section_offset
> it doesn't seem so easy to me to remove bfd dependency...
>
> I will try to come up with a fix for gdbserver,
> but I am not sure it will be soon...

Thanks.

I'm still curious on why you needed the #ifndefs though.

There was also the point that section names in PE headers are stored in 8
character arrays, and are not necessarily zero-terminated -- get_pe_section_index
does strcmp without accounting for this (grep for SCNNMLEN in bfd).

--
Pedro Alves