summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.linespec
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2012-10-11 16:12:05 +0000
committerDoug Evans <dje@google.com>2012-10-11 16:12:05 +0000
commit7c09e5a0f7f3612c42e52d90056f73167cdb4ae5 (patch)
tree84d508aa2a51b164fc6b52d3340b77ccaec0400c /gdb/testsuite/gdb.linespec
parent7b0e8ca5467cfa48726f30c6fe4227a9b5a9023e (diff)
PR breakpoints/14643.
* linespec.c (struct ls_parser): New member keyword_ok. (linespec_lexer_lex_string): Add comment. (linespec_lexer_lex_one): Ignore keywords if it's the wrong place for one. (parse_linespec): Set keyword_ok. testsuite/ * gdb.linespec/ls-errs.exp: Change tests of "b if|task|thread". * gdb.linespec/thread.c: New file. * gdb.linespec/thread.exp: New file.
Diffstat (limited to 'gdb/testsuite/gdb.linespec')
-rw-r--r--gdb/testsuite/gdb.linespec/ls-errs.exp2
-rw-r--r--gdb/testsuite/gdb.linespec/thread.c31
-rw-r--r--gdb/testsuite/gdb.linespec/thread.exp41
3 files changed, 73 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.linespec/ls-errs.exp b/gdb/testsuite/gdb.linespec/ls-errs.exp
index 5668397a3b..7ee2623a9f 100644
--- a/gdb/testsuite/gdb.linespec/ls-errs.exp
+++ b/gdb/testsuite/gdb.linespec/ls-errs.exp
@@ -171,7 +171,7 @@ foreach x {"3" "+100" "-100" "foo"} {
}
foreach x {"if" "task" "thread"} {
- add the_tests $x unexpected_opt "keyword" $x
+ add the_tests $x invalid_function $x
}
add the_tests "'main.c'flubber" unexpected_opt "string" "flubber"
diff --git a/gdb/testsuite/gdb.linespec/thread.c b/gdb/testsuite/gdb.linespec/thread.c
new file mode 100644
index 0000000000..185e4a378e
--- /dev/null
+++ b/gdb/testsuite/gdb.linespec/thread.c
@@ -0,0 +1,31 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2012 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* http://sourceware.org/bugzilla/show_bug.cgi?id=14643 */
+
+static void
+thread ()
+{
+}
+
+int
+main ()
+{
+ int x = 0;
+ thread (); /* set breakpoint 1 here */
+ return x;
+}
diff --git a/gdb/testsuite/gdb.linespec/thread.exp b/gdb/testsuite/gdb.linespec/thread.exp
new file mode 100644
index 0000000000..1e8ee465a3
--- /dev/null
+++ b/gdb/testsuite/gdb.linespec/thread.exp
@@ -0,0 +1,41 @@
+# Copyright 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# http://sourceware.org/bugzilla/show_bug.cgi?id=14643
+# gdb 7.5 thinks "thread" is a linespec keyword.
+
+standard_testfile
+set exefile $testfile
+
+if {[prepare_for_testing $testfile $exefile $srcfile {debug}]} {
+ return -1
+}
+
+if ![runto_main] {
+ fail "Can't run to main"
+ return 0
+}
+
+set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
+
+gdb_test "break $srcfile:$bp_location1" \
+ "Breakpoint.*at.* file .*$srcfile, line $bp_location1\\." \
+ "breakpoint line number in file"
+
+gdb_continue_to_breakpoint "$bp_location1"
+
+gdb_breakpoint "thread" "message"
+
+gdb_continue_to_breakpoint "thread function"