public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "muller at sourceware dot org" <sourceware-bugzilla@sourceware.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	[thread overview]
Message-ID: <bug-16201-4717-aaSEVn2K5X@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-16201-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=16201

Pierre Muller <muller at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |muller at sourceware dot org

--- Comment #15 from Pierre Muller <muller at sourceware dot org> ---
  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.


  parent reply	other threads:[~2013-11-26  2:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-21 19:29 [Bug gdb/16201] New: " smaximov at yahoo dot com
2013-11-21 20:37 ` [Bug gdb/16201] " smaximov at yahoo dot com
2013-11-21 21:09 ` smaximov at yahoo dot com
2013-11-21 21:30 ` tromey at redhat dot com
2013-11-21 21:36 ` smaximov at yahoo dot com
2013-11-21 21:39 ` tromey at redhat dot com
2013-11-21 21:54 ` smaximov at yahoo dot com
2013-11-21 22:01 ` tromey at redhat dot com
2013-11-21 22:04 ` smaximov at yahoo dot com
2013-11-22 15:58 ` tromey at redhat dot com
2013-11-22 23:48 ` smaximov at yahoo dot com
2013-11-23 17:23 ` keiths at redhat dot com
2013-11-25 18:30 ` smaximov at yahoo dot com
2013-11-25 21:33 ` tromey at redhat dot com
2013-11-25 21:56 ` tromey at redhat dot com
2013-11-26  0:21 ` smaximov at yahoo dot com
2013-11-26  2:20 ` muller at sourceware dot org [this message]
2013-11-26  3:13 ` smaximov at yahoo dot com
2013-11-27  0:04 ` smaximov at yahoo dot com
2013-12-02 11:33 ` asmwarrior at gmail dot com
2013-12-21  0:49 ` smaximov at yahoo dot com
2013-12-21  1:02 ` asmwarrior at gmail dot com
2023-12-09 12:46 ` ssbssa at sourceware dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-16201-4717-aaSEVn2K5X@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).