From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13593 invoked by alias); 13 Dec 2013 21:40:14 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 13582 invoked by uid 89); 13 Dec 2013 21:40:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_00,MSGID_MULTIPLE_AT autolearn=no version=3.3.2 X-HELO: mailhost.u-strasbg.fr Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.222.216) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Dec 2013 21:40:12 +0000 Received: from mailhost.u-strasbg.fr (localhost [127.0.0.1]) by antispam (Postfix) with ESMTP id 634BA1411F9; Fri, 13 Dec 2013 22:40:09 +0100 (CET) Received: from mailhost.u-strasbg.fr (localhost [127.0.0.1]) by antivirus (Postfix) with ESMTP id 4175A141222; Fri, 13 Dec 2013 22:40:08 +0100 (CET) Received: from md15.u-strasbg.fr (md15.u-strasbg.fr [130.79.200.204]) by mr6.u-strasbg.fr (Postfix) with ESMTP id 172151411F9; Fri, 13 Dec 2013 22:40:02 +0100 (CET) Received: from ms14.u-strasbg.fr (ms14.u-strasbg.fr [130.79.204.114]) by md15.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id rBDLe2Ui008526 ; Fri, 13 Dec 2013 22:40:02 +0100 (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (lec67-4-82-230-53-140.fbx.proxad.net [82.230.53.140]) (Authenticated sender: mullerp) by ms14.u-strasbg.fr (Postfix) with ESMTPSA id 19ED11FD89; Fri, 13 Dec 2013 22:39:41 +0100 (CET) From: "Pierre Muller" To: "'Joel Brobecker'" Cc: References: <004801cef65e$cb82d1b0$62887510$@muller@ics-cnrs.unistra.fr> <20131211170204.GD3227@adacore.com> In-Reply-To: <20131211170204.GD3227@adacore.com> Subject: [RFA-v2] Fix PR 16201: internal error on a cygwin program linked against a DLL with no .data section Date: Fri, 13 Dec 2013 21:40:00 -0000 Message-ID: <001501cef84b$e20dbd70$a6293850$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-SW-Source: 2013-12/txt/msg00547.txt.bz2 > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Joel Brobecker > Envoy=E9=A0: mercredi 11 d=E9cembre 2013 18:02 > =C0=A0: Pierre Muller > Cc=A0: gdb-patches@sourceware.org > Objet=A0: Re: [PING RFA] Fix PR 16201: internal error on a cygwin program > linked against a DLL with no .data section >=20 > > and an answer from Joel stating that he would prefer > > that someone else with more knowledge about objfile struct > > would review my RFA... > > https://sourceware.org/ml/gdb-patches/2013-12/msg00036.html > > > > We got no other reaction yet. > > > > Should I press Joel to review it nonetheless > > or does someone else volunteer to review this patch? >=20 > I just re-read the code, and I really think it would be better if > someone who actually understands the general framework could comment. > The problem seems, as you stated, relatively well understood, but > I am not sure how we are expected to fix it. >=20 > > 2013-11-27 Pierre Muller > > > > 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. >=20 > My only comment is that the patch could gain from some additional > comments explaining _why_ you're forcing the sect_index field > ("event if already set before"), and what you are trying to achieve. Here is a new version in which I try to explain more clearly that if we find the canonical '.text', '.data' or '.bss' section names, we should use these sections to set sect_index_XXX. Otherwise, we use the first section that is used later with for which we set ms_type to mst_XXX to also set sect_index_XXX. This ensure that sect_index_XXX is always set if any exported symbol is in inserted using prim_rcord_minimal_symbol with ms_type parameter set to mst_XXX I hope this clarifies the patch . =20=20 Pierre ChangeLog entry: 2013-12-13 Pierre Muller Fix PR16201. coff-pe-read.c (read_pe_exported_syms): Set OBJFILE->sect_index_XXX for XXX text, data or bss to any section that sets ms_type field of section_data to mst_XXX, with preference to canonical names '.text', '.data' and '.bss'. =20 diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c index 91ee3f6..ec9aed5 100644 --- a/gdb/coff-pe-read.c +++ b/gdb/coff-pe-read.c @@ -466,6 +466,15 @@ read_pe_exported_syms (struct objfile *objfile) { section_data[sectix].rva_start =3D vaddr; section_data[sectix].rva_end =3D vaddr + vsize; + /* For .text, .data and .bss section + set corresponding sect_index_XXX, + even if it was already set before. */ + if (sectix =3D=3D PE_SECTION_INDEX_TEXT) + objfile->sect_index_text =3D sectix; + if (sectix =3D=3D PE_SECTION_INDEX_DATA) + objfile->sect_index_data =3D sectix; + if (sectix =3D=3D PE_SECTION_INDEX_BSS) + objfile->sect_index_bss =3D sectix; } else { @@ -480,11 +489,23 @@ read_pe_exported_syms (struct objfile *objfile) section_data[otherix].rva_end =3D vaddr + vsize; section_data[otherix].vma_offset =3D 0; if (characteristics & IMAGE_SCN_CNT_CODE) - section_data[otherix].ms_type =3D mst_text; + { + section_data[otherix].ms_type =3D mst_text; + if (objfile->sect_index_text =3D=3D -1) + objfile->sect_index_text =3D otherix; + } else if (characteristics & IMAGE_SCN_CNT_INITIALIZED_DATA) - section_data[otherix].ms_type =3D mst_data; + { + section_data[otherix].ms_type =3D mst_data; + if (objfile->sect_index_data =3D=3D -1) + objfile->sect_index_data =3D otherix; + } else if (characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA) - section_data[otherix].ms_type =3D mst_bss; + { + section_data[otherix].ms_type =3D mst_bss; + if (objfile->sect_index_bss =3D=3D -1) + objfile->sect_index_bss =3D otherix; + } else section_data[otherix].ms_type =3D mst_unknown; otherix++;