2009-06-16 Paul Pluzhnikov <ppluzhnikov@google.com>
[deliverable/binutils-gdb.git] / gdb / dwarf2-frame.c
index 3385bdb0f33b7050abf70d17bd45cb2e6401f615..cf080b35f3067fdbf9bd12ecc61bff14d6d335c6 100644 (file)
@@ -1,6 +1,7 @@
 /* Frame unwinder for frames with DWARF Call Frame Information.
 
-   Copyright (C) 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009
+   Free Software Foundation, Inc.
 
    Contributed by Mark Kettenis.
 
@@ -348,6 +349,7 @@ execute_stack_op (gdb_byte *exp, ULONGEST len, int addr_size,
   CORE_ADDR result;
 
   ctx = new_dwarf_expr_context ();
+  ctx->gdbarch = get_frame_arch (this_frame);
   ctx->addr_size = addr_size;
   ctx->baton = this_frame;
   ctx->read_reg = read_reg;
@@ -900,7 +902,7 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
      instruction in the associated delay slot).  This should only be
      done for "normal" frames and not for resume-type frames (signal
      handlers, sentinel frames, dummy frames).  The function
-     frame_unwind_address_in_block does just this.  It's not clear how
+     get_frame_address_in_block does just this.  It's not clear how
      reliable the method is though; there is the potential for the
      register state pre-call being different to that on return.  */
   fs->pc = get_frame_address_in_block (this_frame);
@@ -1894,15 +1896,9 @@ decode_frame_entry (struct comp_unit *unit, gdb_byte *start, int eh_frame_p)
 }
 \f
 
-/* FIXME: kettenis/20030504: This still needs to be integrated with
-   dwarf2read.c in a better way.  */
-
-/* Imported from dwarf2read.c.  */
-extern asection *dwarf_frame_section;
-extern asection *dwarf_eh_frame_section;
-
 /* Imported from dwarf2read.c.  */
-extern gdb_byte *dwarf2_read_section (struct objfile *objfile, asection *sectp);
+extern void dwarf2_get_section_info (struct objfile *, const char *, asection **,
+                                     gdb_byte **, bfd_size_type *);
 
 void
 dwarf2_build_frame_info (struct objfile *objfile)
@@ -1920,17 +1916,15 @@ dwarf2_build_frame_info (struct objfile *objfile)
 
   /* First add the information from the .eh_frame section.  That way,
      the FDEs from that section are searched last.  */
-  if (dwarf_eh_frame_section)
+  dwarf2_get_section_info (objfile, ".eh_frame",
+                           &unit->dwarf_frame_section,
+                           &unit->dwarf_frame_buffer,
+                           &unit->dwarf_frame_size);
+  if (unit->dwarf_frame_size)
     {
       asection *got, *txt;
 
       unit->cie = NULL;
-      unit->dwarf_frame_buffer = dwarf2_read_section (objfile,
-                                                     dwarf_eh_frame_section);
-
-      unit->dwarf_frame_size = bfd_get_section_size (dwarf_eh_frame_section);
-      unit->dwarf_frame_section = dwarf_eh_frame_section;
-
       /* 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
@@ -1950,13 +1944,13 @@ dwarf2_build_frame_info (struct objfile *objfile)
        frame_ptr = decode_frame_entry (unit, frame_ptr, 1);
     }
 
-  if (dwarf_frame_section)
+  dwarf2_get_section_info (objfile, ".debug_frame",
+                           &unit->dwarf_frame_section,
+                           &unit->dwarf_frame_buffer,
+                           &unit->dwarf_frame_size);
+  if (unit->dwarf_frame_size)
     {
       unit->cie = NULL;
-      unit->dwarf_frame_buffer = dwarf2_read_section (objfile,
-                                                     dwarf_frame_section);
-      unit->dwarf_frame_size = bfd_get_section_size (dwarf_frame_section);
-      unit->dwarf_frame_section = dwarf_frame_section;
 
       frame_ptr = unit->dwarf_frame_buffer;
       while (frame_ptr < unit->dwarf_frame_buffer + unit->dwarf_frame_size)
This page took 0.026608 seconds and 4 git commands to generate.