This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Fix PR 16201: internal error on a cygwin program linked against a DLL with no .data section
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Pierre Muller <pierre dot muller at ics-cnrs dot unistra dot fr>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 2 Dec 2013 07:30:43 +0400
- Subject: Re: [RFA] Fix PR 16201: internal error on a cygwin program linked against a DLL with no .data section
- Authentication-results: sourceware.org; auth=none
- References: <007101ceebd1$3d2bb590$b78320b0$ at muller@ics-cnrs.unistra.fr>
> See discussion in
> https://sourceware.org/bugzilla/show_bug.cgi?id=16201
>
> The patch below seems to fix the issues as it avoids calling
> prim_record_minimal_symbol
> with ms_type argument being equal to mst_XXX (where XXX can be text, data or
> bss)
> without having set sect_index_XXX field of the corresponding objfile.
>
> Is this OK?
>
> Pierre Muller
>
>
> 2013-11-27 Pierre Muller <muller@sourceware.org>
>
> PR 16201
> coff-pe-read.c (read_pe_exported_syms): Set sect_index_text,
> sect_index_data and sect_index_bss of objfile struct, even if
> there is no canonical '.text', '.data' or '.bss' named section.
I am unsure about this patch, at the moment. But is it a regression,
and if yes, should be listed as a must-have for 7.7? If yes again,
let's have it added to the release wiki page:
https://sourceware.org/gdb/wiki/GDB_7.7_Release
Thank you!
> diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c
> index 91ee3f6..954c457 100644
> --- a/gdb/coff-pe-read.c
> +++ b/gdb/coff-pe-read.c
> @@ -466,6 +466,13 @@ read_pe_exported_syms (struct objfile *objfile)
> {
> section_data[sectix].rva_start = vaddr;
> section_data[sectix].rva_end = vaddr + vsize;
> + /* Force sect_index, even if it was already set before. */
> + if (sectix == PE_SECTION_INDEX_TEXT)
> + objfile->sect_index_text = sectix;
> + if (sectix == PE_SECTION_INDEX_DATA)
> + objfile->sect_index_data = sectix;
> + if (sectix == PE_SECTION_INDEX_BSS)
> + objfile->sect_index_bss = sectix;
> }
> else
> {
> @@ -480,11 +487,23 @@ read_pe_exported_syms (struct objfile *objfile)
> section_data[otherix].rva_end = vaddr + vsize;
> section_data[otherix].vma_offset = 0;
> if (characteristics & IMAGE_SCN_CNT_CODE)
> - section_data[otherix].ms_type = mst_text;
> + {
> + section_data[otherix].ms_type = mst_text;
> + if (objfile->sect_index_text == -1)
> + objfile->sect_index_text = otherix;
> + }
> else if (characteristics & IMAGE_SCN_CNT_INITIALIZED_DATA)
> - section_data[otherix].ms_type = mst_data;
> + {
> + section_data[otherix].ms_type = mst_data;
> + if (objfile->sect_index_data == -1)
> + objfile->sect_index_data = otherix;
> + }
> else if (characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA)
> - section_data[otherix].ms_type = mst_bss;
> + {
> + section_data[otherix].ms_type = mst_bss;
> + if (objfile->sect_index_bss == -1)
> + objfile->sect_index_bss = otherix;
> + }
> else
> section_data[otherix].ms_type = mst_unknown;
> otherix++;
--
Joel