[patch] cleanup discard_minimal_symbol cleanup

Andrew Cagney ac131313@cygnus.com
Mon May 15 21:03:00 GMT 2000


FYI, more of the same.

	Andrew
Tue May 16 13:30:08 2000  Andrew Cagney  <cagney@b1.cygnus.com>

	* symtab.h (make_cleanup_discard_minimal_symbols): Replace
 	discard_minimal_symbols.
	* minsyms.c (make_cleanup_discard_minimal_symbols):
	(do_discard_minimal_symbols_cleanup): New functions.

	* xcoffread.c (xcoff_initial_scan), somread.c (som_symfile_read),
 	solib.c (solib_add_common_symbols), os9kread.c
 	(os9k_symfile_read), nlmread.c (nlm_symfile_read), mipsread.c
 	(mipscoff_symfile_read), elfread.c (elf_symfile_read), dstread.c
 	(dst_symfile_read), dbxread.c (dbx_symfile_read), coffread.c
 	(coff_symfile_read): Replace make_cleanup.

Index: coffread.c
===================================================================
RCS file: /cvs/src/src/gdb/coffread.c,v
retrieving revision 1.5
diff -p -r1.5 coffread.c
*** coffread.c	2000/05/11 20:39:58	1.5
--- coffread.c	2000/05/16 03:58:41
*************** coff_symfile_read (objfile, mainline)
*** 670,676 ****
      error ("\"%s\": can't get string table", name);
  
    init_minimal_symbol_collection ();
!   make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
  
    /* Now that the executable file is positioned at symbol table,
       process it and define symbols accordingly.  */
--- 670,676 ----
      error ("\"%s\": can't get string table", name);
  
    init_minimal_symbol_collection ();
!   make_cleanup_discard_minimal_symbols ();
  
    /* Now that the executable file is positioned at symbol table,
       process it and define symbols accordingly.  */
Index: dbxread.c
===================================================================
RCS file: /cvs/src/src/gdb/dbxread.c,v
retrieving revision 1.2
diff -p -r1.2 dbxread.c
*** dbxread.c	2000/05/04 16:52:33	1.2
--- dbxread.c	2000/05/16 03:58:48
*************** dbx_symfile_read (objfile, mainline)
*** 624,630 ****
    back_to = make_cleanup (really_free_pendings, 0);
  
    init_minimal_symbol_collection ();
!   make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
  
    /* Read stabs data from executable file and define symbols. */
  
--- 624,630 ----
    back_to = make_cleanup (really_free_pendings, 0);
  
    init_minimal_symbol_collection ();
!   make_cleanup_discard_minimal_symbols ();
  
    /* Read stabs data from executable file and define symbols. */
  
Index: dstread.c
===================================================================
RCS file: /cvs/src/src/gdb/dstread.c,v
retrieving revision 1.1.1.5
diff -p -r1.1.1.5 dstread.c
*** dstread.c	1999/10/05 23:08:09	1.1.1.5
--- dstread.c	2000/05/16 03:58:50
*************** dst_symfile_read (objfile, mainline)
*** 288,294 ****
      error ("\"%s\": error reading debugging symbol tables\n", name);
  
    init_minimal_symbol_collection ();
!   make_cleanup (discard_minimal_symbols, 0);
  
    /* Now that the executable file is positioned at symbol table,
       process it and define symbols accordingly.  */
--- 288,294 ----
      error ("\"%s\": error reading debugging symbol tables\n", name);
  
    init_minimal_symbol_collection ();
!   make_cleanup_discard_minimal_symbols ();
  
    /* Now that the executable file is positioned at symbol table,
       process it and define symbols accordingly.  */
Index: elfread.c
===================================================================
RCS file: /cvs/src/src/gdb/elfread.c,v
retrieving revision 1.7
diff -p -r1.7 elfread.c
*** elfread.c	2000/05/11 00:36:17	1.7
--- elfread.c	2000/05/16 03:58:52
*************** elf_symfile_read (objfile, mainline)
*** 591,597 ****
    CORE_ADDR offset;
  
    init_minimal_symbol_collection ();
!   back_to = make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
  
    memset ((char *) &ei, 0, sizeof (ei));
  
--- 591,597 ----
    CORE_ADDR offset;
  
    init_minimal_symbol_collection ();
!   back_to = make_cleanup_discard_minimal_symbols ();
  
    memset ((char *) &ei, 0, sizeof (ei));
  
Index: minsyms.c
===================================================================
RCS file: /cvs/src/src/gdb/minsyms.c,v
retrieving revision 1.7
diff -p -r1.7 minsyms.c
*** minsyms.c	2000/05/04 16:52:33	1.7
--- minsyms.c	2000/05/16 03:58:57
*************** compare_minimal_symbols (fn1p, fn2p)
*** 743,752 ****
     obstack and then simply blow the obstack away when we are done with
     it.  Is it worth the extra trouble though? */
  
! /* ARGSUSED */
! void
! discard_minimal_symbols (foo)
!      int foo;
  {
    register struct msym_bunch *next;
  
--- 743,750 ----
     obstack and then simply blow the obstack away when we are done with
     it.  Is it worth the extra trouble though? */
  
! static void
! do_discard_minimal_symbols_cleanup (void *arg)
  {
    register struct msym_bunch *next;
  
*************** discard_minimal_symbols (foo)
*** 757,762 ****
--- 755,767 ----
        msym_bunch = next;
      }
  }
+ 
+ struct cleanup *
+ make_cleanup_discard_minimal_symbols (void)
+ {
+   return make_cleanup (do_discard_minimal_symbols_cleanup, 0);
+ }
+ 
  
  
  /* Compact duplicate entries out of a minimal symbol table by walking
Index: mipsread.c
===================================================================
RCS file: /cvs/src/src/gdb/mipsread.c,v
retrieving revision 1.2
diff -p -r1.2 mipsread.c
*** mipsread.c	2000/05/04 16:52:33	1.2
--- mipsread.c	2000/05/16 03:58:57
*************** mipscoff_symfile_read (objfile, mainline
*** 94,100 ****
    struct cleanup *back_to;
  
    init_minimal_symbol_collection ();
!   back_to = make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
  
    /* Now that the executable file is positioned at symbol table,
       process it and define symbols accordingly.  */
--- 94,100 ----
    struct cleanup *back_to;
  
    init_minimal_symbol_collection ();
!   back_to = make_cleanup_discard_minimal_symbols ();
  
    /* Now that the executable file is positioned at symbol table,
       process it and define symbols accordingly.  */
Index: nlmread.c
===================================================================
RCS file: /cvs/src/src/gdb/nlmread.c,v
retrieving revision 1.1.1.4
diff -p -r1.1.1.4 nlmread.c
*** nlmread.c	1999/08/09 21:33:43	1.1.1.4
--- nlmread.c	2000/05/16 03:58:57
*************** nlm_symfile_read (objfile, mainline)
*** 192,198 ****
    struct symbol *mainsym;
  
    init_minimal_symbol_collection ();
!   back_to = make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
  
    /* FIXME, should take a section_offsets param, not just an offset.  */
  
--- 192,198 ----
    struct symbol *mainsym;
  
    init_minimal_symbol_collection ();
!   back_to = make_cleanup_discard_minimal_symbols ();
  
    /* FIXME, should take a section_offsets param, not just an offset.  */
  
Index: os9kread.c
===================================================================
RCS file: /cvs/src/src/gdb/os9kread.c,v
retrieving revision 1.2
diff -p -r1.2 os9kread.c
*** os9kread.c	2000/05/04 16:52:33	1.2
--- os9kread.c	2000/05/16 03:59:01
*************** os9k_symfile_read (objfile, mainline)
*** 342,348 ****
    free_pending_blocks ();
    back_to = make_cleanup (really_free_pendings, 0);
  
!   make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
    read_minimal_symbols (objfile);
  
    /* Now that the symbol table data of the executable file are all in core,
--- 342,348 ----
    free_pending_blocks ();
    back_to = make_cleanup (really_free_pendings, 0);
  
!   make_cleanup_discard_minimal_symbols ();
    read_minimal_symbols (objfile);
  
    /* Now that the symbol table data of the executable file are all in core,
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.13
diff -p -r1.13 solib.c
*** solib.c	2000/05/11 00:36:17	1.13
--- solib.c	2000/05/16 03:59:05
*************** solib_add_common_symbols (rtc_symp)
*** 445,451 ****
      }
  
    init_minimal_symbol_collection ();
!   make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
  
    while (rtc_symp)
      {
--- 445,451 ----
      }
  
    init_minimal_symbol_collection ();
!   make_cleanup_discard_minimal_symbols ();
  
    while (rtc_symp)
      {
Index: somread.c
===================================================================
RCS file: /cvs/src/src/gdb/somread.c,v
retrieving revision 1.3
diff -p -r1.3 somread.c
*** somread.c	2000/05/04 16:52:34	1.3
--- somread.c	2000/05/16 03:59:07
*************** som_symfile_read (objfile, mainline)
*** 366,372 ****
    do_pxdb (symfile_bfd_open (objfile->name));
  
    init_minimal_symbol_collection ();
!   back_to = make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
  
    /* Read in the import list and the export list.  Currently
       the export list isn't used; the import list is used in
--- 366,372 ----
    do_pxdb (symfile_bfd_open (objfile->name));
  
    init_minimal_symbol_collection ();
!   back_to = make_cleanup_discard_minimal_symbols ();
  
    /* Read in the import list and the export list.  Currently
       the export list isn't used; the import list is used in
Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.6
diff -p -r1.6 symtab.h
*** symtab.h	2000/04/03 04:47:27	1.6
--- symtab.h	2000/05/16 03:59:12
*************** extern CORE_ADDR
*** 1267,1274 ****
  extern void
  init_minimal_symbol_collection PARAMS ((void));
  
! extern void
! discard_minimal_symbols PARAMS ((int));
  
  extern void
  install_minimal_symbols PARAMS ((struct objfile *));
--- 1267,1273 ----
  extern void
  init_minimal_symbol_collection PARAMS ((void));
  
! extern struct cleanup *make_cleanup_discard_minimal_symbols (void);
  
  extern void
  install_minimal_symbols PARAMS ((struct objfile *));
Index: xcoffread.c
===================================================================
RCS file: /cvs/src/src/gdb/xcoffread.c,v
retrieving revision 1.2
diff -p -r1.2 xcoffread.c
*** xcoffread.c	2000/05/04 16:52:34	1.2
--- xcoffread.c	2000/05/16 03:59:17
*************** xcoff_initial_scan (objfile, mainline)
*** 2746,2752 ****
    back_to = make_cleanup (really_free_pendings, 0);
  
    init_minimal_symbol_collection ();
!   make_cleanup ((make_cleanup_func) discard_minimal_symbols, 0);
  
    /* Now that the symbol table data of the executable file are all in core,
       process them and define symbols accordingly.  */
--- 2746,2752 ----
    back_to = make_cleanup (really_free_pendings, 0);
  
    init_minimal_symbol_collection ();
!   make_cleanup_discard_minimal_symbols ();
  
    /* Now that the symbol table data of the executable file are all in core,
       process them and define symbols accordingly.  */


More information about the Gdb-patches mailing list