[PATCH] check for empty .eh_frame section

Elena Zannoni ezannoni@redhat.com
Tue Jun 24 23:03:00 GMT 2003


When the exec files are stripped with eu-strip, we get an empty
.eh_frame section in the .debug file. Gdb correctly processes the
non-empty .eh_frame section in the original stripped exec file, but
get confused by the empty section in the .debug file, generating
an internal error.

This avoid gdb locating a misleading empty .eh_frame section in the
.debug file.

elena


2003-06-24  Elena Zannoni  <ezannoni@redhat.com>

	* dwarf2read.c (dwarf2_locate_sections): Ignore empty .eh_frame
	sections.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.96
diff -u -p -r1.96 dwarf2read.c
--- dwarf2read.c	11 Jun 2003 22:27:11 -0000	1.96
+++ dwarf2read.c	24 Jun 2003 22:15:09 -0000
@@ -1021,9 +1021,13 @@ dwarf2_locate_sections (bfd *ignore_abfd
     }
   else if (STREQ (sectp->name, EH_FRAME_SECTION))
     {
-      dwarf_eh_frame_offset = sectp->filepos;
-      dwarf_eh_frame_size = bfd_get_section_size_before_reloc (sectp);
-      dwarf_eh_frame_section = sectp;
+      flagword aflag = bfd_get_section_flags (ignore_abfd, sectp);
+      if (aflag & SEC_HAS_CONTENTS)
+        {
+          dwarf_eh_frame_offset = sectp->filepos;
+          dwarf_eh_frame_size = bfd_get_section_size_before_reloc (sectp);
+          dwarf_eh_frame_section = sectp;
+        }
     }
   else if (STREQ (sectp->name, RANGES_SECTION))
     {



More information about the Gdb-patches mailing list