2011-05-24 Tristan Gingold <gingold@adacore.com>
authorTristan Gingold <gingold@adacore.com>
Tue, 24 May 2011 12:40:17 +0000 (12:40 +0000)
committerTristan Gingold <gingold@adacore.com>
Tue, 24 May 2011 12:40:17 +0000 (12:40 +0000)
* symfile.h (enum dwarf2_section_enum): New type.
(dwarf2_get_section_info): New prototype.
* dwarf2read.c (dwarf2_get_section_info): Replace parameter
section_name by sect.  Use a switch to select the info.
* dwarf2-frame.c (warf2_get_section_info): Remove prototype.
(dwarf2_build_frame_info): Adjust calls to dwarf2_get_section_info.

gdb/ChangeLog
gdb/dwarf2-frame.c
gdb/dwarf2read.c
gdb/symfile.h

index 81714fb982cca4fac86191f3211d656672738a06..b51d4653ae7749144f1bf47e329f87fa6e028eba 100644 (file)
@@ -1,3 +1,12 @@
+2011-05-24  Tristan Gingold  <gingold@adacore.com>
+
+       * symfile.h (enum dwarf2_section_enum): New type.
+       (dwarf2_get_section_info): New prototype.
+       * dwarf2read.c (dwarf2_get_section_info): Replace parameter
+       section_name by sect.  Use a switch to select the info.
+       * dwarf2-frame.c (warf2_get_section_info): Remove prototype.
+       (dwarf2_build_frame_info): Adjust calls to dwarf2_get_section_info.
+
 2011-05-24  Pedro Alves  <pedro@codesourcery.com>
 
        * solib-svr4.c (svr4_solib_create_inferior_hook): Skip setting
index fe48713d245d1fcb0cba69518ec6fe181bc2b063..5df3488047bad06e7c0638a0ca81cf2bf4f00560 100644 (file)
@@ -2183,12 +2183,6 @@ Corrupt data in %s:%s; align 8 workaround apparently succeeded"),
   return ret;
 }
 \f
-
-/* Imported from dwarf2read.c.  */
-extern void dwarf2_get_section_info (struct objfile *, const char *,
-                                    asection **, gdb_byte **,
-                                    bfd_size_type *);
-
 static int
 qsort_fde_cmp (const void *a, const void *b)
 {
@@ -2233,7 +2227,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
   unit->dbase = 0;
   unit->tbase = 0;
 
-  dwarf2_get_section_info (objfile, ".eh_frame",
+  dwarf2_get_section_info (objfile, DWARF2_EH_FRAME,
                            &unit->dwarf_frame_section,
                            &unit->dwarf_frame_buffer,
                            &unit->dwarf_frame_size);
@@ -2269,7 +2263,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
         }
     }
 
-  dwarf2_get_section_info (objfile, ".debug_frame",
+  dwarf2_get_section_info (objfile, DWARF2_DEBUG_FRAME,
                            &unit->dwarf_frame_section,
                            &unit->dwarf_frame_buffer,
                            &unit->dwarf_frame_size);
index 65317d482c1738a4b9666f0606bbf25a7b617c55..2f4d1ae1b7e5daaacbc025adf6792c291bcd11b0 100644 (file)
@@ -1633,7 +1633,8 @@ dwarf2_section_size (struct objfile *objfile,
    SECTION_NAME.  */
 
 void
-dwarf2_get_section_info (struct objfile *objfile, const char *section_name,
+dwarf2_get_section_info (struct objfile *objfile,
+                         enum dwarf2_section_enum sect,
                          asection **sectp, gdb_byte **bufp,
                          bfd_size_type *sizep)
 {
@@ -1650,12 +1651,17 @@ dwarf2_get_section_info (struct objfile *objfile, const char *section_name,
       *sizep = 0;
       return;
     }
-  if (section_is_p (section_name, EH_FRAME_SECTION))
-    info = &data->eh_frame;
-  else if (section_is_p (section_name, FRAME_SECTION))
-    info = &data->frame;
-  else
-    gdb_assert_not_reached ("unexpected section");
+  switch (sect)
+    {
+    case DWARF2_DEBUG_FRAME:
+      info = &data->frame;
+      break;
+    case DWARF2_EH_FRAME:
+      info = &data->eh_frame;
+      break;
+    default:
+      gdb_assert_not_reached ("unexpected section");
+    }
 
   dwarf2_read_section (objfile, info);
 
index 35444756fb21636320da5a8b2178b22e8833d72f..2b80ffd8dc497c813a5c4a0a1af8da77b5476432 100644 (file)
@@ -555,6 +555,17 @@ extern struct cleanup *increment_reading_symtab (void);
 
 extern int dwarf2_has_info (struct objfile *);
 
+/* Dwarf2 sections that can be accessed by dwarf2_get_section_info.  */
+enum dwarf2_section_enum {
+  DWARF2_DEBUG_FRAME,
+  DWARF2_EH_FRAME
+};
+
+extern void dwarf2_get_section_info (struct objfile *,
+                                     enum dwarf2_section_enum,
+                                    asection **, gdb_byte **,
+                                    bfd_size_type *);
+
 extern int dwarf2_initialize_objfile (struct objfile *);
 extern void dwarf2_build_psymtabs (struct objfile *);
 extern void dwarf2_build_frame_info (struct objfile *);