summaryrefslogtreecommitdiff
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
commitcf47fd0f81a49be56490ea7f4dca519fc61fcdfc (patch)
tree7cdd52e6321678be12785d3b577296824daa9f3f /gdb/dwarf2-frame.c
parent6d0faa448fcfc39fb7edb5dcda717230132c434b (diff)
downloadgdb-cf47fd0f81a49be56490ea7f4dca519fc61fcdfc.tar.gz
* 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 6a40df5e325..c40726a5907 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 ();
+}