Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Don't check PST is NULL in read_symtab
Date: Fri, 11 Jan 2013 14:46:00 -0000	[thread overview]
Message-ID: <50F025B5.2060203@codesourcery.com> (raw)
In-Reply-To: <20130111045233.GK6143@adacore.com>

On 01/11/2013 12:52 PM, Joel Brobecker wrote:
> FWIW, you can also do the re-indent, and then post two parallel
> patches: One is the actual patch, the second is a sub-part of
> the actual patch where whitespace differences are ignored.
> That's usually how I verify that my reformatting did not cause
> any intentional changes...

I see.  Below is the patch to indent the code.  Thanks for your
suggestion, Joel.

> 
>> >2013-01-11  Yao Qi<yao@codesourcery.com>
>> >
>> >	* dbxread.c (dbx_psymtab_to_symtab_1): Don't check PST is NULL.
>> >	* dwarf2read.c (dwarf2_psymtab_to_symtab): Likewise.
>> >	* mdebugread.c (mdebug_psymtab_to_symtab): Likewise.
>> >	* xcoffread.c (xcoff_psymtab_to_symtab_1): Likewise.
> If PST must not be NULL, I think that it should be documented in
> psympriv.h. I am also wondering whether an assertion would be
> useful or not; maybe not, just thinking out loud.
> 

IMO, we don't need an assertion to check PST, because the function is
used in this way,

  (*pst->read_symtab) (objfile, pst);

which guarantees PST cant' be NULL.  "PST" here is analogous to "this"
object in C++, and we don't have to document function read_symtab that
"this object must not be NULL".

-- 
Yao (齐尧)

gdb:

2013-01-11  Yao Qi  <yao@codesourcery.com>

	* dwarf2read.c (dwarf2_psymtab_to_symtab): Code indent.
---
 gdb/dwarf2read.c |   62 +++++++++++++++++++++++++++---------------------------
 1 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index f2d6a0a..2cefee9 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -6410,45 +6410,45 @@ locate_pdi_sibling (const struct die_reader_specs *reader,
 static void
 dwarf2_psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
 {
-      if (pst->readin)
+  if (pst->readin)
+    {
+      warning (_("bug: psymtab for %s is already read in."),
+	       pst->filename);
+    }
+  else
+    {
+      if (info_verbose)
 	{
-	  warning (_("bug: psymtab for %s is already read in."),
-		   pst->filename);
+	  printf_filtered (_("Reading in symbols for %s..."),
+			   pst->filename);
+	  gdb_flush (gdb_stdout);
 	}
-      else
-	{
-	  if (info_verbose)
-	    {
-	      printf_filtered (_("Reading in symbols for %s..."),
-			       pst->filename);
-	      gdb_flush (gdb_stdout);
-	    }
 
-	  /* Restore our global data.  */
-	  dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key);
+      /* Restore our global data.  */
+      dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key);
 
-	  /* If this psymtab is constructed from a debug-only objfile, the
-	     has_section_at_zero flag will not necessarily be correct.  We
-	     can get the correct value for this flag by looking at the data
-	     associated with the (presumably stripped) associated objfile.  */
-	  if (objfile->separate_debug_objfile_backlink)
-	    {
-	      struct dwarf2_per_objfile *dpo_backlink
-	        = objfile_data (objfile->separate_debug_objfile_backlink,
-		                dwarf2_objfile_data_key);
+      /* If this psymtab is constructed from a debug-only objfile, the
+	 has_section_at_zero flag will not necessarily be correct.  We
+	 can get the correct value for this flag by looking at the data
+	 associated with the (presumably stripped) associated objfile.  */
+      if (objfile->separate_debug_objfile_backlink)
+	{
+	  struct dwarf2_per_objfile *dpo_backlink
+	    = objfile_data (objfile->separate_debug_objfile_backlink,
+			    dwarf2_objfile_data_key);
 
-	      dwarf2_per_objfile->has_section_at_zero
-		= dpo_backlink->has_section_at_zero;
-	    }
+	  dwarf2_per_objfile->has_section_at_zero
+	    = dpo_backlink->has_section_at_zero;
+	}
 
-	  dwarf2_per_objfile->reading_partial_symbols = 0;
+      dwarf2_per_objfile->reading_partial_symbols = 0;
 
-	  psymtab_to_symtab_1 (pst);
+      psymtab_to_symtab_1 (pst);
 
-	  /* Finish up the debug error message.  */
-	  if (info_verbose)
-	    printf_filtered (_("done.\n"));
-	}
+      /* Finish up the debug error message.  */
+      if (info_verbose)
+	printf_filtered (_("done.\n"));
+    }
 
   process_cu_includes ();
 }
-- 
1.7.7.6


  parent reply	other threads:[~2013-01-11 14:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-11  1:57 Yao Qi
2013-01-11  4:52 ` Joel Brobecker
2013-01-11 14:34   ` Tom Tromey
2013-01-11 14:56     ` Yao Qi
2013-01-11 15:06       ` Tom Tromey
2013-01-14 12:42         ` [committed]: " Yao Qi
2013-01-14 12:44         ` Yao Qi
2013-01-11 14:46   ` Yao Qi [this message]
2013-01-11 15:06     ` Joel Brobecker
2013-01-11 18:02       ` Pedro Alves
2013-01-11 18:44         ` Joel Brobecker
2013-01-14 12:42           ` Yao Qi

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=50F025B5.2060203@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=brobecker@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