Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Remove useless init_psymbol_list calls.
@ 2009-12-04 11:53 Tristan Gingold
  2009-12-04 16:54 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Tristan Gingold @ 2009-12-04 11:53 UTC (permalink / raw)
  To: gdb-patches

Hi,

When sym_read method is called with mainline == 1, the psymtab is already
empty:
sym_read is called from:
* symfile.c:reread_symbols.  But the psymtab is already cleared and
  it is called with mainline == 0.
* symfile.c:syms_from_objfile, which is called from:
  * rs6000-nat.c:objfile_symbol_add  but called with mainline == 0.
  * symfile.c:symbol_file_add_with_addrs_or_offsets which allocates a new
    objfile so the psymtab is empty.

Tristan.

2009-12-02  Tristan Gingold  <gingold@adacore.com>

	* dbxread.c (dbx_symfile_read): No need to test mainline to call
	init_psymbol_list.
	* xcoffread.c (xcoff_initial_scan): Ditto;
	* coffread.c (coff_symfile_read): Remove call to init_psymbol_list.
	* elfread.c (elf_symfile_read): Ditto.
	* machoread.c (macho_symfile_read): Ditto.
---
 gdb/coffread.c  |    9 ---------
 gdb/dbxread.c   |    6 ++----
 gdb/elfread.c   |    9 ---------
 gdb/machoread.c |    5 -----
 gdb/xcoffread.c |    4 +---
 5 files changed, 3 insertions(+), 30 deletions(-)

diff --git a/gdb/coffread.c b/gdb/coffread.c
index 84edfc5..1f71db2 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -607,15 +607,6 @@ coff_symfile_read (struct objfile *objfile, int mainline)
   /* Free the installed minimal symbol data.  */
   do_cleanups (cleanup_minimal_symbols);
 
-  /* If we are reinitializing, or if we have not loaded syms yet,
-     empty the psymtab.  "mainline" is cleared so the *_read_psymtab
-     functions do not all re-initialize it.  */
-  if (mainline)
-    {
-      init_psymbol_list (objfile, 0);
-      mainline = 0;
-    }
-
   bfd_map_over_sections (abfd, coff_locate_sections, (void *) info);
 
   if (info->stabsects)
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index aad25b7..3efaa65 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -556,10 +556,8 @@ dbx_symfile_read (struct objfile *objfile, int mainline)
   if (val < 0)
     perror_with_name (objfile->name);
 
-  /* If we are reinitializing, or if we have never loaded syms yet, init */
-  if (mainline
-      || (objfile->global_psymbols.size == 0
-	  &&  objfile->static_psymbols.size == 0))
+  /* Size the symbol table.  */
+  if (objfile->global_psymbols.size == 0 && objfile->static_psymbols.size == 0)
     init_psymbol_list (objfile, DBX_SYMCOUNT (objfile));
 
   symbol_size = DBX_SYMBOL_SIZE (objfile);
diff --git a/gdb/elfread.c b/gdb/elfread.c
index d143e63..f9052c1 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -691,15 +691,6 @@ elf_symfile_read (struct objfile *objfile, int mainline)
   /* Now process debugging information, which is contained in
      special ELF sections. */
 
-  /* If we are reinitializing, or if we have never loaded syms yet,
-     set table to empty.  MAINLINE is cleared so that *_read_psymtab
-     functions do not all also re-initialize the psymbol table. */
-  if (mainline)
-    {
-      init_psymbol_list (objfile, 0);
-      mainline = 0;
-    }
-
   /* We first have to find them... */
   bfd_map_over_sections (abfd, elf_locate_sections, (void *) & ei);
 
diff --git a/gdb/machoread.c b/gdb/machoread.c
index 5e0a658..081027f 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -649,11 +649,6 @@ macho_symfile_read (struct objfile *objfile, int mainline)
 	}
     }
 
-  /* If we are reinitializing, or if we have never loaded syms yet,
-     set table to empty.  */
-  if (mainline)
-    init_psymbol_list (objfile, 0);
-
   if (dwarf2_has_info (objfile))
     {
       /* DWARF 2 sections */
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index a93fbd2..35d8f1d 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -2948,9 +2948,7 @@ xcoff_initial_scan (struct objfile *objfile, int mainline)
     perror_with_name (_("reading symbol table"));
 
   /* If we are reinitializing, or if we have never loaded syms yet, init */
-  if (mainline
-      || (objfile->global_psymbols.size == 0
-	  && objfile->static_psymbols.size == 0))
+  if (objfile->global_psymbols.size == 0 && objfile->static_psymbols.size == 0)
     /* I'm not sure how how good num_symbols is; the rule of thumb in
        init_psymbol_list was developed for a.out.  On the one hand,
        num_symbols includes auxents.  On the other hand, it doesn't
-- 
1.6.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA] Remove useless init_psymbol_list calls.
  2009-12-04 11:53 [RFA] Remove useless init_psymbol_list calls Tristan Gingold
@ 2009-12-04 16:54 ` Tom Tromey
  2009-12-07  9:37   ` Tristan Gingold
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2009-12-04 16:54 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: gdb-patches

>>>>> "Tristan" == Tristan Gingold <gingold@adacore.com> writes:

Tristan> 2009-12-02  Tristan Gingold  <gingold@adacore.com>
Tristan> 	* dbxread.c (dbx_symfile_read): No need to test mainline to call
Tristan> 	init_psymbol_list.
Tristan> 	* xcoffread.c (xcoff_initial_scan): Ditto;
Tristan> 	* coffread.c (coff_symfile_read): Remove call to init_psymbol_list.
Tristan> 	* elfread.c (elf_symfile_read): Ditto.
Tristan> 	* machoread.c (macho_symfile_read): Ditto.

Ok.

Tom


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA] Remove useless init_psymbol_list calls.
  2009-12-04 16:54 ` Tom Tromey
@ 2009-12-07  9:37   ` Tristan Gingold
  0 siblings, 0 replies; 3+ messages in thread
From: Tristan Gingold @ 2009-12-07  9:37 UTC (permalink / raw)
  To: tromey; +Cc: gdb-patches


On Dec 4, 2009, at 5:53 PM, Tom Tromey wrote:

>>>>>> "Tristan" == Tristan Gingold <gingold@adacore.com> writes:
> 
> Tristan> 2009-12-02  Tristan Gingold  <gingold@adacore.com>
> Tristan> 	* dbxread.c (dbx_symfile_read): No need to test mainline to call
> Tristan> 	init_psymbol_list.
> Tristan> 	* xcoffread.c (xcoff_initial_scan): Ditto;
> Tristan> 	* coffread.c (coff_symfile_read): Remove call to init_psymbol_list.
> Tristan> 	* elfread.c (elf_symfile_read): Ditto.
> Tristan> 	* machoread.c (macho_symfile_read): Ditto.
> 
> Ok.

Thanks, committed.

Tristan.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-12-07  9:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-04 11:53 [RFA] Remove useless init_psymbol_list calls Tristan Gingold
2009-12-04 16:54 ` Tom Tromey
2009-12-07  9:37   ` Tristan Gingold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox