aboutsummaryrefslogtreecommitdiff
path: root/gdb/linespec.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/linespec.c')
-rw-r--r--gdb/linespec.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 019a9f8..45d7817 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -1646,7 +1646,7 @@ linespec_parse_basic (linespec_parser *parser)
else
{
/* NAME was not a function or a method. So it must be a label
- name. */
+ name or user specified variable like "break foo.c:$zippo". */
labels = find_label_symbols (PARSER_STATE (parser), NULL,
&symbols, name);
if (labels != NULL)
@@ -1657,6 +1657,22 @@ linespec_parse_basic (linespec_parser *parser)
symbols = NULL;
discard_cleanups (cleanup);
}
+ else if (token.type == LSTOKEN_STRING
+ && *LS_TOKEN_STOKEN (token).ptr == '$')
+ {
+ /* User specified a convenience variable or history value. */
+ PARSER_RESULT (parser)->line_offset
+ = linespec_parse_variable (PARSER_STATE (parser), name);
+
+ if (PARSER_RESULT (parser)->line_offset.sign == LINE_OFFSET_UNKNOWN)
+ {
+ /* The user-specified variable was not valid. Do not
+ throw an error here. parse_linespec will do it for us. */
+ PARSER_RESULT (parser)->function_name = name;
+ discard_cleanups (cleanup);
+ return;
+ }
+ }
else
{
/* The name is also not a label. Abort parsing. Do not throw