Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA/DWARF] Do not load .eh_frame section from separete object files
@ 2011-07-01 18:01 Joel Brobecker
  2011-07-01 19:37 ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2011-07-01 18:01 UTC (permalink / raw)
  To: gdb-patches; +Cc: Joel Brobecker

From: Joel Brobecker  <brobecker@adacore.com>

We don't need to read the .eh_frame section from the separate
object files, because this data is already present in the
main executable (it needs to, or the program wouldn't work).

We discovered this investigating a problem with the 'next' command,
which was due to unwind failures, which came from the fact that
the .eh_frame was incorrectly relocated.  That problem is mostly
under control, I think, but this is a nice optimization in any case.

gdb/ChangeLog (Tristan Gingold):

    * dwarf2-frame.c (dwarf2_build_frame_info): Do not load .eh_frame
    section in separate object files.

Tested on x86_64-linux as well as x86_64-darwin.  OK to commit?

Thanks,
-- 
Joel

---
 gdb/dwarf2-frame.c |   67 ++++++++++++++++++++++++++++------------------------
 1 files changed, 36 insertions(+), 31 deletions(-)

diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index 5df3488..b68a773 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -2227,39 +2227,44 @@ dwarf2_build_frame_info (struct objfile *objfile)
   unit->dbase = 0;
   unit->tbase = 0;
 
-  dwarf2_get_section_info (objfile, DWARF2_EH_FRAME,
-                           &unit->dwarf_frame_section,
-                           &unit->dwarf_frame_buffer,
-                           &unit->dwarf_frame_size);
-  if (unit->dwarf_frame_size)
+  if (objfile->separate_debug_objfile_backlink == NULL)
     {
-      asection *got, *txt;
-
-      /* FIXME: kettenis/20030602: This is the DW_EH_PE_datarel base
-	 that is used for the i386/amd64 target, which currently is
-	 the only target in GCC that supports/uses the
-	 DW_EH_PE_datarel encoding.  */
-      got = bfd_get_section_by_name (unit->abfd, ".got");
-      if (got)
-	unit->dbase = got->vma;
-
-      /* GCC emits the DW_EH_PE_textrel encoding type on sh and ia64
-         so far.  */
-      txt = bfd_get_section_by_name (unit->abfd, ".text");
-      if (txt)
-	unit->tbase = txt->vma;
-
-      frame_ptr = unit->dwarf_frame_buffer;
-      while (frame_ptr < unit->dwarf_frame_buffer + unit->dwarf_frame_size)
-	frame_ptr = decode_frame_entry (unit, frame_ptr, 1,
-                                        &cie_table, &fde_table);
-
-      if (cie_table.num_entries != 0)
+      /* Do not read .eh_frame from separate file as they must be also
+         present in the main file.  */
+      dwarf2_get_section_info (objfile, DWARF2_EH_FRAME,
+                               &unit->dwarf_frame_section,
+                               &unit->dwarf_frame_buffer,
+                               &unit->dwarf_frame_size);
+      if (unit->dwarf_frame_size)
         {
-          /* Reinit cie_table: debug_frame has different CIEs.  */
-          xfree (cie_table.entries);
-          cie_table.num_entries = 0;
-          cie_table.entries = NULL;
+          asection *got, *txt;
+
+          /* FIXME: kettenis/20030602: This is the DW_EH_PE_datarel base
+             that is used for the i386/amd64 target, which currently is
+             the only target in GCC that supports/uses the
+             DW_EH_PE_datarel encoding.  */
+          got = bfd_get_section_by_name (unit->abfd, ".got");
+          if (got)
+            unit->dbase = got->vma;
+
+          /* GCC emits the DW_EH_PE_textrel encoding type on sh and ia64
+             so far.  */
+          txt = bfd_get_section_by_name (unit->abfd, ".text");
+          if (txt)
+            unit->tbase = txt->vma;
+
+          frame_ptr = unit->dwarf_frame_buffer;
+          while (frame_ptr < unit->dwarf_frame_buffer + unit->dwarf_frame_size)
+            frame_ptr = decode_frame_entry (unit, frame_ptr, 1,
+                                            &cie_table, &fde_table);
+
+          if (cie_table.num_entries != 0)
+            {
+              /* Reinit cie_table: debug_frame has different CIEs.  */
+              xfree (cie_table.entries);
+              cie_table.num_entries = 0;
+              cie_table.entries = NULL;
+            }
         }
     }
 
-- 
1.7.1


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

* Re: [RFA/DWARF] Do not load .eh_frame section from separete object files
  2011-07-01 18:01 [RFA/DWARF] Do not load .eh_frame section from separete object files Joel Brobecker
@ 2011-07-01 19:37 ` Tom Tromey
  2011-07-02 11:09   ` Tristan Gingold
  2011-07-04 16:43   ` Joel Brobecker
  0 siblings, 2 replies; 4+ messages in thread
From: Tom Tromey @ 2011-07-01 19:37 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> We don't need to read the .eh_frame section from the separate
Joel> object files, because this data is already present in the
Joel> main executable (it needs to, or the program wouldn't work).

In the .debug files I looked at, the .eh_frame section is marked NOBITS.
I wonder why this isn't the case for you.

Joel> Tested on x86_64-linux as well as x86_64-darwin.  OK to commit?

The patch itself seems fine to me.

Tom


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

* Re: [RFA/DWARF] Do not load .eh_frame section from separete object files
  2011-07-01 19:37 ` Tom Tromey
@ 2011-07-02 11:09   ` Tristan Gingold
  2011-07-04 16:43   ` Joel Brobecker
  1 sibling, 0 replies; 4+ messages in thread
From: Tristan Gingold @ 2011-07-02 11:09 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Joel Brobecker, gdb-patches


On Jul 1, 2011, at 9:36 PM, Tom Tromey wrote:

>>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
> 
> Joel> We don't need to read the .eh_frame section from the separate
> Joel> object files, because this data is already present in the
> Joel> main executable (it needs to, or the program wouldn't work).
> 
> In the .debug files I looked at, the .eh_frame section is marked NOBITS.
> I wonder why this isn't the case for you.

That's not the case on Darwin, as separate files are object files in this case.

> Joel> Tested on x86_64-linux as well as x86_64-darwin.  OK to commit?
> 
> The patch itself seems fine to me.
> 
> Tom


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

* Re: [RFA/DWARF] Do not load .eh_frame section from separete object files
  2011-07-01 19:37 ` Tom Tromey
  2011-07-02 11:09   ` Tristan Gingold
@ 2011-07-04 16:43   ` Joel Brobecker
  1 sibling, 0 replies; 4+ messages in thread
From: Joel Brobecker @ 2011-07-04 16:43 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

> Joel> Tested on x86_64-linux as well as x86_64-darwin.  OK to commit?
> 
> The patch itself seems fine to me.

Thanks, checked in.

Regarding the NOBITS question, perhaps a follow up comment update
would be useful. The problem is that I don't follow in the code
how this flag prevents the debugger from trying to relocate these
sections from the separate objfile...

-- 
Joel


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

end of thread, other threads:[~2011-07-04 16:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-01 18:01 [RFA/DWARF] Do not load .eh_frame section from separete object files Joel Brobecker
2011-07-01 19:37 ` Tom Tromey
2011-07-02 11:09   ` Tristan Gingold
2011-07-04 16:43   ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox