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 asmwarrior
> Envoyà : vendredi 7 dÃcembre 2012 17:17
> Ã : Pierre Muller
> Cc : '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 2012-12-7 23:40, Pierre Muller wrote:
> >    Hi Yuanhui,
> > thanks for trying to debug this...
> >
> >    First, concerning the optimized out problems,
> > it would be easier if you would recompile
> > GDB without optimization:
> >
> > make clean all CFLAGS="-gdwarf-2 -O0"
> >
> > After that, you should get optimized out variables...
> 
> I will did this if I have more time.
> 
> 
> >
> >    I also installed CodeBlocks to test if I can reproduce your crash,
> > but I never got any ...
> 
> The codeblocks.exe was built myself, which has debug information in it.
 I tried to recompile the sources, but
compilation fails on not found wxWorks headers...
Despite the fact that I compiled wxWorks 2.9.4 without problems.
> >
> >    Could it be that some weird DLL's have unnamed
> > sections?
> >    Could you try to insert
> >      if (sections[i] && section[i].name)
> > before
> >>       if (strcmp (sections[i].section_name, section_name) == 0)
> >>         return i;
> > to confirm that the problem originates here?
> >
> 
> I add a line:
> static int
> get_pe_section_index (const char *section_name,
> 		      struct read_pe_section_data *sections,
> 		      int nb_sections)
> {
>    int i;
>    for (i = 0; i < nb_sections; i++)
>      if (section_name && (&sections[i]) && sections[i].section_name)
>      if (strcmp (sections[i].section_name, section_name) == 0)
>        return i;
>    return PE_SECTION_INDEX_INVALID;
> }
> 
> 
> But still the same crash in strcmp().

  Could you try to check that section_name ansd sections array are valid...
It will probably require that you recompile GDB :(

 At the crash point, try to go back to 
get_pe_section_index frame and do
(gdb) print section_name
(gdb) print i
...
(gdb) print *sections@nb_index
This should print the whole array.

  The problem might also come from some memory corruption elsewhere in my code...

Thanks for helping,

Pierre


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