public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-tromey-ambiguous-linespec: lazily resolve the default symtab this lets us check for the "no-file" case more simply
@ 2011-08-01 15:13 tromey
  0 siblings, 0 replies; only message in thread
From: tromey @ 2011-08-01 15:13 UTC (permalink / raw)
  To: archer-commits

The branch, archer-tromey-ambiguous-linespec has been updated
       via  f3ae1cef514b61e36a377157017115a7f292e6dd (commit)
      from  2b3ef167d511e1874e37fc6311b49014838713ec (commit)

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

- Log -----------------------------------------------------------------
commit f3ae1cef514b61e36a377157017115a7f292e6dd
Author: Tom Tromey <tromey@redhat.com>
Date:   Mon Aug 1 09:13:18 2011 -0600

    lazily resolve the default symtab
    this lets us check for the "no-file" case more simply

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

Summary of changes:
 gdb/linespec.c |   31 +++++++++++++++++++++++++++++--
 1 files changed, 29 insertions(+), 2 deletions(-)

First 500 lines of diff:
diff --git a/gdb/linespec.c b/gdb/linespec.c
index b62440c..fec965a 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -149,6 +149,20 @@ static struct
 symtabs_and_lines minsym_found (int funfirstline,
 				struct minimal_symbol *msymbol);
 
+
+/* The global default symtab; this is assigned when entering linespec
+   and valid only for the duration of the call.  */
+
+static struct symtab *global_default_symtab;
+
+/* Fix up SYMTAB depending on whether it is the global default.  */
+
+static struct symtab *
+maybe_use_global_symtab (struct symtab *s)
+{
+  return s == NULL ? global_default_symtab : s;
+}
+
 /* Helper functions.  */
 
 static void
@@ -893,8 +907,12 @@ decode_line_internal (char **argptr, int funfirstline,
       file_symtabs = symtab_from_filename (argptr, p, is_quote_enclosed);
     }
 
+  global_default_symtab = default_symtab;
   if (VEC_empty (symtab_p, file_symtabs))
-    VEC_safe_push (symtab_p, file_symtabs, default_symtab);
+    {
+      /* A NULL entry means to use GLOBAL_DEFAULT_SYMTAB.  */
+      VEC_safe_push (symtab_p, file_symtabs, NULL);
+    }
   make_cleanup (VEC_cleanup (symtab_p), &file_symtabs);
 
   if (file_exception.reason >= 0)
@@ -1072,7 +1090,8 @@ decode_line_internal (char **argptr, int funfirstline,
   /* Try the token as a label, but only if no file was specified,
      because we can only really find labels in the current scope.  */
 
-  if (!file_symtabs)
+  if (VEC_length (symtab_p, file_symtabs) == 1
+      && VEC_index (symtab_p, file_symtabs, 0) == NULL)
     {
       struct symtabs_and_lines label_result;
       if (decode_label (function_symbol, copy, canonical, &label_result))
@@ -2074,6 +2093,10 @@ decode_all_digits (char **argptr,
       CORE_ADDR pc;
       VEC (CORE_ADDR) *pcs;
 
+      /* Note that we don't need to call maybe_use_global_symtab here,
+	 due to the logic above.  */
+      gdb_assert (elt != NULL);
+
       pcs = find_pcs_for_symtab_line (elt, val.line);
       if (pcs == NULL)
 	continue;
@@ -2164,6 +2187,8 @@ decode_dollar (char *copy, int funfirstline,
 
   for (ix = 0; VEC_iterate (symtab_p, file_symtabs, ix, elt); ++ix)
     {
+      elt = maybe_use_global_symtab (elt);
+
       /* Either history value or convenience value from above, in valx.  */
       val.symtab = elt;
       val.line = valx;
@@ -2241,6 +2266,8 @@ decode_variable (char *copy, int funfirstline,
     {
       struct symbol *sym;
 
+      elt = maybe_use_global_symtab (elt);
+
       sym = lookup_symbol (copy, get_search_block (elt), VAR_DOMAIN, 0);
       if (sym != NULL)
 	{


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


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

only message in thread, other threads:[~2011-08-01 15:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-01 15:13 [SCM] archer-tromey-ambiguous-linespec: lazily resolve the default symtab this lets us check for the "no-file" case more simply 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).