diff options
-rw-r--r-- | gdb/ChangeLog | 40 | ||||
-rw-r--r-- | gdb/coffread.c | 20 | ||||
-rw-r--r-- | gdb/corelow.c | 10 | ||||
-rw-r--r-- | gdb/dbxread.c | 14 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 17 | ||||
-rw-r--r-- | gdb/hp-psymtab-read.c | 2 | ||||
-rw-r--r-- | gdb/hpread.c | 2 | ||||
-rw-r--r-- | gdb/infcmd.c | 11 | ||||
-rw-r--r-- | gdb/inferior.h | 2 | ||||
-rw-r--r-- | gdb/infrun.c | 19 | ||||
-rw-r--r-- | gdb/objfiles.c | 11 | ||||
-rw-r--r-- | gdb/objfiles.h | 2 | ||||
-rw-r--r-- | gdb/parse.c | 7 | ||||
-rw-r--r-- | gdb/remote-udi.c | 2 | ||||
-rw-r--r-- | gdb/solib.c | 2 | ||||
-rw-r--r-- | gdb/sparcl-tdep.c | 7 | ||||
-rw-r--r-- | gdb/symfile.c | 17 | ||||
-rw-r--r-- | gdb/tracepoint.c | 18 | ||||
-rw-r--r-- | gdb/valops.c | 3 | ||||
-rw-r--r-- | gdb/varobj.c | 16 |
20 files changed, 187 insertions, 35 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c428db6..45877e0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,43 @@ +Mon May 22 16:20:31 2000 Andrew Cagney <cagney@b1.cygnus.com> + + * inferior.h (make_cleanup_restore_inferior_status): + * infrun.c (make_cleanup_restore_inferior_status, + do_restore_inferior_status_cleanup): New functions. + * valops.c (hand_function_call): Use. + * infcmd.c (disable_longjmp_breakpoint_cleanup): New function. + (step_1): Use. + * symfile.c (clear_symtab_users_cleanup): New function. + (syms_from_objfile, reread_symbols): Use. + * objfiles.c (make_cleanup_free_objfile, do_free_objfile_cleanup): + New functions. + * objfiles.h (make_cleanup_free_objfile): Add declaration. + * symfile.c (syms_from_objfile, reread_symbols), hpread.c + (hpread_build_psymtabs), hp-psymtab-read.c + (hpread_build_psymtabs): Use. + * dwarf2read.c (make_cleanup_free_die_list, + do_free_die_list_cleanup): New functions. + (psymtab_to_symtab_1): Use. + * tracepoint.c (make_cleanup_free_actions, + do_free_actions_cleanup): New functions. + (read_actions): Use. + * corelow.c (core_close_cleanup): New function. + (core_open): Use. + * dbxread.c (make_cleanup_free_bincl_list, + do_free_bincl_list_cleanup): New function. + (read_dbx_symtab): Use. + * coffread.c (free_linetab_cleanup, free_stringtab_cleanup): New + functions. + (coff_symfile_read): Use. + * varobj.c (make_cleanup_free_variable, do_free_variable_cleanup): + New function. + (varobj_create): Use. + * sparcl-tdep.c (close_tty), infrun.c (resume_cleanups), parse.c + (free_funcalls): Change signature to match make_cleanup_ftype. + * infrun.c (resume), tracepoint.c (encode_actions), remote-udi.c + (download), solib.c (open_symbol_file_object), sparcl-tdep.c + (sparclite_open), parse.c (parse_exp_1): Remove cast using + make_cleanup_func. + Mon May 22 15:49:13 2000 Andrew Cagney <cagney@b1.cygnus.com> * procfs.c (info_proc_cmd): Use make_cleanup_freeargv. diff --git a/gdb/coffread.c b/gdb/coffread.c index 010b36a..487677d 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -205,6 +205,8 @@ static void enter_linenos PARAMS ((long, int, int, struct objfile *)); static void free_linetab PARAMS ((void)); +static void free_linetab_cleanup (void *ignore); + static int init_lineno PARAMS ((bfd *, long, int)); static char *getsymname PARAMS ((struct internal_syment *)); @@ -213,6 +215,8 @@ static char *coff_getfilename PARAMS ((union internal_auxent *)); static void free_stringtab PARAMS ((void)); +static void free_stringtab_cleanup (void *ignore); + static int init_stringtab PARAMS ((bfd *, long)); static void read_one_sym PARAMS ((struct coff_symbol *, @@ -656,7 +660,7 @@ coff_symfile_read (objfile, mainline) info->max_lineno_offset = 0; bfd_map_over_sections (abfd, find_linenos, (PTR) info); - make_cleanup ((make_cleanup_func) free_linetab, 0); + make_cleanup (free_linetab_cleanup, 0 /*ignore*/); val = init_lineno (abfd, info->min_lineno_offset, info->max_lineno_offset - info->min_lineno_offset); if (val < 0) @@ -664,7 +668,7 @@ coff_symfile_read (objfile, mainline) /* Now read the string table, all at once. */ - make_cleanup ((make_cleanup_func) free_stringtab, 0); + make_cleanup (free_stringtab_cleanup, 0 /*ignore*/); val = init_stringtab (abfd, stringtab_offset); if (val < 0) error ("\"%s\": can't get string table", name); @@ -1287,6 +1291,12 @@ free_stringtab () stringtab = NULL; } +static void +free_stringtab_cleanup (void *ignore) +{ + free_stringtab (); +} + static char * getsymname (symbol_entry) struct internal_syment *symbol_entry; @@ -1388,6 +1398,12 @@ free_linetab () linetab = NULL; } +static void +free_linetab_cleanup (void *ignore) +{ + free_linetab (); +} + #if !defined (L_LNNO32) #define L_LNNO32(lp) ((lp)->l_lnno) #endif diff --git a/gdb/corelow.c b/gdb/corelow.c index 6cdf0d7..86fe937 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -60,6 +60,8 @@ static void core_detach PARAMS ((char *, int)); static void core_close PARAMS ((int)); +static void core_close_cleanup (void *ignore); + static void get_core_registers PARAMS ((int)); static void add_to_thread_list PARAMS ((bfd *, asection *, PTR)); @@ -207,6 +209,12 @@ core_close (quitting) core_vec = NULL; } +static void +core_close_cleanup (void *ignore) +{ + core_close (0/*ignored*/); +} + #ifdef SOLIB_ADD /* Stub function for catch_errors around shared library hacking. FROM_TTYP is really an int * which points to from_tty. */ @@ -305,7 +313,7 @@ core_open (filename, from_tty) discard_cleanups (old_chain); /* Don't free filename any more */ unpush_target (&core_ops); core_bfd = temp_bfd; - old_chain = make_cleanup ((make_cleanup_func) core_close, core_bfd); + old_chain = make_cleanup (core_close_cleanup, 0 /*ignore*/); /* Find a suitable core file handler to munch on core_bfd */ core_vec = sniff_core_bfd (core_bfd); diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 4c38fb4..f2012b4 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -1094,6 +1094,18 @@ free_bincl_list (objfile) bincls_allocated = 0; } +static void +do_free_bincl_list_cleanup (void *objfile) +{ + free_bincl_list (objfile); +} + +static struct cleanup * +make_cleanup_free_bincl_list (struct objfile *objfile) +{ + return make_cleanup (do_free_bincl_list_cleanup, objfile); +} + /* Scan a SunOs dynamic symbol table for symbols of interest and add them to the minimal symbol table. */ @@ -1295,7 +1307,7 @@ read_dbx_symtab (objfile) /* Init bincl list */ init_bincl_list (20, objfile); - back_to = make_cleanup ((make_cleanup_func) free_bincl_list, objfile); + back_to = make_cleanup_free_bincl_list (objfile); last_source_file = NULL; diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 9212e38..3025bbd 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -708,6 +708,8 @@ struct die_info *read_comp_unit PARAMS ((char *, bfd *)); static void free_die_list PARAMS ((struct die_info *)); +static struct cleanup *make_cleanup_free_die_list (struct die_info *); + static void process_die PARAMS ((struct die_info *, struct objfile *)); static char *dwarf2_linkage_name PARAMS ((struct die_info *)); @@ -1322,7 +1324,7 @@ psymtab_to_symtab_1 (pst) dies = read_comp_unit (info_ptr, abfd); - make_cleanup ((make_cleanup_func) free_die_list, dies); + make_cleanup_free_die_list (dies); /* Do line number decoding in read_file_scope () */ process_die (dies, objfile); @@ -2956,6 +2958,19 @@ free_die_list (dies) } } +static void +do_free_die_list_cleanup (void *dies) +{ + free_die_list (dies); +} + +static struct cleanup * +make_cleanup_free_die_list (struct die_info *dies) +{ + return make_cleanup (do_free_die_list_cleanup, dies); +} + + /* Read the contents of the section at OFFSET and of size SIZE from the object file specified by OBJFILE into the psymbol_obstack and return it. */ diff --git a/gdb/hp-psymtab-read.c b/gdb/hp-psymtab-read.c index 3315309..9a9e23f 100644 --- a/gdb/hp-psymtab-read.c +++ b/gdb/hp-psymtab-read.c @@ -1628,7 +1628,7 @@ hpread_build_psymtabs (objfile, mainline) (struct partial_symtab **) alloca (dependencies_allocated * sizeof (struct partial_symtab *)); - old_chain = make_cleanup ((make_cleanup_func) free_objfile, objfile); + old_chain = make_cleanup_free_objfile (objfile); last_source_file = 0; diff --git a/gdb/hpread.c b/gdb/hpread.c index b36531a..7cb820e 100644 --- a/gdb/hpread.c +++ b/gdb/hpread.c @@ -358,7 +358,7 @@ hpread_build_psymtabs (objfile, mainline) (struct partial_symtab **) alloca (dependencies_allocated * sizeof (struct partial_symtab *)); - old_chain = make_cleanup (free_objfile, objfile); + old_chain = make_cleanup_free_objfile (objfile); last_source_file = 0; diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 19f5260..5fdeada 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -455,6 +455,12 @@ nexti_command (count_string, from_tty) } static void +disable_longjmp_breakpoint_cleanup (void *ignore) +{ + disable_longjmp_breakpoint (); +} + +static void step_1 (skip_subroutines, single_inst, count_string) int skip_subroutines; int single_inst; @@ -489,10 +495,9 @@ step_1 (skip_subroutines, single_inst, count_string) { enable_longjmp_breakpoint (); if (!event_loop_p || !target_can_async_p ()) - cleanups = make_cleanup ((make_cleanup_func) disable_longjmp_breakpoint, - 0); + cleanups = make_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/); else - make_exec_cleanup ((make_cleanup_func) disable_longjmp_breakpoint, 0); + make_exec_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/); } /* In synchronous case, all is well, just use the regular for loop. */ diff --git a/gdb/inferior.h b/gdb/inferior.h index 6ec78f5..9beedf9 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -42,6 +42,8 @@ extern struct inferior_status *save_inferior_status PARAMS ((int)); extern void restore_inferior_status PARAMS ((struct inferior_status *)); +extern struct cleanup *make_cleanup_restore_inferior_status (struct inferior_status *); + extern void discard_inferior_status PARAMS ((struct inferior_status *)); extern void write_inferior_status_register PARAMS ((struct inferior_status * inf_status, int regno, LONGEST val)); diff --git a/gdb/infrun.c b/gdb/infrun.c index 0e84a6d..d607577 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -46,7 +46,7 @@ static void sig_print_info (enum target_signal); static void sig_print_header (void); -static void resume_cleanups (int); +static void resume_cleanups (void *); static int hook_stop_stub (void *); @@ -752,7 +752,7 @@ static int singlestep_breakpoints_inserted_p = 0; /* Things to clean up if we QUIT out of resume (). */ /* ARGSUSED */ static void -resume_cleanups (int arg) +resume_cleanups (void *ignore) { normal_stop (); } @@ -796,8 +796,7 @@ void resume (int step, enum target_signal sig) { int should_resume = 1; - struct cleanup *old_cleanups = make_cleanup ((make_cleanup_func) - resume_cleanups, 0); + struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0); QUIT; #ifdef CANNOT_STEP_BREAKPOINT @@ -4114,6 +4113,18 @@ restore_inferior_status (struct inferior_status *inf_status) free_inferior_status (inf_status); } +static void +do_restore_inferior_status_cleanup (void *sts) +{ + restore_inferior_status (sts); +} + +struct cleanup * +make_cleanup_restore_inferior_status (struct inferior_status *inf_status) +{ + return make_cleanup (do_restore_inferior_status_cleanup, inf_status); +} + void discard_inferior_status (struct inferior_status *inf_status) { diff --git a/gdb/objfiles.c b/gdb/objfiles.c index d307c2a..126cfcc 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -494,6 +494,17 @@ free_objfile (objfile) } } +static void +do_free_objfile_cleanup (void *obj) +{ + free_objfile (obj); +} + +struct cleanup * +make_cleanup_free_objfile (struct objfile *obj) +{ + return make_cleanup (do_free_objfile_cleanup, obj); +} /* Free all the object files at once and clean up their users. */ diff --git a/gdb/objfiles.h b/gdb/objfiles.h index b24894a..331d21b 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -507,6 +507,8 @@ unlink_objfile PARAMS ((struct objfile *)); extern void free_objfile PARAMS ((struct objfile *)); +extern struct cleanup *make_cleanup_free_objfile (struct objfile *); + extern void free_all_objfiles PARAMS ((void)); diff --git a/gdb/parse.c b/gdb/parse.c index 5997fae..99b62ec 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -77,8 +77,7 @@ static int expressiondebug = 0; extern int hp_som_som_object_present; -static void -free_funcalls PARAMS ((void)); +static void free_funcalls (void *ignore); static void prefixify_expression PARAMS ((struct expression *)); @@ -177,7 +176,7 @@ end_arglist () Used when there is an error inside parsing. */ static void -free_funcalls () +free_funcalls (void *ignore) { register struct funcall *call, *next; @@ -1165,7 +1164,7 @@ parse_exp_1 (stringptr, block, comma) if (lexptr == 0 || *lexptr == 0) error_no_arg ("expression to compute"); - old_chain = make_cleanup ((make_cleanup_func) free_funcalls, 0); + old_chain = make_cleanup (free_funcalls, 0 /*ignore*/); funcall_chain = 0; expression_context_block = block ? block : get_selected_block (); diff --git a/gdb/remote-udi.c b/gdb/remote-udi.c index 9a377a0..ed9e36c 100644 --- a/gdb/remote-udi.c +++ b/gdb/remote-udi.c @@ -1108,7 +1108,7 @@ download (load_arg_string, from_tty) error ("Must specify at least a file name with the load command"); filename = tilde_expand (filename); - make_cleanup ((make_cleanup_func) free, filename); + make_cleanup (free, filename); while (token = strtok (NULL, " \t")) { diff --git a/gdb/solib.c b/gdb/solib.c index 0000444..a0af4b6 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -984,7 +984,7 @@ open_symbol_file_object (from_ttyp) return 0; } - make_cleanup ((make_cleanup_func) free, (void *) filename); + make_cleanup (free, filename); /* Have a pathname: read the symbol file. */ symbol_file_command (filename, *from_ttyp); diff --git a/gdb/sparcl-tdep.c b/gdb/sparcl-tdep.c index 91499af..aaf6e30 100644 --- a/gdb/sparcl-tdep.c +++ b/gdb/sparcl-tdep.c @@ -44,7 +44,7 @@ static int udp_fd = -1; static serial_t open_tty PARAMS ((char *name)); static int send_resp PARAMS ((serial_t desc, char c)); -static void close_tty PARAMS ((int ignore)); +static void close_tty (void * ignore); #ifdef HAVE_SOCKETS static int recv_udp_buf PARAMS ((int fd, unsigned char *buf, int len, int timeout)); static int send_udp_buf PARAMS ((int fd, unsigned char *buf, int len)); @@ -358,8 +358,7 @@ send_resp (desc, c) } static void -close_tty (ignore) - int ignore; +close_tty (void *ignore) { if (!remote_desc) return; @@ -480,7 +479,7 @@ or: target sparclite udp host"); { remote_desc = open_tty (p); - old_chain = make_cleanup ((make_cleanup_func) close_tty, 0); + old_chain = make_cleanup (close_tty, 0 /*ignore*/); c = send_resp (remote_desc, 0x00); diff --git a/gdb/symfile.c b/gdb/symfile.c index 8fc4fe7..6f2edf3 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -72,6 +72,8 @@ void (*pre_add_symbol_hook) PARAMS ((char *)); void (*post_add_symbol_hook) PARAMS ((void)); void (*target_new_objfile_hook) PARAMS ((struct objfile *)); +static void clear_symtab_users_cleanup (void *ignore); + /* Global variables owned by this file */ int readnow_symbol_files; /* Read full symbols immediately */ @@ -605,13 +607,13 @@ syms_from_objfile (objfile, addrs, mainline, verbo) /* Make sure that partially constructed symbol tables will be cleaned up if an error occurs during symbol reading. */ - old_chain = make_cleanup ((make_cleanup_func) free_objfile, objfile); + old_chain = make_cleanup_free_objfile (objfile); if (mainline) { /* We will modify the main symbol table, make sure that all its users will be cleaned up if an error occurs during symbol reading. */ - make_cleanup ((make_cleanup_func) clear_symtab_users, 0); + make_cleanup (clear_symtab_users_cleanup, 0 /*ignore*/); /* Since no error yet, throw away the old symbol table. */ @@ -1657,10 +1659,9 @@ reread_symbols () /* If we get an error, blow away this objfile (not sure if that is the correct response for things like shared libraries). */ - old_cleanups = make_cleanup ((make_cleanup_func) free_objfile, - objfile); + old_cleanups = make_cleanup_free_objfile (objfile); /* We need to do this whenever any symbols go away. */ - make_cleanup ((make_cleanup_func) clear_symtab_users, 0); + make_cleanup (clear_symtab_users_cleanup, 0 /*ignore*/); /* Clean up any state BFD has sitting around. We don't need to close the descriptor but BFD lacks a way of closing the @@ -2088,6 +2089,12 @@ clear_symtab_users () target_new_objfile_hook (NULL); } +static void +clear_symtab_users_cleanup (void *ignore) +{ + clear_symtab_users (); +} + /* clear_symtab_users_once: This function is run after symbol reading, or from a cleanup. diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index eefd556..4c11f44 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -156,6 +156,7 @@ static void add_aexpr PARAMS ((struct collection_list *, struct agent_expr *)); static unsigned char *mem2hex (unsigned char *, unsigned char *, int); static void add_register PARAMS ((struct collection_list * collection, unsigned int regno)); +static struct cleanup *make_cleanup_free_actions (struct tracepoint *t); static void free_actions_list PARAMS ((char **actions_list)); static void free_actions_list_cleanup_wrapper PARAMS ((void *)); @@ -854,7 +855,7 @@ read_actions (t) signal (STOP_SIGNAL, stop_sig); } #endif - old_chain = make_cleanup ((make_cleanup_func) free_actions, (void *) t); + old_chain = make_cleanup_free_actions (t); while (1) { /* Make sure that all output has been output. Some machines may let @@ -1063,6 +1064,18 @@ free_actions (t) t->actions = NULL; } +static void +do_free_actions_cleanup (void *t) +{ + free_actions (t); +} + +static struct cleanup * +make_cleanup_free_actions (struct tracepoint *t) +{ + return make_cleanup (do_free_actions_cleanup, t); +} + struct memrange { int type; /* 0 for absolute memory range, else basereg number */ @@ -1587,8 +1600,7 @@ encode_actions (t, tdp_actions, stepping_actions) struct agent_reqs areqs; exp = parse_exp_1 (&action_exp, block_for_pc (t->address), 1); - old_chain = make_cleanup ((make_cleanup_func) - free_current_contents, &exp); + old_chain = make_cleanup (free_current_contents, &exp); switch (exp->elts[0].opcode) { diff --git a/gdb/valops.c b/gdb/valops.c index 14e9294..8034fc5 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1364,8 +1364,7 @@ hand_function_call (function, nargs, args) noprocess (); inf_status = save_inferior_status (1); - old_chain = make_cleanup ((make_cleanup_func) restore_inferior_status, - inf_status); + old_chain = make_cleanup_restore_inferior_status (inf_status); /* PUSH_DUMMY_FRAME is responsible for saving the inferior registers (and POP_FRAME for restoring them). (At least on most machines) diff --git a/gdb/varobj.c b/gdb/varobj.c index fd61203..9f80145 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -180,6 +180,8 @@ static struct varobj *new_root_variable PARAMS ((void)); static void free_variable PARAMS ((struct varobj * var)); +static struct cleanup *make_cleanup_free_variable (struct varobj *var); + static struct type *get_type PARAMS ((struct varobj * var)); static struct type *get_type_deref PARAMS ((struct varobj * var)); @@ -416,7 +418,7 @@ varobj_create (char *objname, /* Fill out a varobj structure for the (root) variable being constructed. */ var = new_root_variable (); - old_chain = make_cleanup ((make_cleanup_func) free_variable, var); + old_chain = make_cleanup_free_variable (var); if (expression != NULL) { @@ -1373,6 +1375,18 @@ free_variable (var) FREEIF (var); } +static void +do_free_variable_cleanup (void *var) +{ + free_variable (var); +} + +static struct cleanup * +make_cleanup_free_variable (struct varobj *var) +{ + return make_cleanup (do_free_variable_cleanup, var); +} + /* This returns the type of the variable. This skips past typedefs and returns the real type of the variable. It also dereferences pointers and references. */ |