This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [RFC-v5] Fix .text section offset for windows DLL (was Calling __stdcall functions in the inferior)



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pierre Muller
> Envoyà : jeudi 13 dÃcembre 2012 15:56
> Ã : 'Pedro Alves'; 'GDB Patches'
> Objet : RE: [RFC-v5] Fix .text section offset for windows DLL (was Calling
> __stdcall functions in the inferior)
> 
> 
> 
> > -----Message d'origine-----
> > De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> > owner@sourceware.org] De la part de Pedro Alves
> > Envoyà : jeudi 13 dÃcembre 2012 15:34
> > Ã : Pierre Muller; GDB Patches
> > Objet : Re: [RFC-v5] Fix .text section offset for windows DLL (was Calling
> > __stdcall functions in the inferior)
> >
> > On 12/13/2012 12:59 PM, Pierre Muller wrote:
> > >> > 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).
> > >   the section_name are copied using xstrdup from sec_name
> > > char array of length 9, (indexes 0 to 8)
> > > which is reset using memset for each section.
> > >   only the indexes 0to 7 are possibly modified by the bfd_bread call,
> > > so that sec_name[8] always should remain a valid termination of the
> > string, no?
> >
> > I see now, thanks.  I think this would make the code a tiny bit clearer.
> > WDYT?
> 
>   Yes, you are right...
> 
>   Maybe removing the memset before and replacing it by a
>   sec_name[SCNNMLEN] = '\0';
>   after the call to bfd_bread
> would make it even more clear that you
> always get a nicely zero terminated string...

  I tried it out, compliation fails because the macro is not set.
You would still need to set that macro,
which is defined in ../include/coff/internal.h
or include that header at start of coff-pe-read.c... 


  Pierre 



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