public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-tromey-ambiguous-linespec: restrict iteration to primary symtabs this makes "break parse_number" on gdb do the right thing -- we get 7 locations instead of hundreds
@ 2011-08-04 20:03 tromey
  0 siblings, 0 replies; only message in thread
From: tromey @ 2011-08-04 20:03 UTC (permalink / raw)
  To: archer-commits

The branch, archer-tromey-ambiguous-linespec has been updated
       via  d206ed2de18262f33ad07d94c1240f0e323312d5 (commit)
       via  44d3982fc52fc5ba4c4e54cc6b2c400262a4a8f1 (commit)
       via  94b11fadbd8524420112cfa0596635dda6f04137 (commit)
      from  60c525337d9ee2b4afd457415a8586e9796b5120 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit d206ed2de18262f33ad07d94c1240f0e323312d5
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Aug 4 14:02:41 2011 -0600

    restrict iteration to primary symtabs
    this makes "break parse_number" on gdb do the right thing --
    we get 7 locations instead of hundreds

commit 44d3982fc52fc5ba4c4e54cc6b2c400262a4a8f1
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Aug 4 13:55:43 2011 -0600

    do not pass a sal by value

commit 94b11fadbd8524420112cfa0596635dda6f04137
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Aug 4 13:53:08 2011 -0600

    remove unused "die" argument from symbol_to_sal

-----------------------------------------------------------------------

Summary of changes:
 gdb/linespec.c |   41 +++++++++++++++--------------------------
 1 files changed, 15 insertions(+), 26 deletions(-)

First 500 lines of diff:
diff --git a/gdb/linespec.c b/gdb/linespec.c
index fc82ba4..de66383 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -154,7 +154,7 @@ static struct symtabs_and_lines decode_variable (struct linespec_state *self,
 
 static int symbol_to_sal (struct symtab_and_line *result,
 			  int funfirstline, char *copy,
-			  struct symbol *sym, int die);
+			  struct symbol *sym);
 
 static struct
 symtabs_and_lines symbol_found (int funfirstline,
@@ -172,11 +172,11 @@ symtabs_and_lines minsym_found (int funfirstline,
 /* Helper functions.  */
 
 static void
-add_sal_to_sals (struct symtabs_and_lines *sals, struct symtab_and_line sal)
+add_sal_to_sals (struct symtabs_and_lines *sals, struct symtab_and_line *sal)
 {
   ++sals->nelts;
   sals->sals = xrealloc (sals->sals, sals->nelts * sizeof (sals->sals[0]));
-  sals->sals[sals->nelts - 1] = sal;
+  sals->sals[sals->nelts - 1] = *sal;
 }
 
 /* Issue a helpful hint on using the command completion feature on
@@ -2163,7 +2163,7 @@ decode_all_digits (struct linespec_state *self,
 	  val.pc = pc;
 	  val.explicit_line = 1;
 
-	  add_sal_to_sals (&values, val);
+	  add_sal_to_sals (&values, &val);
 	}
 
       VEC_free (CORE_ADDR, pcs);
@@ -2250,7 +2250,7 @@ decode_dollar (struct linespec_state *self, char *copy)
       val.pc = 0;
       val.pspace = elt ? SYMTAB_PSPACE (elt) : current_program_space;
 
-      add_sal_to_sals (&values, val);
+      add_sal_to_sals (&values, &val);
     }
 
   if (need_canonical)
@@ -2314,8 +2314,8 @@ collect_symbols (struct symbol *sym, void *data)
   struct collect_info *info = data;
   struct symtab_and_line sal;
 
-  if (symbol_to_sal (&sal, info->funfirstline, info->initial_name, sym, 0))
-    add_sal_to_sals (&info->result, sal);
+  if (symbol_to_sal (&sal, info->funfirstline, info->initial_name, sym))
+    add_sal_to_sals (&info->result, &sal);
 
   return 1;
 }
@@ -2340,10 +2340,12 @@ iterate_over_all_matching_symtabs (const char *name,
 
     ALL_OBJFILE_SYMTABS (objfile, symtab)
       {
-	struct block *block;
-
-	block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK);
-	iterate_over_symbols (block, name, domain, callback, data);
+	if (symtab->primary)
+	  {
+	    struct block *block;
+	    block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK);
+	    iterate_over_symbols (block, name, domain, callback, data);
+	  }
       }
   }
 }
@@ -2428,8 +2430,7 @@ decode_variable (struct linespec_state *self, char *copy)
 static int
 symbol_to_sal (struct symtab_and_line *result,
 	       int funfirstline, char *copy,
-	       struct symbol *sym,
-	       int die)
+	       struct symbol *sym)
 {
   if (SYMBOL_CLASS (sym) == LOC_BLOCK)
     {
@@ -2449,9 +2450,7 @@ symbol_to_sal (struct symtab_and_line *result,
 	}
       else if (funfirstline)
 	{
-	  if (die)
-	    error (_("\"%s\" is not a function"), copy);
-	  return 0;
+	  /* Nothing.  */
 	}
       else if (SYMBOL_LINE (sym) != 0)
 	{
@@ -2462,16 +2461,6 @@ symbol_to_sal (struct symtab_and_line *result,
 	  result->pspace = SYMTAB_PSPACE (SYMBOL_SYMTAB (sym));
 	  return 1;
 	}
-      else
-	{
-	  /* This can happen if it is compiled with a compiler which doesn't
-	     put out line numbers for variables.  */
-	  /* FIXME: Shouldn't we just set .line and .symtab to zero
-	     and return?  For example, "info line foo" could print
-	     the address.  */
-	  if (die)
-	    error (_("Line number not known for symbol \"%s\""), copy);
-	}
     }
 
   return 0;


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-08-04 20:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-04 20:03 [SCM] archer-tromey-ambiguous-linespec: restrict iteration to primary symtabs this makes "break parse_number" on gdb do the right thing -- we get 7 locations instead of hundreds tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).