diff options
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/linespec.c | 18 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/break.exp | 12 |
4 files changed, 40 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5ed465f..3691ba3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2013-08-12 Ali Anwar <ali_anwar@codesourcery.com> + + PR breakpoints/15117 + * linespec.c (linespec_parse_basic): Check for convenience + variable or history value while parsing. + 2013-08-12 Sergio Durigan Junior <sergiodj@redhat.com> Revert implementation of gdbarch_gdb_signal_{to,from}_target for 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 diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 7a43b73..5d7e29d 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-08-12 Ali Anwar <alianwar@codesourcery.com> + + * gdb.base/break.exp: Test break via convenience variable + with file name. + 2013-08-09 Doug Evans <dje@google.com> * lib/future.exp (gdb_find_ldd): New proc. diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index d5ce29b..2221407 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -957,6 +957,18 @@ gdb_expect { } } +# +# Test break via convenience variable with file name +# +set line [gdb_get_line_number "set breakpoint 1 here"] +gdb_test_no_output "set \$l = $line" +gdb_breakpoint ${srcfile}:\$l + +gdb_test_no_output "set \$foo=81.5" \ + "set convenience variable \$foo to 81.5" +gdb_test "break $srcfile:\$foo" \ + "Convenience variables used in line specs must have integer values.*" \ + "set breakpoint via non-integer convenience variable disallowed" # Reset the default arguments for VxWorks if [istarget "*-*-vxworks*"] { |