public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [PR 25678] gdb crashes with "internal-error: sect_index_text not initialized" when .text
@ 2020-05-14 17:22 mlimber
  2020-05-14 17:32 ` Simon Marchi
  0 siblings, 1 reply; 21+ messages in thread
From: mlimber @ 2020-05-14 17:22 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 847 bytes --]

I have replicated this bug in gdb versions 10.0.50.20200514-git and also
8.2-0ubuntu1~14.04.1. I am using an executable that dynamically links an
shared object with no text segment, viz., libicudata.so.52.2. (FWIW, lldb-8
does not crash with this same executable + library.)

I located a patch by Jeremie Courreges-Anglas here:
https://marc.info/?l=openbsd-ports&m=146569238229407&w=2. I applied said
patch, rebuilt gdb, and now I can debug the same executable with gdb.

I am not an expert on the inner workings of gdb, but I assume those who
review this code can better judge the overall soundness of this change.

I did not create a new test, but I can try it if necessary.

I have not previously completed an FSF copyright assignment. I have a
"request for disclaimer" email prepared to send if so directed by the gdb
maintainers.

Cheers!

M

[-- Attachment #2: 0001-PR-symtab-25678-Set-entry-point-when-text-segment-is.patch --]
[-- Type: application/octet-stream, Size: 1293 bytes --]

From a1bf21d22eaf8f7725c38703d29c748fc2161b33 Mon Sep 17 00:00:00 2001
From: mlimber <mlimber@gmail.com>
Date: Thu, 14 May 2020 13:09:05 -0400
Subject: [PATCH] PR symtab/25678: Set entry point when text segment is
 missing. From patch by Jeremie Courreges-Anglas.

---
 gdb/ChangeLog | 7 +++++++
 gdb/symfile.c | 7 ++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c4da2a9..b25414f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2020-05-14  M. Limber  <mlimber@gmail.com>
+
+	PR symtab/25678
+	* symfile.c: Set entry point when text segment is missing.
+	From patch by Jeremie Courreges-Anglas: 
+	https://marc.info/?l=openbsd-ports&m=146569238229407&w=2
+
 2020-05-14  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
 	    Tom de Vries  <tdevries@suse.de>
 	    Pedro Alves  <palves@redhat.com>
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 7c862d5..e03c591 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -878,7 +878,12 @@ struct symfile_segment_data *
 	}
 
       if (!found)
-	ei->the_bfd_section_index = SECT_OFF_TEXT (objfile);
+	{
+	  if (objfile->sect_index_text == -1)
+	    ei->entry_point_p = 0;
+	  else
+	    ei->the_bfd_section_index = objfile->sect_index_text;	
+	}
     }
 }
 
-- 
1.9.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2020-05-20 15:04 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14 17:22 [PATCH] [PR 25678] gdb crashes with "internal-error: sect_index_text not initialized" when .text mlimber
2020-05-14 17:32 ` Simon Marchi
2020-05-14 17:48   ` mlimber
2020-05-14 17:57     ` Simon Marchi
2020-05-14 19:12       ` mlimber
2020-05-14 19:28         ` Simon Marchi
2020-05-15 18:33           ` mlimber
2020-05-16 20:39             ` mlimber
2020-05-16 21:05               ` Simon Marchi
2020-05-17  3:31             ` Simon Marchi
2020-05-17  7:01               ` Andreas Schwab
2020-05-17 14:01                 ` Simon Marchi
2020-05-17 14:08                   ` Simon Marchi
2020-05-18 18:01             ` Simon Marchi
2020-05-18 21:11               ` mlimber
2020-05-18 21:44                 ` Simon Marchi
2020-05-19 14:36                   ` mlimber
2020-05-19 14:44                     ` Simon Marchi
2020-05-20 13:24                       ` mlimber
2020-05-20 14:12                         ` Simon Marchi
2020-05-20 15:04                           ` mlimber

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).