This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] Even more make_cleanup_func cleanups


Attached,

It's now a race between ``threads'' and ``symtab'' :-)

	enjoy,
		Andrew
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.

Index: coffread.c
===================================================================
RCS file: /cvs/src/src/gdb/coffread.c,v
retrieving revision 1.6
diff -p -r1.6 coffread.c
*** coffread.c	2000/05/16 04:07:39	1.6
--- coffread.c	2000/05/22 08:51:02
*************** static void enter_linenos PARAMS ((long,
*** 205,210 ****
--- 205,212 ----
  
  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 char *coff_getfilename PARAMS ((u
*** 213,218 ****
--- 215,222 ----
  
  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 *,
*************** coff_symfile_read (objfile, mainline)
*** 656,662 ****
    info->max_lineno_offset = 0;
    bfd_map_over_sections (abfd, find_linenos, (PTR) info);
  
!   make_cleanup ((make_cleanup_func) free_linetab, 0);
    val = init_lineno (abfd, info->min_lineno_offset,
  		     info->max_lineno_offset - info->min_lineno_offset);
    if (val < 0)
--- 660,666 ----
    info->max_lineno_offset = 0;
    bfd_map_over_sections (abfd, find_linenos, (PTR) info);
  
!   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)
*************** coff_symfile_read (objfile, mainline)
*** 664,670 ****
  
    /* Now read the string table, all at once.  */
  
!   make_cleanup ((make_cleanup_func) free_stringtab, 0);
    val = init_stringtab (abfd, stringtab_offset);
    if (val < 0)
      error ("\"%s\": can't get string table", name);
--- 668,674 ----
  
    /* Now read the string table, all at once.  */
  
!   make_cleanup (free_stringtab_cleanup, 0 /*ignore*/);
    val = init_stringtab (abfd, stringtab_offset);
    if (val < 0)
      error ("\"%s\": can't get string table", name);
*************** free_stringtab ()
*** 1287,1292 ****
--- 1291,1302 ----
    stringtab = NULL;
  }
  
+ static void
+ free_stringtab_cleanup (void *ignore)
+ {
+   free_stringtab ();
+ }
+ 
  static char *
  getsymname (symbol_entry)
       struct internal_syment *symbol_entry;
*************** free_linetab ()
*** 1386,1391 ****
--- 1396,1407 ----
    if (linetab)
      free (linetab);
    linetab = NULL;
+ }
+ 
+ static void
+ free_linetab_cleanup (void *ignore)
+ {
+   free_linetab ();
  }
  
  #if !defined (L_LNNO32)
Index: corelow.c
===================================================================
RCS file: /cvs/src/src/gdb/corelow.c,v
retrieving revision 1.3
diff -p -r1.3 corelow.c
*** corelow.c	2000/05/16 02:43:39	1.3
--- corelow.c	2000/05/22 08:51:05
*************** static void core_detach PARAMS ((char *,
*** 60,65 ****
--- 60,67 ----
  
  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_close (quitting)
*** 207,212 ****
--- 209,220 ----
    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.  */
*************** core_open (filename, from_tty)
*** 305,311 ****
    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);
  
    /* Find a suitable core file handler to munch on core_bfd */
    core_vec = sniff_core_bfd (core_bfd);
--- 313,319 ----
    discard_cleanups (old_chain);	/* Don't free filename any more */
    unpush_target (&core_ops);
    core_bfd = temp_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);
Index: dbxread.c
===================================================================
RCS file: /cvs/src/src/gdb/dbxread.c,v
retrieving revision 1.3
diff -p -r1.3 dbxread.c
*** dbxread.c	2000/05/16 04:07:39	1.3
--- dbxread.c	2000/05/22 08:51:11
*************** free_bincl_list (objfile)
*** 1094,1099 ****
--- 1094,1111 ----
    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.  */
  
*************** read_dbx_symtab (objfile)
*** 1295,1301 ****
  
    /* Init bincl list */
    init_bincl_list (20, objfile);
!   back_to = make_cleanup ((make_cleanup_func) free_bincl_list, objfile);
  
    last_source_file = NULL;
  
--- 1307,1313 ----
  
    /* Init bincl list */
    init_bincl_list (20, objfile);
!   back_to = make_cleanup_free_bincl_list (objfile);
  
    last_source_file = NULL;
  
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.6
diff -p -r1.6 dwarf2read.c
*** dwarf2read.c	2000/05/13 00:51:35	1.6
--- dwarf2read.c	2000/05/22 08:51:20
*************** struct die_info *read_comp_unit PARAMS (
*** 708,713 ****
--- 708,715 ----
  
  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 *));
*************** psymtab_to_symtab_1 (pst)
*** 1322,1328 ****
  
    dies = read_comp_unit (info_ptr, abfd);
  
!   make_cleanup ((make_cleanup_func) free_die_list, dies);
  
    /* Do line number decoding in read_file_scope () */
    process_die (dies, objfile);
--- 1324,1330 ----
  
    dies = read_comp_unit (info_ptr, abfd);
  
!   make_cleanup_free_die_list (dies);
  
    /* Do line number decoding in read_file_scope () */
    process_die (dies, objfile);
*************** free_die_list (dies)
*** 2955,2960 ****
--- 2957,2975 ----
        die = next;
      }
  }
+ 
+ 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.  */
Index: hp-psymtab-read.c
===================================================================
RCS file: /cvs/src/src/gdb/hp-psymtab-read.c,v
retrieving revision 1.2
diff -p -r1.2 hp-psymtab-read.c
*** hp-psymtab-read.c	2000/05/04 16:52:33	1.2
--- hp-psymtab-read.c	2000/05/22 08:51:25
*************** hpread_build_psymtabs (objfile, mainline
*** 1628,1634 ****
      (struct partial_symtab **) alloca (dependencies_allocated *
  				       sizeof (struct partial_symtab *));
  
!   old_chain = make_cleanup ((make_cleanup_func) free_objfile, objfile);
  
    last_source_file = 0;
  
--- 1628,1634 ----
      (struct partial_symtab **) alloca (dependencies_allocated *
  				       sizeof (struct partial_symtab *));
  
!   old_chain = make_cleanup_free_objfile (objfile);
  
    last_source_file = 0;
  
Index: hpread.c
===================================================================
RCS file: /cvs/src/src/gdb/hpread.c,v
retrieving revision 1.2
diff -p -r1.2 hpread.c
*** hpread.c	2000/05/04 16:52:33	1.2
--- hpread.c	2000/05/22 08:51:29
*************** hpread_build_psymtabs (objfile, mainline
*** 358,364 ****
      (struct partial_symtab **) alloca (dependencies_allocated *
  				       sizeof (struct partial_symtab *));
  
!   old_chain = make_cleanup (free_objfile, objfile);
  
    last_source_file = 0;
  
--- 358,364 ----
      (struct partial_symtab **) alloca (dependencies_allocated *
  				       sizeof (struct partial_symtab *));
  
!   old_chain = make_cleanup_free_objfile (objfile);
  
    last_source_file = 0;
  
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.5
diff -p -r1.5 infcmd.c
*** infcmd.c	2000/05/15 05:54:02	1.5
--- infcmd.c	2000/05/22 08:51:33
*************** nexti_command (count_string, from_tty)
*** 455,460 ****
--- 455,466 ----
  }
  
  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;
*************** step_1 (skip_subroutines, single_inst, c
*** 489,498 ****
      {
        enable_longjmp_breakpoint ();
        if (!event_loop_p || !target_can_async_p ())
! 	cleanups = make_cleanup ((make_cleanup_func) disable_longjmp_breakpoint,
! 				 0);
        else
!         make_exec_cleanup ((make_cleanup_func) disable_longjmp_breakpoint, 0);
      }
  
    /* In synchronous case, all is well, just use the regular for loop. */
--- 495,503 ----
      {
        enable_longjmp_breakpoint ();
        if (!event_loop_p || !target_can_async_p ())
! 	cleanups = make_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/);
        else
!         make_exec_cleanup (disable_longjmp_breakpoint_cleanup, 0 /*ignore*/);
      }
  
    /* In synchronous case, all is well, just use the regular for loop. */
Index: inferior.h
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v
retrieving revision 1.4
diff -p -r1.4 inferior.h
*** inferior.h	2000/04/20 04:24:04	1.4
--- inferior.h	2000/05/22 08:51:33
*************** extern struct inferior_status *save_infe
*** 42,47 ****
--- 42,49 ----
  
  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));
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.13
diff -p -r1.13 infrun.c
*** infrun.c	2000/05/16 03:03:13	1.13
--- infrun.c	2000/05/22 08:51:44
*************** static void sig_print_info (enum target_
*** 46,52 ****
  
  static void sig_print_header (void);
  
! static void resume_cleanups (int);
  
  static int hook_stop_stub (void *);
  
--- 46,52 ----
  
  static void sig_print_header (void);
  
! static void resume_cleanups (void *);
  
  static int hook_stop_stub (void *);
  
*************** static int singlestep_breakpoints_insert
*** 752,758 ****
  /* Things to clean up if we QUIT out of resume ().  */
  /* ARGSUSED */
  static void
! resume_cleanups (int arg)
  {
    normal_stop ();
  }
--- 752,758 ----
  /* Things to clean up if we QUIT out of resume ().  */
  /* ARGSUSED */
  static void
! resume_cleanups (void *ignore)
  {
    normal_stop ();
  }
*************** void
*** 796,803 ****
  resume (int step, enum target_signal sig)
  {
    int should_resume = 1;
!   struct cleanup *old_cleanups = make_cleanup ((make_cleanup_func)
! 					       resume_cleanups, 0);
    QUIT;
  
  #ifdef CANNOT_STEP_BREAKPOINT
--- 796,802 ----
  resume (int step, enum target_signal sig)
  {
    int should_resume = 1;
!   struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
    QUIT;
  
  #ifdef CANNOT_STEP_BREAKPOINT
*************** restore_inferior_status (struct inferior
*** 4112,4117 ****
--- 4111,4128 ----
      }
  
    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
Index: objfiles.c
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.c,v
retrieving revision 1.4
diff -p -r1.4 objfiles.c
*** objfiles.c	2000/05/04 16:52:33	1.4
--- objfiles.c	2000/05/22 08:51:46
*************** free_objfile (objfile)
*** 494,499 ****
--- 494,510 ----
      }
  }
  
+ 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.  */
  
Index: objfiles.h
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.h,v
retrieving revision 1.3
diff -p -r1.3 objfiles.h
*** objfiles.h	2000/05/04 16:52:33	1.3
--- objfiles.h	2000/05/22 08:51:49
*************** unlink_objfile PARAMS ((struct objfile *
*** 507,512 ****
--- 507,514 ----
  extern void
  free_objfile PARAMS ((struct objfile *));
  
+ extern struct cleanup *make_cleanup_free_objfile (struct objfile *);
+ 
  extern void
  free_all_objfiles PARAMS ((void));
  
Index: parse.c
===================================================================
RCS file: /cvs/src/src/gdb/parse.c,v
retrieving revision 1.3
diff -p -r1.3 parse.c
*** parse.c	2000/04/26 12:41:48	1.3
--- parse.c	2000/05/22 08:51:51
*************** static int expressiondebug = 0;
*** 77,84 ****
  
  extern int hp_som_som_object_present;
  
! static void
! free_funcalls PARAMS ((void));
  
  static void
  prefixify_expression PARAMS ((struct expression *));
--- 77,83 ----
  
  extern int hp_som_som_object_present;
  
! static void free_funcalls (void *ignore);
  
  static void
  prefixify_expression PARAMS ((struct expression *));
*************** end_arglist ()
*** 177,183 ****
     Used when there is an error inside parsing.  */
  
  static void
! free_funcalls ()
  {
    register struct funcall *call, *next;
  
--- 176,182 ----
     Used when there is an error inside parsing.  */
  
  static void
! free_funcalls (void *ignore)
  {
    register struct funcall *call, *next;
  
*************** parse_exp_1 (stringptr, block, comma)
*** 1165,1171 ****
    if (lexptr == 0 || *lexptr == 0)
      error_no_arg ("expression to compute");
  
!   old_chain = make_cleanup ((make_cleanup_func) free_funcalls, 0);
    funcall_chain = 0;
  
    expression_context_block = block ? block : get_selected_block ();
--- 1164,1170 ----
    if (lexptr == 0 || *lexptr == 0)
      error_no_arg ("expression to compute");
  
!   old_chain = make_cleanup (free_funcalls, 0 /*ignore*/);
    funcall_chain = 0;
  
    expression_context_block = block ? block : get_selected_block ();
Index: remote-udi.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-udi.c,v
retrieving revision 1.3
diff -p -r1.3 remote-udi.c
*** remote-udi.c	2000/05/16 02:43:39	1.3
--- remote-udi.c	2000/05/22 08:51:56
*************** download (load_arg_string, from_tty)
*** 1108,1114 ****
      error ("Must specify at least a file name with the load command");
  
    filename = tilde_expand (filename);
!   make_cleanup ((make_cleanup_func) free, filename);
  
    while (token = strtok (NULL, " \t"))
      {
--- 1108,1114 ----
      error ("Must specify at least a file name with the load command");
  
    filename = tilde_expand (filename);
!   make_cleanup (free, filename);
  
    while (token = strtok (NULL, " \t"))
      {
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.14
diff -p -r1.14 solib.c
*** solib.c	2000/05/16 04:07:39	1.14
--- solib.c	2000/05/22 08:52:00
*************** open_symbol_file_object (from_ttyp)
*** 984,990 ****
        return 0;
      }
  
!   make_cleanup ((make_cleanup_func) free, (void *) filename);
    /* Have a pathname: read the symbol file.  */
    symbol_file_command (filename, *from_ttyp);
  
--- 984,990 ----
        return 0;
      }
  
!   make_cleanup (free, filename);
    /* Have a pathname: read the symbol file.  */
    symbol_file_command (filename, *from_ttyp);
  
Index: sparcl-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparcl-tdep.c,v
retrieving revision 1.2
diff -p -r1.2 sparcl-tdep.c
*** sparcl-tdep.c	2000/05/16 02:43:39	1.2
--- sparcl-tdep.c	2000/05/22 08:52:02
*************** static int udp_fd = -1;
*** 44,50 ****
  
  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));
  #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));
--- 44,50 ----
  
  static serial_t open_tty PARAMS ((char *name));
  static int send_resp PARAMS ((serial_t desc, char c));
! 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));
*************** send_resp (desc, c)
*** 358,365 ****
  }
  
  static void
! close_tty (ignore)
!      int ignore;
  {
    if (!remote_desc)
      return;
--- 358,364 ----
  }
  
  static void
! close_tty (void *ignore)
  {
    if (!remote_desc)
      return;
*************** or: target sparclite udp host");
*** 480,486 ****
      {
        remote_desc = open_tty (p);
  
!       old_chain = make_cleanup ((make_cleanup_func) close_tty, 0);
  
        c = send_resp (remote_desc, 0x00);
  
--- 479,485 ----
      {
        remote_desc = open_tty (p);
  
!       old_chain = make_cleanup (close_tty, 0 /*ignore*/);
  
        c = send_resp (remote_desc, 0x00);
  
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.9
diff -p -r1.9 symfile.c
*** symfile.c	2000/05/16 02:43:39	1.9
--- symfile.c	2000/05/22 08:52:09
*************** void (*pre_add_symbol_hook) PARAMS ((cha
*** 72,77 ****
--- 72,79 ----
  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 */
  
*************** syms_from_objfile (objfile, addrs, mainl
*** 605,617 ****
  
    /* 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);
  
    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);
  
        /* Since no error yet, throw away the old symbol table.  */
  
--- 607,619 ----
  
    /* Make sure that partially constructed symbol tables will be cleaned up
       if an error occurs during symbol reading.  */
!   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 (clear_symtab_users_cleanup, 0 /*ignore*/);
  
        /* Since no error yet, throw away the old symbol table.  */
  
*************** reread_symbols ()
*** 1657,1666 ****
  	      /* 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);
  	      /* We need to do this whenever any symbols go away.  */
! 	      make_cleanup ((make_cleanup_func) clear_symtab_users, 0);
  
  	      /* Clean up any state BFD has sitting around.  We don't need
  	         to close the descriptor but BFD lacks a way of closing the
--- 1659,1667 ----
  	      /* 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_free_objfile (objfile);
  	      /* We need to do this whenever any symbols go away.  */
! 	      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
*************** clear_symtab_users ()
*** 2086,2091 ****
--- 2087,2098 ----
    clear_pc_function_cache ();
    if (target_new_objfile_hook)
      target_new_objfile_hook (NULL);
+ }
+ 
+ static void
+ clear_symtab_users_cleanup (void *ignore)
+ {
+   clear_symtab_users ();
  }
  
  /* clear_symtab_users_once:
Index: tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/tracepoint.c,v
retrieving revision 1.4
diff -p -r1.4 tracepoint.c
*** tracepoint.c	2000/05/15 06:15:27	1.4
--- tracepoint.c	2000/05/22 08:52:16
*************** static void add_aexpr PARAMS ((struct co
*** 156,161 ****
--- 156,162 ----
  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 *));
  
*************** read_actions (t)
*** 854,860 ****
  	signal (STOP_SIGNAL, stop_sig);
      }
  #endif
!   old_chain = make_cleanup ((make_cleanup_func) free_actions, (void *) t);
    while (1)
      {
        /* Make sure that all output has been output.  Some machines may let
--- 855,861 ----
  	signal (STOP_SIGNAL, stop_sig);
      }
  #endif
!   old_chain = make_cleanup_free_actions (t);
    while (1)
      {
        /* Make sure that all output has been output.  Some machines may let
*************** free_actions (t)
*** 1063,1068 ****
--- 1064,1081 ----
    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 */
*************** encode_actions (t, tdp_actions, stepping
*** 1587,1594 ****
  		  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);
  
  		  switch (exp->elts[0].opcode)
  		    {
--- 1600,1606 ----
  		  struct agent_reqs areqs;
  
  		  exp = parse_exp_1 (&action_exp, block_for_pc (t->address), 1);
! 		  old_chain = make_cleanup (free_current_contents, &exp);
  
  		  switch (exp->elts[0].opcode)
  		    {
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.14
diff -p -r1.14 valops.c
*** valops.c	2000/05/20 10:29:51	1.14
--- valops.c	2000/05/22 08:52:25
*************** hand_function_call (function, nargs, arg
*** 1364,1371 ****
      noprocess ();
  
    inf_status = save_inferior_status (1);
!   old_chain = make_cleanup ((make_cleanup_func) 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)
--- 1364,1370 ----
      noprocess ();
  
    inf_status = save_inferior_status (1);
!   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)
Index: varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.3
diff -p -r1.3 varobj.c
*** varobj.c	2000/03/30 20:15:35	1.3
--- varobj.c	2000/05/22 08:52:27
*************** static struct varobj *new_root_variable 
*** 180,185 ****
--- 180,187 ----
  
  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));
*************** varobj_create (char *objname,
*** 416,422 ****
  
    /* 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);
  
    if (expression != NULL)
      {
--- 418,424 ----
  
    /* Fill out a varobj structure for the (root) variable being constructed. */
    var = new_root_variable ();
!   old_chain = make_cleanup_free_variable (var);
  
    if (expression != NULL)
      {
*************** free_variable (var)
*** 1371,1376 ****
--- 1373,1390 ----
    FREEIF (var->name);
    FREEIF (var->obj_name);
    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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]