* 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.
This commit is contained in:
Mark Kettenis
2003-08-21 22:35:33 +00:00
parent d90cf509bd
commit 0d0e1a63ef
4 changed files with 128 additions and 3 deletions

View File

@ -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 ();
}