From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21521 invoked by alias); 26 Nov 2013 02:20:14 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 21487 invoked by uid 48); 26 Nov 2013 02:20:13 -0000 From: "muller at sourceware dot org" To: gdb-prs@sourceware.org Subject: [Bug gdb/16201] internal error on a cygwin program linked against a DLL with no .data section Date: Tue, 26 Nov 2013 02:20:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: 7.6 X-Bugzilla-Keywords: X-Bugzilla-Severity: critical X-Bugzilla-Who: muller at sourceware dot org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-q4/txt/msg00432.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=16201 Pierre Muller changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |muller at sourceware dot org --- Comment #15 from Pierre Muller --- This problem might indeed have been introduced by my patch to improve reading of export sections in DLLs. The problem is that minimal symbols only recognizes three symbol types in enum ms_type: mst_text, mst_data and mst_unknown but objfile header itself has four special sections: sect_index_text, sect_index_data, sect_index_bss and sect_index_rodata See: https://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/coff-pe-read.c?rev=1.19&content-type=text/x-cvsweb-markup&cvsroot=src The following patch seems to work for me, but I am not sure it is correct... 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++; In the hope this helps, Pierre Muller PS: Is it "normal" that the program generates a SIGSEGV? -- You are receiving this mail because: You are on the CC list for the bug.