+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.
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 *));
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 *,
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)
/* 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);
stringtab = NULL;
}
+static void
+free_stringtab_cleanup (void *ignore)
+{
+ free_stringtab ();
+}
+
static char *
getsymname (symbol_entry)
struct internal_syment *symbol_entry;
linetab = NULL;
}
+static void
+free_linetab_cleanup (void *ignore)
+{
+ free_linetab ();
+}
+
#if !defined (L_LNNO32)
#define L_LNNO32(lp) ((lp)->l_lnno)
#endif
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));
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. */
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);
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. */
/* 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;
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 *));
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);
}
}
+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. */
(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;
(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;
step_1 (1, 1, count_string);
}
+static void
+disable_longjmp_breakpoint_cleanup (void *ignore)
+{
+ disable_longjmp_breakpoint ();
+}
+
static void
step_1 (skip_subroutines, single_inst, count_string)
int skip_subroutines;
{
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. */
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));
static void sig_print_header (void);
-static void resume_cleanups (int);
+static void resume_cleanups (void *);
static int hook_stop_stub (void *);
/* Things to clean up if we QUIT out of resume (). */
/* ARGSUSED */
static void
-resume_cleanups (int arg)
+resume_cleanups (void *ignore)
{
normal_stop ();
}
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
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)
{
}
}
+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. */
extern void
free_objfile PARAMS ((struct objfile *));
+extern struct cleanup *make_cleanup_free_objfile (struct objfile *);
+
extern void
free_all_objfiles PARAMS ((void));
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 *));
Used when there is an error inside parsing. */
static void
-free_funcalls ()
+free_funcalls (void *ignore)
{
register struct funcall *call, *next;
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 ();
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"))
{
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);
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));
}
static void
-close_tty (ignore)
- int ignore;
+close_tty (void *ignore)
{
if (!remote_desc)
return;
{
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);
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 */
/* 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. */
/* 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
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.
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 *));
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
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 */
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)
{
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)
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));
/* 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)
{
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. */