]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2002-11-15 David Carlton <carlton@math.stanford.edu>
authorDavid Carlton <carlton@bactrian.org>
Sat, 16 Nov 2002 00:16:57 +0000 (00:16 +0000)
committerDavid Carlton <carlton@bactrian.org>
Sat, 16 Nov 2002 00:16:57 +0000 (00:16 +0000)
* symtab.c (lookup_symbol_aux): Get at static block via
block_static_block.
(lookup_symbol_aux_local): Delete static_block argument, and use
block_static_block.
* block.h: Declare block_static_block.
* block.c (block_static_block): New function.
* linespec.c (decode_all_digits): Move up definition of
need_canonical.

gdb/ChangeLog
gdb/block.c
gdb/block.h
gdb/linespec.c
gdb/symtab.c

index d71c08878578ee7555701a8886c6b432c25b6576..e4540a172e18ed6affabf104789c95be9de9467f 100644 (file)
@@ -1,5 +1,14 @@
 2002-11-15  David Carlton  <carlton@math.stanford.edu>
 
+       * symtab.c (lookup_symbol_aux): Get at static block via
+       block_static_block.
+       (lookup_symbol_aux_local): Delete static_block argument, and use
+       block_static_block.
+       * block.h: Declare block_static_block.
+       * block.c (block_static_block): New function.
+       * linespec.c (decode_all_digits): Move up definition of
+       need_canonical.
+
        * Merge from mainline; tag is carlton_dictionary-20021115-merge.
 
 2002-11-14  Andrew Cagney  <ac131313@redhat.com>
index 7becf2e9f94b9197bc49898437dd33cb6cb039ac..2566a4ab8aa5895891ba87372032d9c26c67ce99 100644 (file)
@@ -140,3 +140,18 @@ block_initialize_namespace (struct block *block, struct obstack *obstack)
       BLOCK_NAMESPACE (block)->using = NULL;
     }
 }
+
+/* Return the static block associated to BLOCK.  Return NULL if block
+   is NULL or if block is a global block.  */
+
+const struct block *
+block_static_block (const struct block *block)
+{
+  if (block == NULL || BLOCK_SUPERBLOCK (block) == NULL)
+    return NULL;
+
+  while (BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) != NULL)
+    block = BLOCK_SUPERBLOCK (block);
+
+  return block;
+}
index d0700c1fb616bfc89f1d29ffdcebecb35cf7982a..1848b6b55beeac1b2225a658127cb75f116046fd 100644 (file)
@@ -149,3 +149,5 @@ extern const char *block_scope (const struct block *block);
 
 extern void block_set_scope (struct block *block, const char *scope,
                             struct obstack *obstack);
+
+extern const struct block *block_static_block (const struct block *block);
index df1d1b36d5793a9d580d8fb81f1eb9a3efd33df6..4b0af38ceb920853301c0bea85e5620c8f02f07e 100644 (file)
@@ -1324,11 +1324,11 @@ decode_all_digits (char **argptr, struct symtab *default_symtab,
     }
   sign = none;
 
-  init_sal (&val);
-
   /* We might need a canonical line spec if no file was specified.  */
   int need_canonical = (file_symtab == NULL) ? 1 : 0;
 
+  init_sal (&val);
+
   /* This is where we need to make sure that we have good defaults.
      We must guarantee that this section of code is never executed
      when we are called with just a function name, since
index e267190a48c466e7d671db92f18d3e440140eff5..c465506f254987fa7086af2ef2b703f9fc1109a5 100644 (file)
@@ -92,8 +92,7 @@ struct symbol *lookup_symbol_aux_local (const char *name,
                                        const char *mangled_name,
                                        const struct block *block,
                                        const namespace_enum namespace,
-                                       struct symtab **symtab,
-                                       const struct block **static_block);
+                                       struct symtab **symtab);
 
 static
 struct symbol *lookup_symbol_aux_block (const char *name,
@@ -840,7 +839,7 @@ lookup_symbol_aux (const char *name, const char *mangled_name,
      STATIC_BLOCK or GLOBAL_BLOCK.  */
 
   sym = lookup_symbol_aux_local (name, mangled_name, block, namespace,
-                                symtab, &static_block);
+                                symtab);
   if (sym != NULL)
     return sym;
 
@@ -921,6 +920,8 @@ lookup_symbol_aux (const char *name, const char *mangled_name,
      seems best: it's cleanest, it's correct, and it might be useful
      for handling namespace scope issues completely correctly.  */
 
+  static_block = block_static_block (block);
+
   if (static_block != NULL)
     {
       sym = lookup_symbol_aux_block (name, mangled_name, static_block,
@@ -976,20 +977,17 @@ static struct symbol *
 lookup_symbol_aux_local (const char *name, const char *mangled_name,
                         const struct block *block,
                         const namespace_enum namespace,
-                        struct symtab **symtab,
-                        const struct block **static_block)
+                        struct symtab **symtab)
 {
   struct symbol *sym;
+  const struct block *static_block = block_static_block (block);
 
   /* Either no block is specified or it's a global block.  */
 
-  if (block == NULL || BLOCK_SUPERBLOCK (block) == NULL)
-    {
-      *static_block = NULL;
-      return NULL;
-    }
+  if (static_block == NULL)
+    return NULL;
 
-  while (BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) != NULL)
+  while (block != static_block)
     {
       sym = lookup_symbol_aux_block (name, mangled_name, block, namespace,
                                     symtab);
@@ -998,9 +996,8 @@ lookup_symbol_aux_local (const char *name, const char *mangled_name,
       block = BLOCK_SUPERBLOCK (block);
     }
 
-  /* We've reached the static block.  */
+  /* We've reached the static block without finding a result.  */
 
-  *static_block = block;
   return NULL;
 }