diff options
author | Tom Tromey <tromey@redhat.com> | 2012-12-12 16:22:33 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2012-12-12 16:22:33 +0000 |
commit | b8b98ad1fc2f79814b32a8dc71763b24a8d8a0ec (patch) | |
tree | 2967f12c166d6805cd7acdcdc66c97e3b6e1d3ba /gdb/coffread.c | |
parent | d2f4b8feb92563f328897af142d05e796cde26bd (diff) | |
download | gdb-b8b98ad1fc2f79814b32a8dc71763b24a8d8a0ec.zip gdb-b8b98ad1fc2f79814b32a8dc71763b24a8d8a0ec.tar.gz gdb-b8b98ad1fc2f79814b32a8dc71763b24a8d8a0ec.tar.bz2 |
* coffread.c (coff_objfile_data_key): New global.
(coff_symfile_init): Use set_objfile_data.
(coff_symfile_read): Use objfile_data.
(coff_symfile_finish): Don't free deprecated_sym_private.
(coff_free_info): New function.
(_initialize_coffread): Initialize coff_objfile_data_key.
* mdebugread.c (pending_list): Update comment.
* objfiles.h (struct objfile) <deprecated_sym_private>: Remove.
* symfile.c (reread_symbols): Don't mention
deprecated_sym_private.
* xcoffread.c (xcoff_objfile_data_key): New global.
(XCOFF_DATA): New macro.
(process_linenos, enter_line_range, xcoff_next_symbol_text)
(read_xcoff_symtab, coff_getfilename, read_symbol_lineno): Use
XCOFF_DATA.
(xcoff_new_init) Use set_objfile_data.
(xcoff_symfile_finish): Don't free deprecated_sym_private.
(init_stringtab, swap_sym, scan_xcoff_symtab)
(xcoff_get_toc_offset, xcoff_initial_scan): Use XCOFF_DATA.
(xcoff_free_info): New function.
(_initialize_xcoffread): Initialize xcoff_objfile_data_key.
Diffstat (limited to 'gdb/coffread.c')
-rw-r--r-- | gdb/coffread.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/gdb/coffread.c b/gdb/coffread.c index 94d0554..56ed5ae 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -47,6 +47,10 @@ extern void _initialize_coffread (void); +/* Key for COFF-associated data. */ + +static const struct objfile_data *coff_objfile_data_key; + /* The objfile we are currently reading. */ static struct objfile *coffread_objfile; @@ -451,17 +455,15 @@ static void coff_symfile_init (struct objfile *objfile) { struct dbx_symfile_info *dbx; + struct coff_symfile_info *coff; /* Allocate struct to keep track of stab reading. */ dbx = XCNEW (struct dbx_symfile_info); set_objfile_data (objfile, dbx_objfile_data_key, dbx); /* Allocate struct to keep track of the symfile. */ - objfile->deprecated_sym_private - = xmalloc (sizeof (struct coff_symfile_info)); - - memset (objfile->deprecated_sym_private, 0, - sizeof (struct coff_symfile_info)); + coff = XCNEW (struct coff_symfile_info); + set_objfile_data (objfile, coff_objfile_data_key, coff); /* COFF objects may be reordered, so set OBJF_REORDERED. If we find this causes a significant slowdown in gdb then we could @@ -526,7 +528,7 @@ coff_symfile_read (struct objfile *objfile, int symfile_flags) struct cleanup *back_to, *cleanup_minimal_symbols; int stabstrsize; - info = (struct coff_symfile_info *) objfile->deprecated_sym_private; + info = objfile_data (objfile, coff_objfile_data_key); dbxinfo = DBX_SYMFILE_INFO (objfile); symfile_bfd = abfd; /* Kludge for swap routines. */ @@ -680,11 +682,6 @@ coff_new_init (struct objfile *ignore) static void coff_symfile_finish (struct objfile *objfile) { - if (objfile->deprecated_sym_private != NULL) - { - xfree (objfile->deprecated_sym_private); - } - /* Let stabs reader clean up. */ stabsread_clear_cache (); @@ -2199,8 +2196,19 @@ static const struct sym_fns coff_sym_fns = &psym_functions }; +/* Free the per-objfile COFF data. */ + +static void +coff_free_info (struct objfile *objfile, void *arg) +{ + xfree (arg); +} + void _initialize_coffread (void) { add_symtab_fns (&coff_sym_fns); + + coff_objfile_data_key = register_objfile_data_with_cleanup (NULL, + coff_free_info); } |