aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2-frame.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2003-08-21 22:35:33 +0000
committerMark Kettenis <kettenis@gnu.org>2003-08-21 22:35:33 +0000
commit0d0e1a63ef41342561755ff20bad14d778925152 (patch)
treec9cbe1a29625e351a2a6a0bb6efc15e8fc76b08d /gdb/dwarf2-frame.c
parentd90cf509bd4aee2e024979a75685826a5289ba22 (diff)
downloadgdb-0d0e1a63ef41342561755ff20bad14d778925152.zip
gdb-0d0e1a63ef41342561755ff20bad14d778925152.tar.gz
gdb-0d0e1a63ef41342561755ff20bad14d778925152.tar.bz2
* objfiles.h (struct objfile): Add memebers `data' and `num_data'.
(register_objfile_data, set_objfile_data, objfile_data): New prototypes. * objfiles.c (objfile_alloc_data, objfile_free_data): New prototypes. (allocate_objfile): Call objfile_alloc_data. (free_objfile): Call objfile_free_data. (struct objfile_data): New. (struct objfile_data_registration): New. (struct objfile_data_registry): New. (objfile_data_registry): New variable. (register_objfile_data): New function. (objfile_alloc_data, objfile_free_data): New functions. (set_objfile_data, objfile_data): New functions. * dwarf2-frame.c (dwarf2_frame_data): New variable. (dwarf2_frame_find_fde, add_fde): Use new per-objfile data mechanism. (_initialize_dwarf2_frame): New function and prototype.
Diffstat (limited to 'gdb/dwarf2-frame.c')
-rw-r--r--gdb/dwarf2-frame.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index 6a40df5..c40726a 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -780,6 +780,8 @@ struct comp_unit
bfd_vma dbase;
};
+const struct objfile_data *dwarf2_frame_data;
+
static unsigned int
read_1_byte (bfd *bfd, char *buf)
{
@@ -1024,7 +1026,7 @@ dwarf2_frame_find_fde (CORE_ADDR *pc)
offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
- fde = objfile->sym_private;
+ fde = objfile_data (objfile, dwarf2_frame_data);
while (fde)
{
if (*pc >= fde->initial_location + offset
@@ -1044,8 +1046,8 @@ dwarf2_frame_find_fde (CORE_ADDR *pc)
static void
add_fde (struct comp_unit *unit, struct dwarf2_fde *fde)
{
- fde->next = unit->objfile->sym_private;
- unit->objfile->sym_private = fde;
+ fde->next = objfile_data (unit->objfile, dwarf2_frame_data);
+ set_objfile_data (unit->objfile, dwarf2_frame_data, fde);
}
#ifdef CC_HAS_LONG_LONG
@@ -1441,3 +1443,12 @@ dwarf2_build_frame_info (struct objfile *objfile)
frame_ptr = decode_frame_entry (&unit, frame_ptr, 0);
}
}
+
+/* Provide a prototype to silence -Wmissing-prototypes. */
+void _initialize_dwarf2_frame (void);
+
+void
+_initialize_dwarf2_frame (void)
+{
+ dwarf2_frame_data = register_objfile_data ();
+}