aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2011-03-25 17:13:12 +0000
committerTom Tromey <tromey@redhat.com>2011-03-25 17:13:12 +0000
commit628534583be570e855e7bbce00b7d5e2454d3676 (patch)
tree80d58933870e92f09103987051a1cf6991af56f0
parent68187828c0f44ea96953d5c79906cf438c701169 (diff)
downloadgdb-628534583be570e855e7bbce00b7d5e2454d3676.zip
gdb-628534583be570e855e7bbce00b7d5e2454d3676.tar.gz
gdb-628534583be570e855e7bbce00b7d5e2454d3676.tar.bz2
* linespec.c (symbol_found): Restore line-based result for
non-LOC_LABEL symbols.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/linespec.c18
2 files changed, 20 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 116b75a..917d493 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-25 Tom Tromey <tromey@redhat.com>
+
+ * linespec.c (symbol_found): Restore line-based result for
+ non-LOC_LABEL symbols.
+
2011-03-25 Kai Tietz <ktietz@redhat.com>
* tui/tui-source.c (tui_set_source_content): Use filename_cmp
diff --git a/gdb/linespec.c b/gdb/linespec.c
index d079ae0..70df3ca 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -2174,9 +2174,7 @@ symbol_found (int funfirstline, struct linespec_result *canonical, char *copy,
}
else
{
- if (funfirstline && SYMBOL_CLASS (sym) != LOC_LABEL)
- error (_("\"%s\" is not a function"), copy);
- else if (SYMBOL_VALUE_ADDRESS (sym) != 0)
+ if (SYMBOL_CLASS (sym) == LOC_LABEL && SYMBOL_VALUE_ADDRESS (sym) != 0)
{
/* We know its line number. */
values.sals = (struct symtab_and_line *)
@@ -2201,6 +2199,20 @@ symbol_found (int funfirstline, struct linespec_result *canonical, char *copy,
return values;
}
+ else if (funfirstline)
+ error (_("\"%s\" is not a function"), copy);
+ else if (SYMBOL_LINE (sym) != 0)
+ {
+ /* We know its line number. */
+ values.sals = (struct symtab_and_line *)
+ xmalloc (sizeof (struct symtab_and_line));
+ values.nelts = 1;
+ memset (&values.sals[0], 0, sizeof (values.sals[0]));
+ values.sals[0].symtab = SYMBOL_SYMTAB (sym);
+ values.sals[0].line = SYMBOL_LINE (sym);
+ values.sals[0].pspace = SYMTAB_PSPACE (SYMBOL_SYMTAB (sym));
+ return values;
+ }
else
/* This can happen if it is compiled with a compiler which doesn't
put out line numbers for variables. */