Purge (almost) make_cleanup_func.

This commit is contained in:
Andrew Cagney 2000-05-22 09:02:23 +00:00
parent 32c092c3fa
commit 74b7792f0f
20 changed files with 187 additions and 35 deletions

View file

@ -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> Mon May 22 15:49:13 2000 Andrew Cagney <cagney@b1.cygnus.com>
* procfs.c (info_proc_cmd): Use make_cleanup_freeargv. * procfs.c (info_proc_cmd): Use make_cleanup_freeargv.

View file

@ -205,6 +205,8 @@ static void enter_linenos PARAMS ((long, int, int, struct objfile *));
static void free_linetab PARAMS ((void)); static void free_linetab PARAMS ((void));
static void free_linetab_cleanup (void *ignore);
static int init_lineno PARAMS ((bfd *, long, int)); static int init_lineno PARAMS ((bfd *, long, int));
static char *getsymname PARAMS ((struct internal_syment *)); 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 PARAMS ((void));
static void free_stringtab_cleanup (void *ignore);
static int init_stringtab PARAMS ((bfd *, long)); static int init_stringtab PARAMS ((bfd *, long));
static void read_one_sym PARAMS ((struct coff_symbol *, static void read_one_sym PARAMS ((struct coff_symbol *,
@ -656,7 +660,7 @@ coff_symfile_read (objfile, mainline)
info->max_lineno_offset = 0; info->max_lineno_offset = 0;
bfd_map_over_sections (abfd, find_linenos, (PTR) info); 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, val = init_lineno (abfd, info->min_lineno_offset,
info->max_lineno_offset - info->min_lineno_offset); info->max_lineno_offset - info->min_lineno_offset);
if (val < 0) if (val < 0)
@ -664,7 +668,7 @@ coff_symfile_read (objfile, mainline)
/* Now read the string table, all at once. */ /* 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); val = init_stringtab (abfd, stringtab_offset);
if (val < 0) if (val < 0)
error ("\"%s\": can't get string table", name); error ("\"%s\": can't get string table", name);
@ -1287,6 +1291,12 @@ free_stringtab ()
stringtab = NULL; stringtab = NULL;
} }
static void
free_stringtab_cleanup (void *ignore)
{
free_stringtab ();
}
static char * static char *
getsymname (symbol_entry) getsymname (symbol_entry)
struct internal_syment *symbol_entry; struct internal_syment *symbol_entry;
@ -1388,6 +1398,12 @@ free_linetab ()
linetab = NULL; linetab = NULL;
} }
static void
free_linetab_cleanup (void *ignore)
{
free_linetab ();
}
#if !defined (L_LNNO32) #if !defined (L_LNNO32)
#define L_LNNO32(lp) ((lp)->l_lnno) #define L_LNNO32(lp) ((lp)->l_lnno)
#endif #endif

View file

@ -60,6 +60,8 @@ static void core_detach PARAMS ((char *, int));
static void core_close PARAMS ((int)); static void core_close PARAMS ((int));
static void core_close_cleanup (void *ignore);
static void get_core_registers PARAMS ((int)); static void get_core_registers PARAMS ((int));
static void add_to_thread_list PARAMS ((bfd *, asection *, PTR)); static void add_to_thread_list PARAMS ((bfd *, asection *, PTR));
@ -207,6 +209,12 @@ core_close (quitting)
core_vec = NULL; core_vec = NULL;
} }
static void
core_close_cleanup (void *ignore)
{
core_close (0/*ignored*/);
}
#ifdef SOLIB_ADD #ifdef SOLIB_ADD
/* Stub function for catch_errors around shared library hacking. FROM_TTYP /* Stub function for catch_errors around shared library hacking. FROM_TTYP
is really an int * which points to from_tty. */ 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 */ discard_cleanups (old_chain); /* Don't free filename any more */
unpush_target (&core_ops); unpush_target (&core_ops);
core_bfd = temp_bfd; 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 */ /* Find a suitable core file handler to munch on core_bfd */
core_vec = sniff_core_bfd (core_bfd); core_vec = sniff_core_bfd (core_bfd);

View file

@ -1094,6 +1094,18 @@ free_bincl_list (objfile)
bincls_allocated = 0; 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 /* Scan a SunOs dynamic symbol table for symbols of interest and
add them to the minimal symbol table. */ add them to the minimal symbol table. */
@ -1295,7 +1307,7 @@ read_dbx_symtab (objfile)
/* Init bincl list */ /* Init bincl list */
init_bincl_list (20, objfile); 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; last_source_file = NULL;

View file

@ -708,6 +708,8 @@ struct die_info *read_comp_unit PARAMS ((char *, bfd *));
static void free_die_list PARAMS ((struct die_info *)); 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 void process_die PARAMS ((struct die_info *, struct objfile *));
static char *dwarf2_linkage_name PARAMS ((struct die_info *)); 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); 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 () */ /* Do line number decoding in read_file_scope () */
process_die (dies, objfile); 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 /* 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. */ object file specified by OBJFILE into the psymbol_obstack and return it. */

View file

@ -1628,7 +1628,7 @@ hpread_build_psymtabs (objfile, mainline)
(struct partial_symtab **) alloca (dependencies_allocated * (struct partial_symtab **) alloca (dependencies_allocated *
sizeof (struct partial_symtab *)); 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; last_source_file = 0;

View file

@ -358,7 +358,7 @@ hpread_build_psymtabs (objfile, mainline)
(struct partial_symtab **) alloca (dependencies_allocated * (struct partial_symtab **) alloca (dependencies_allocated *
sizeof (struct partial_symtab *)); sizeof (struct partial_symtab *));
old_chain = make_cleanup (free_objfile, objfile); old_chain = make_cleanup_free_objfile (objfile);
last_source_file = 0; last_source_file = 0;

View file

@ -454,6 +454,12 @@ nexti_command (count_string, from_tty)
step_1 (1, 1, count_string); step_1 (1, 1, count_string);
} }
static void
disable_longjmp_breakpoint_cleanup (void *ignore)
{
disable_longjmp_breakpoint ();
}
static void static void
step_1 (skip_subroutines, single_inst, count_string) step_1 (skip_subroutines, single_inst, count_string)
int skip_subroutines; int skip_subroutines;
@ -489,10 +495,9 @@ step_1 (skip_subroutines, single_inst, count_string)
{ {
enable_longjmp_breakpoint (); enable_longjmp_breakpoint ();
if (!event_loop_p || !target_can_async_p ()) if (!event_loop_p || !target_can_async_p ())
cleanups = make_cleanup ((make_cleanup_func) disable_longjmp_breakpoint, cleanups = make_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/);
0);
else 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. */ /* In synchronous case, all is well, just use the regular for loop. */

View file

@ -42,6 +42,8 @@ extern struct inferior_status *save_inferior_status PARAMS ((int));
extern void restore_inferior_status PARAMS ((struct inferior_status *)); 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 discard_inferior_status PARAMS ((struct inferior_status *));
extern void write_inferior_status_register PARAMS ((struct inferior_status * inf_status, int regno, LONGEST val)); extern void write_inferior_status_register PARAMS ((struct inferior_status * inf_status, int regno, LONGEST val));

View file

@ -46,7 +46,7 @@ static void sig_print_info (enum target_signal);
static void sig_print_header (void); static void sig_print_header (void);
static void resume_cleanups (int); static void resume_cleanups (void *);
static int hook_stop_stub (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 (). */ /* Things to clean up if we QUIT out of resume (). */
/* ARGSUSED */ /* ARGSUSED */
static void static void
resume_cleanups (int arg) resume_cleanups (void *ignore)
{ {
normal_stop (); normal_stop ();
} }
@ -796,8 +796,7 @@ void
resume (int step, enum target_signal sig) resume (int step, enum target_signal sig)
{ {
int should_resume = 1; int should_resume = 1;
struct cleanup *old_cleanups = make_cleanup ((make_cleanup_func) struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
resume_cleanups, 0);
QUIT; QUIT;
#ifdef CANNOT_STEP_BREAKPOINT #ifdef CANNOT_STEP_BREAKPOINT
@ -4114,6 +4113,18 @@ restore_inferior_status (struct inferior_status *inf_status)
free_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 void
discard_inferior_status (struct inferior_status *inf_status) discard_inferior_status (struct inferior_status *inf_status)
{ {

View file

@ -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. */ /* Free all the object files at once and clean up their users. */

View file

@ -507,6 +507,8 @@ unlink_objfile PARAMS ((struct objfile *));
extern void extern void
free_objfile PARAMS ((struct objfile *)); free_objfile PARAMS ((struct objfile *));
extern struct cleanup *make_cleanup_free_objfile (struct objfile *);
extern void extern void
free_all_objfiles PARAMS ((void)); free_all_objfiles PARAMS ((void));

View file

@ -77,8 +77,7 @@ static int expressiondebug = 0;
extern int hp_som_som_object_present; extern int hp_som_som_object_present;
static void static void free_funcalls (void *ignore);
free_funcalls PARAMS ((void));
static void static void
prefixify_expression PARAMS ((struct expression *)); prefixify_expression PARAMS ((struct expression *));
@ -177,7 +176,7 @@ end_arglist ()
Used when there is an error inside parsing. */ Used when there is an error inside parsing. */
static void static void
free_funcalls () free_funcalls (void *ignore)
{ {
register struct funcall *call, *next; register struct funcall *call, *next;
@ -1165,7 +1164,7 @@ parse_exp_1 (stringptr, block, comma)
if (lexptr == 0 || *lexptr == 0) if (lexptr == 0 || *lexptr == 0)
error_no_arg ("expression to compute"); 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; funcall_chain = 0;
expression_context_block = block ? block : get_selected_block (); expression_context_block = block ? block : get_selected_block ();

View file

@ -1108,7 +1108,7 @@ download (load_arg_string, from_tty)
error ("Must specify at least a file name with the load command"); error ("Must specify at least a file name with the load command");
filename = tilde_expand (filename); filename = tilde_expand (filename);
make_cleanup ((make_cleanup_func) free, filename); make_cleanup (free, filename);
while (token = strtok (NULL, " \t")) while (token = strtok (NULL, " \t"))
{ {

View file

@ -984,7 +984,7 @@ open_symbol_file_object (from_ttyp)
return 0; return 0;
} }
make_cleanup ((make_cleanup_func) free, (void *) filename); make_cleanup (free, filename);
/* Have a pathname: read the symbol file. */ /* Have a pathname: read the symbol file. */
symbol_file_command (filename, *from_ttyp); symbol_file_command (filename, *from_ttyp);

View file

@ -44,7 +44,7 @@ static int udp_fd = -1;
static serial_t open_tty PARAMS ((char *name)); static serial_t open_tty PARAMS ((char *name));
static int send_resp PARAMS ((serial_t desc, char c)); 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 #ifdef HAVE_SOCKETS
static int recv_udp_buf PARAMS ((int fd, unsigned char *buf, int len, int timeout)); 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 int send_udp_buf PARAMS ((int fd, unsigned char *buf, int len));
@ -358,8 +358,7 @@ send_resp (desc, c)
} }
static void static void
close_tty (ignore) close_tty (void *ignore)
int ignore;
{ {
if (!remote_desc) if (!remote_desc)
return; return;
@ -480,7 +479,7 @@ or: target sparclite udp host");
{ {
remote_desc = open_tty (p); 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); c = send_resp (remote_desc, 0x00);

View file

@ -72,6 +72,8 @@ void (*pre_add_symbol_hook) PARAMS ((char *));
void (*post_add_symbol_hook) PARAMS ((void)); void (*post_add_symbol_hook) PARAMS ((void));
void (*target_new_objfile_hook) PARAMS ((struct objfile *)); void (*target_new_objfile_hook) PARAMS ((struct objfile *));
static void clear_symtab_users_cleanup (void *ignore);
/* Global variables owned by this file */ /* Global variables owned by this file */
int readnow_symbol_files; /* Read full symbols immediately */ 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 /* Make sure that partially constructed symbol tables will be cleaned up
if an error occurs during symbol reading. */ 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) if (mainline)
{ {
/* We will modify the main symbol table, make sure that all its users /* We will modify the main symbol table, make sure that all its users
will be cleaned up if an error occurs during symbol reading. */ 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. */ /* 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 /* If we get an error, blow away this objfile (not sure if
that is the correct response for things like shared that is the correct response for things like shared
libraries). */ libraries). */
old_cleanups = make_cleanup ((make_cleanup_func) free_objfile, old_cleanups = make_cleanup_free_objfile (objfile);
objfile);
/* We need to do this whenever any symbols go away. */ /* 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 /* Clean up any state BFD has sitting around. We don't need
to close the descriptor but BFD lacks a way of closing the to close the descriptor but BFD lacks a way of closing the
@ -2088,6 +2089,12 @@ clear_symtab_users ()
target_new_objfile_hook (NULL); target_new_objfile_hook (NULL);
} }
static void
clear_symtab_users_cleanup (void *ignore)
{
clear_symtab_users ();
}
/* clear_symtab_users_once: /* clear_symtab_users_once:
This function is run after symbol reading, or from a cleanup. This function is run after symbol reading, or from a cleanup.

View file

@ -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 unsigned char *mem2hex (unsigned char *, unsigned char *, int);
static void add_register PARAMS ((struct collection_list * collection, static void add_register PARAMS ((struct collection_list * collection,
unsigned int regno)); 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 PARAMS ((char **actions_list));
static void free_actions_list_cleanup_wrapper PARAMS ((void *)); static void free_actions_list_cleanup_wrapper PARAMS ((void *));
@ -854,7 +855,7 @@ read_actions (t)
signal (STOP_SIGNAL, stop_sig); signal (STOP_SIGNAL, stop_sig);
} }
#endif #endif
old_chain = make_cleanup ((make_cleanup_func) free_actions, (void *) t); old_chain = make_cleanup_free_actions (t);
while (1) while (1)
{ {
/* Make sure that all output has been output. Some machines may let /* Make sure that all output has been output. Some machines may let
@ -1063,6 +1064,18 @@ free_actions (t)
t->actions = NULL; 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 struct memrange
{ {
int type; /* 0 for absolute memory range, else basereg number */ 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; struct agent_reqs areqs;
exp = parse_exp_1 (&action_exp, block_for_pc (t->address), 1); exp = parse_exp_1 (&action_exp, block_for_pc (t->address), 1);
old_chain = make_cleanup ((make_cleanup_func) old_chain = make_cleanup (free_current_contents, &exp);
free_current_contents, &exp);
switch (exp->elts[0].opcode) switch (exp->elts[0].opcode)
{ {

View file

@ -1364,8 +1364,7 @@ hand_function_call (function, nargs, args)
noprocess (); noprocess ();
inf_status = save_inferior_status (1); inf_status = save_inferior_status (1);
old_chain = make_cleanup ((make_cleanup_func) restore_inferior_status, old_chain = make_cleanup_restore_inferior_status (inf_status);
inf_status);
/* PUSH_DUMMY_FRAME is responsible for saving the inferior registers /* PUSH_DUMMY_FRAME is responsible for saving the inferior registers
(and POP_FRAME for restoring them). (At least on most machines) (and POP_FRAME for restoring them). (At least on most machines)

View file

@ -180,6 +180,8 @@ static struct varobj *new_root_variable PARAMS ((void));
static void free_variable PARAMS ((struct varobj * var)); 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 PARAMS ((struct varobj * var));
static struct type *get_type_deref 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. */ /* Fill out a varobj structure for the (root) variable being constructed. */
var = new_root_variable (); var = new_root_variable ();
old_chain = make_cleanup ((make_cleanup_func) free_variable, var); old_chain = make_cleanup_free_variable (var);
if (expression != NULL) if (expression != NULL)
{ {
@ -1373,6 +1375,18 @@ free_variable (var)
FREEIF (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 /* This returns the type of the variable. This skips past typedefs
and returns the real type of the variable. It also dereferences and returns the real type of the variable. It also dereferences
pointers and references. */ pointers and references. */