Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tristan Gingold <gingold@adacore.com>
To: gdb-patches ml <gdb-patches@sourceware.org>
Subject: [RFA] clean-up for sym_read mainline flag (2/2)
Date: Fri, 27 Nov 2009 10:22:00 -0000	[thread overview]
Message-ID: <C4E7DCFA-F1B1-4C07-95D6-2D51189B8E58@adacore.com> (raw)

Hi,

dwarf_build_psymtabs is always called with mainline=0 (it was not in
machoread.c but a tiny change fixed that).
As a consequence, this parameter can be removed.

No regression on linux x86-64.

(More to follow...)

Tristan.

2009-11-26  Tristan Gingold  <gingold@adacore.com>

	* symfile.h (dwarf2_build_psymtabs): Remove mainline parameter in
	prototype.
	* dwarf2read.c (dwarf2_build_psymtabs): Remove mainline paramter in
	definition, simplify code assuming it is always 0.
	* coffread.c (coff_symfile_read): Adjust call.
	* elfread.c (elf_symfile_read): Ditto.
	* machoread.c (macho_symfile_read): Explicitely calls
	init_psymbol_list if mainline is set.

diff --git a/gdb/coffread.c b/gdb/coffread.c
index d66312b..84edfc5 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -641,7 +641,7 @@ coff_symfile_read (struct objfile *objfile, int mainline)
   if (dwarf2_has_info (objfile))
     {
       /* DWARF2 sections.  */
-      dwarf2_build_psymtabs (objfile, mainline);
+      dwarf2_build_psymtabs (objfile);
     }
 
   dwarf2_build_frame_info (objfile);
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 0fa63a5..a92d923 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1448,7 +1448,7 @@ dwarf2_get_section_info (struct objfile *objfile, const char *section_name,
 /* Build a partial symbol table.  */
 
 void
-dwarf2_build_psymtabs (struct objfile *objfile, int mainline)
+dwarf2_build_psymtabs (struct objfile *objfile)
 {
   dwarf2_read_section (objfile, &dwarf2_per_objfile->info);
   dwarf2_read_section (objfile, &dwarf2_per_objfile->abbrev);
@@ -1461,9 +1461,7 @@ dwarf2_build_psymtabs (struct objfile *objfile, int mainline)
   dwarf2_read_section (objfile, &dwarf2_per_objfile->eh_frame);
   dwarf2_read_section (objfile, &dwarf2_per_objfile->frame);
 
-  if (mainline
-      || (objfile->global_psymbols.size == 0
-	  && objfile->static_psymbols.size == 0))
+  if (objfile->global_psymbols.size == 0 && objfile->static_psymbols.size == 0)
     {
       init_psymbol_list (objfile, 1024);
     }
diff --git a/gdb/elfread.c b/gdb/elfread.c
index b9e1568..d143e63 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -743,7 +743,7 @@ elf_symfile_read (struct objfile *objfile, int mainline)
   if (dwarf2_has_info (objfile))
     {
       /* DWARF 2 sections */
-      dwarf2_build_psymtabs (objfile, mainline);
+      dwarf2_build_psymtabs (objfile);
     }
 
   /* FIXME: kettenis/20030504: This still needs to be integrated with
diff --git a/gdb/machoread.c b/gdb/machoread.c
index ebd90c6..5e0a658 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -649,10 +649,15 @@ 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 */
-      dwarf2_build_psymtabs (objfile, mainline);
+      dwarf2_build_psymtabs (objfile);
     }
 
   /* Do not try to read .eh_frame/.debug_frame as they are not relocated
diff --git a/gdb/symfile.h b/gdb/symfile.h
index f73d22d..40f7db7 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -380,7 +380,7 @@ void free_symfile_segment_data (struct symfile_segment_data *data);
 
 extern int dwarf2_has_info (struct objfile *);
 
-extern void dwarf2_build_psymtabs (struct objfile *, int);
+extern void dwarf2_build_psymtabs (struct objfile *);
 extern void dwarf2_build_frame_info (struct objfile *);
 
 void dwarf2_free_objfile (struct objfile *);
-- 
1.6.2



             reply	other threads:[~2009-11-27 10:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-27 10:22 Tristan Gingold [this message]
2009-11-30 20:20 ` Tom Tromey
2009-12-02 11:45   ` Tristan Gingold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C4E7DCFA-F1B1-4C07-95D6-2D51189B8E58@adacore.com \
    --to=gingold@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox