aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Carlton <carlton@bactrian.org>2003-01-08 22:40:18 +0000
committerDavid Carlton <carlton@bactrian.org>2003-01-08 22:40:18 +0000
commitbca02a8a3a0a380439e57cd57abba4a9228f029a (patch)
tree1dc6df0b62e496bf302537f695ec86b64fe77bd4
parent3f234ef5cc8460cfd1bfef95cc8be526001f73dd (diff)
downloadgdb-bca02a8a3a0a380439e57cd57abba4a9228f029a.zip
gdb-bca02a8a3a0a380439e57cd57abba4a9228f029a.tar.gz
gdb-bca02a8a3a0a380439e57cd57abba4a9228f029a.tar.bz2
2003-01-08 David Carlton <carlton@math.stanford.edu>
* linespec.c (decode_line_1): Move code into decode_variable. (decode_variable): New function.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/linespec.c65
2 files changed, 47 insertions, 23 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7fc24a1..9541dcf 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2003-01-08 David Carlton <carlton@math.stanford.edu>
+
+ * linespec.c (decode_line_1): Move code into decode_variable.
+ (decode_variable): New function.
+
2003-01-08 Andrew Cagney <ac131313@redhat.com>
* mn10300-tdep.c (analyze_dummy_frame): Fix typo.
diff --git a/gdb/linespec.c b/gdb/linespec.c
index a6af5d7..942a5ac 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -87,6 +87,11 @@ static struct symtabs_and_lines decode_dollar (char *copy,
char ***canonical,
struct symtab *s);
+static struct symtabs_and_lines decode_variable (char *copy,
+ int funfirstline,
+ char ***canonical,
+ struct symtab *s);
+
static struct
symtabs_and_lines symbol_found (int funfirstline,
char ***canonical,
@@ -558,11 +563,6 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
char *q;
struct symtab *s = NULL;
- struct symbol *sym;
- /* The symtab that SYM was found in. */
- struct symtab *sym_symtab;
-
- struct minimal_symbol *msymbol;
char *copy;
/* This is NULL if there are no parens in *ARGPTR, or a pointer to
the closing parenthesis if there are parens. */
@@ -713,24 +713,7 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
/* Look up that token as a variable.
If file specified, use that file's per-file block to start with. */
- sym = lookup_symbol (copy,
- (s ? BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK)
- : get_selected_block (0)),
- VAR_NAMESPACE, 0, &sym_symtab);
-
- if (sym != NULL)
- return symbol_found (funfirstline, canonical, copy, sym, s, sym_symtab);
-
- msymbol = lookup_minimal_symbol (copy, NULL, NULL);
-
- if (msymbol != NULL)
- return minsym_found (funfirstline, msymbol);
-
- if (!have_full_symbols () &&
- !have_partial_symbols () && !have_minimal_symbols ())
- error ("No symbol table is loaded. Use the \"file\" command.");
-
- error ("Function \"%s\" not defined.", copy);
+ return decode_variable (copy, funfirstline, canonical, s);
}
@@ -1389,6 +1372,42 @@ decode_dollar (char *copy, int funfirstline, struct symtab *default_symtab,
+/* Decode a linespec that's a variable. If S is non-NULL,
+ look in that symtab's static variables first. */
+
+static struct symtabs_and_lines
+decode_variable (char *copy, int funfirstline, char ***canonical,
+ struct symtab *s)
+{
+ struct symbol *sym;
+ /* The symtab that SYM was found in. */
+ struct symtab *sym_symtab;
+
+ struct minimal_symbol *msymbol;
+
+ sym = lookup_symbol (copy,
+ (s ? BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK)
+ : get_selected_block (0)),
+ VAR_NAMESPACE, 0, &sym_symtab);
+
+ if (sym != NULL)
+ return symbol_found (funfirstline, canonical, copy, sym, s, sym_symtab);
+
+ msymbol = lookup_minimal_symbol (copy, NULL, NULL);
+
+ if (msymbol != NULL)
+ return minsym_found (funfirstline, msymbol);
+
+ if (!have_full_symbols () &&
+ !have_partial_symbols () && !have_minimal_symbols ())
+ error ("No symbol table is loaded. Use the \"file\" command.");
+
+ error ("Function \"%s\" not defined.", copy);
+}
+
+
+
+
/* Now come some functions that are called from multiple places within
decode_line_1. */