summaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog43
-rw-r--r--gdb/testsuite/Makefile.in2
-rwxr-xr-xgdb/testsuite/configure3
-rw-r--r--gdb/testsuite/configure.ac2
-rw-r--r--gdb/testsuite/gdb.ada/fullname_bp.exp23
-rw-r--r--gdb/testsuite/gdb.ada/homonym.exp21
-rw-r--r--gdb/testsuite/gdb.base/break.exp3
-rw-r--r--gdb/testsuite/gdb.base/list.exp2
-rw-r--r--gdb/testsuite/gdb.base/sepdebug.exp3
-rw-r--r--gdb/testsuite/gdb.base/solib-symbol.exp14
-rw-r--r--gdb/testsuite/gdb.base/solib-weak.exp9
-rw-r--r--gdb/testsuite/gdb.cp/mb-ctor.exp4
-rw-r--r--gdb/testsuite/gdb.cp/mb-inline.exp4
-rw-r--r--gdb/testsuite/gdb.cp/mb-templates.exp6
-rw-r--r--gdb/testsuite/gdb.cp/method2.exp2
-rw-r--r--gdb/testsuite/gdb.cp/ovldbreak.exp79
-rw-r--r--gdb/testsuite/gdb.cp/ovsrch.exp22
-rw-r--r--gdb/testsuite/gdb.cp/ovsrch.h4
-rw-r--r--gdb/testsuite/gdb.cp/ovsrch3.cc14
-rw-r--r--gdb/testsuite/gdb.cp/ovsrch4.cc14
-rw-r--r--gdb/testsuite/gdb.cp/re-set-overloaded.exp1
-rw-r--r--gdb/testsuite/gdb.cp/templates.exp30
-rw-r--r--gdb/testsuite/gdb.linespec/Makefile.in14
-rw-r--r--gdb/testsuite/gdb.linespec/base/one/thefile.cc20
-rw-r--r--gdb/testsuite/gdb.linespec/base/two/thefile.cc20
-rw-r--r--gdb/testsuite/gdb.linespec/body.h5
-rw-r--r--gdb/testsuite/gdb.linespec/linespec.exp117
-rw-r--r--gdb/testsuite/gdb.linespec/lspec.cc19
-rw-r--r--gdb/testsuite/gdb.linespec/lspec.h26
-rw-r--r--gdb/testsuite/gdb.objc/objcdecode.exp6
-rw-r--r--gdb/testsuite/gdb.trace/tracecmd.exp2
31 files changed, 434 insertions, 100 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 2033f121ceb..7626a06fd1c 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,46 @@
+2011-12-06 Joel Brobecker <brobecker@acacore.com>
+
+ * gdb.ada/fullname_bp.exp: Add tests for other valid linespecs
+ involving a fully qualified function name.
+
+2011-12-06 Tom Tromey <tromey@redhat.com>
+
+ * gdb.ada/homonym.exp: Add three breakpoint tests.
+
+2011-12-06 Tom Tromey <tromey@redhat.com>
+
+ * gdb.base/solib-weak.exp (do_test): Remove kfail.
+ * gdb.trace/tracecmd.exp: Disable pending breakpoints earlier.
+ * gdb.objc/objcdecode.exp: Update for output changes.
+ * gdb.linespec/linespec.exp: New file.
+ * gdb.linespec/lspec.cc: New file.
+ * gdb.linespec/lspec.h: New file.
+ * gdb.linespec/body.h: New file.
+ * gdb.linespec/base/two/thefile.cc: New file.
+ * gdb.linespec/base/one/thefile.cc: New file.
+ * gdb.linespec/Makefile.in: New file.
+ * gdb.cp/templates.exp (test_template_breakpoints): Update for
+ output changes.
+ * gdb.cp/re-set-overloaded.exp: Remove kfail.
+ * gdb.cp/ovldbreak.exp: Update for output changes. "all" test now
+ makes one breakpoint.
+ * gdb.cp/method2.exp (test_break): Update for output changes.
+ * gdb.cp/mb-templates.exp: Update for output changes.
+ * gdb.cp/mb-inline.exp: Update for output changes.
+ * gdb.cp/mb-ctor.exp: Update for output changes.
+ * gdb.cp/ovsrch.exp: Use fully-qualified names.
+ * gdb.base/solib-symbol.exp: Run to main later. Breakpoint now
+ has multiple matches.
+ * gdb.base/sepdebug.exp: Disable pending breakpoints. Update for
+ error message change.
+ * gdb.base/list.exp (test_list_filename_and_number): Update for
+ error message change.
+ * gdb.base/break.exp: Disable pending breakpoints. Update for
+ output changes.
+ * configure.ac: Add gdb.linespec.
+ * configure: Rebuild.
+ * Makefile.in (ALL_SUBDIRS): Add gdb.linespec.
+
2011-12-06 Ulrich Weigand <uweigand@de.ibm.com>
* gdb.base/callfuncs.exp (fetch_all_registers): Filter out read-only
diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in
index 8b22324ef29..d3c9cfc213a 100644
--- a/gdb/testsuite/Makefile.in
+++ b/gdb/testsuite/Makefile.in
@@ -35,7 +35,7 @@ SUBDIRS = @subdirs@
RPATH_ENVVAR = @RPATH_ENVVAR@
ALL_SUBDIRS = gdb.ada gdb.arch gdb.asm gdb.base gdb.cell gdb.cp gdb.disasm \
gdb.dwarf2 gdb.fortran gdb.gdb gdb.hp \
- gdb.java gdb.mi gdb.modula2 gdb.multi \
+ gdb.java gdb.linespec gdb.mi gdb.modula2 gdb.multi \
gdb.objc gdb.opencl gdb.opt gdb.pascal gdb.python gdb.server \
gdb.stabs gdb.reverse gdb.threads gdb.trace gdb.xml \
$(SUBDIRS)
diff --git a/gdb/testsuite/configure b/gdb/testsuite/configure
index 82206b32dd9..fb70b3df9bc 100755
--- a/gdb/testsuite/configure
+++ b/gdb/testsuite/configure
@@ -3448,7 +3448,7 @@ done
-ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
+ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -4166,6 +4166,7 @@ do
"gdb.hp/gdb.aCC/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.hp/gdb.aCC/Makefile" ;;
"gdb.hp/gdb.compat/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.hp/gdb.compat/Makefile" ;;
"gdb.hp/gdb.defects/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.hp/gdb.defects/Makefile" ;;
+ "gdb.linespec/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.linespec/Makefile" ;;
"gdb.mi/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.mi/Makefile" ;;
"gdb.modula2/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.modula2/Makefile" ;;
"gdb.multi/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.multi/Makefile" ;;
diff --git a/gdb/testsuite/configure.ac b/gdb/testsuite/configure.ac
index 8631442e481..121fd37597e 100644
--- a/gdb/testsuite/configure.ac
+++ b/gdb/testsuite/configure.ac
@@ -95,7 +95,7 @@ AC_OUTPUT([Makefile \
gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile \
gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile \
gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile \
- gdb.hp/gdb.defects/Makefile \
+ gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile \
gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile \
gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile \
gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile \
diff --git a/gdb/testsuite/gdb.ada/fullname_bp.exp b/gdb/testsuite/gdb.ada/fullname_bp.exp
index faf63b93991..0e4d32f0836 100644
--- a/gdb/testsuite/gdb.ada/fullname_bp.exp
+++ b/gdb/testsuite/gdb.ada/fullname_bp.exp
@@ -25,6 +25,9 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" }
return -1
}
+# Note: We restart the debugger before setting each breakpoint, because
+# we want to test the situation where the symtab for our breakpoint
+# has not been created yet.
clean_restart ${testfile}
# Break on "pck.hello" rather than just "hello" to make sure we trigger
@@ -32,3 +35,23 @@ clean_restart ${testfile}
gdb_test "break pck.hello" \
"Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*pck.adb, line \[0-9\]+."
+# Do the same, but this time using a linespec where the user also
+# provided a filename.
+
+clean_restart ${testfile}
+
+gdb_test "break pck.adb:pck.hello" \
+ "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*pck.adb, line \[0-9\]+."
+
+# Same scenarios as above, but with a function name that is spelled
+# with upper-case letters.
+
+clean_restart ${testfile}
+
+gdb_test "break Pck.Hello" \
+ "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*pck.adb, line \[0-9\]+."
+
+clean_restart ${testfile}
+
+gdb_test "break pck.adb:Pck.Hello" \
+ "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*pck.adb, line \[0-9\]+."
diff --git a/gdb/testsuite/gdb.ada/homonym.exp b/gdb/testsuite/gdb.ada/homonym.exp
index b5dff1b77a2..d56863312d9 100644
--- a/gdb/testsuite/gdb.ada/homonym.exp
+++ b/gdb/testsuite/gdb.ada/homonym.exp
@@ -31,6 +31,24 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" }
clean_restart ${testfile}
+
+# Do these tests before running, so we are operating in a known
+# environment.
+
+gdb_test "break Get_Value" \
+ "Breakpoint \[0-9\]+ at $hex: Get_Value. .2 locations." \
+ "set breakpoint at Get_Value"
+
+gdb_test "break homonym.adb:Get_Value" \
+ "Breakpoint \[0-9\]+ at $hex: homonym.adb:Get_Value. .2 locations." \
+ "set breakpoint at homonym.adb:Get_Value"
+
+gdb_test "break <homonym__get_value>" \
+ "Breakpoint \[0-9\]+ at $hex: <homonym__get_value>. .2 locations." \
+ "set breakpoint at <homonym__get_value>"
+
+delete_breakpoints
+
set bp_location [gdb_get_line_number "BREAK_1" ${testdir}/homonym.adb]
runto "homonym.adb:$bp_location"
@@ -86,6 +104,3 @@ gdb_test "ptype lcl" \
gdb_test "print lcl" \
"= 17" \
"print lcl at BREAK_2"
-
-
-
diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp
index 92fcc6937b2..c5885ba46d6 100644
--- a/gdb/testsuite/gdb.base/break.exp
+++ b/gdb/testsuite/gdb.base/break.exp
@@ -540,8 +540,9 @@ gdb_test_multiple "catch exec" "$name" {
# Verify that GDB responds gracefully when asked to set a breakpoint
# on a nonexistent source line.
#
+gdb_test_no_output "set breakpoint pending off"
gdb_test "break 999" \
- "No line 999 in file .*" \
+ "No line 999 in the current file." \
"break on non-existent source line"
# Run to the desired default location. If not positioned here, the
diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp
index d967dd2384d..6a4153c6552 100644
--- a/gdb/testsuite/gdb.base/list.exp
+++ b/gdb/testsuite/gdb.base/list.exp
@@ -489,7 +489,7 @@ proc test_list_filename_and_function {} {
gdb_test "list foobar.c:main" "No source file named foobar.c.|Location not found" "list filename:function; nonexistant file"
- gdb_test "list list0.h:foobar" "Function \"foobar\" not defined.|Location not found" "list filename:function; nonexistant function"
+ gdb_test "list list0.h:foobar" "Function \"foobar\" not defined in \"list0.h\"." "list filename:function; nonexistant function"
}
diff --git a/gdb/testsuite/gdb.base/sepdebug.exp b/gdb/testsuite/gdb.base/sepdebug.exp
index 1a9072dd9e1..bb0b9141feb 100644
--- a/gdb/testsuite/gdb.base/sepdebug.exp
+++ b/gdb/testsuite/gdb.base/sepdebug.exp
@@ -337,7 +337,8 @@ gdb_test_multiple "catch exec" $name {
# on a nonexistent source line.
#
-gdb_test "break 999" "No line 999 in file .*" \
+gdb_test_no_output "set breakpoint pending off"
+gdb_test "break 999" "No line 999 in the current file." \
"break on non-existent source line"
# Run to the desired default location. If not positioned here, the
diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/solib-symbol.exp
index aa723c65611..d402ebb9ffd 100644
--- a/gdb/testsuite/gdb.base/solib-symbol.exp
+++ b/gdb/testsuite/gdb.base/solib-symbol.exp
@@ -46,11 +46,6 @@ gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
gdb_load_shlibs $binfile_lib
-if ![runto_main] then {
- fail "Can't run to main"
- return 0
-}
-
# Set a breakpoint in the binary.
gdb_test "br foo2" \
"Breakpoint.*file.*${testfile}\\.c.*" \
@@ -58,6 +53,11 @@ gdb_test "br foo2" \
delete_breakpoints
+if ![runto_main] then {
+ fail "Can't run to main"
+ return 0
+}
+
# Break in the library.
gdb_test "br foo" \
"Breakpoint.*file.*${libname}\\.c.*" \
@@ -67,9 +67,9 @@ gdb_test "continue" \
"Continuing.*" \
"continue"
-# This symbol is now looked up in the ELF library.
+# This symbol is now looked up in the ELF library and the binary.
gdb_test "br foo2" \
- "Breakpoint.*file.*${libname}\\.c.*" \
+ "Breakpoint.*: foo2. .2 locations..*" \
"foo2 in mdlib"
gdb_exit
diff --git a/gdb/testsuite/gdb.base/solib-weak.exp b/gdb/testsuite/gdb.base/solib-weak.exp
index 1f23aa28948..52fd72d3aaf 100644
--- a/gdb/testsuite/gdb.base/solib-weak.exp
+++ b/gdb/testsuite/gdb.base/solib-weak.exp
@@ -101,15 +101,6 @@ proc do_test { lib1opts lib2opts lib1first } {
gdb_breakpoint "bar"
- # If the library which will be used is compiled without debugging
- # information, GDB will pick the wrong copy of "bar", i.e. the one
- # with debugging information.
-
- if {(${lib1opts} == "" && ${lib2opts} != "" && ${lib1first} == 1)
- || (${lib1opts} != "" && ${lib2opts} == "" && ${lib1first} == 0)} {
- setup_kfail gdb/1824 *-*-*
- }
-
gdb_test "continue" "Breakpoint .* \\.?bar .*${expected_file}\\..*" \
"run to breakpoint - $testopts"
}
diff --git a/gdb/testsuite/gdb.cp/mb-ctor.exp b/gdb/testsuite/gdb.cp/mb-ctor.exp
index 6a99175f789..04384248536 100644
--- a/gdb/testsuite/gdb.cp/mb-ctor.exp
+++ b/gdb/testsuite/gdb.cp/mb-ctor.exp
@@ -50,13 +50,13 @@ if ![runto_main] then {
# and a condition.
gdb_test "break 'Derived::Derived(int)'" \
- "Breakpoint.*at.* file .*$srcfile, line.*\\(2 locations\\).*" \
+ "Breakpoint.*at.*: Derived::Derived.int.. \\(2 locations\\).*" \
"set-breakpoint at ctor"
gdb_breakpoint [gdb_get_line_number "set breakpoint here"]
gdb_test "break 'Derived::~Derived()'" \
- "Breakpoint.*at.* file .*$srcfile, line.*\\(2 locations\\).*" \
+ "Breakpoint.*at.*: Derived::~Derived... \\(2 locations\\).*" \
"set-breakpoint at dtor"
gdb_test "continue" \
diff --git a/gdb/testsuite/gdb.cp/mb-inline.exp b/gdb/testsuite/gdb.cp/mb-inline.exp
index d670b56ed1c..05b378cf47c 100644
--- a/gdb/testsuite/gdb.cp/mb-inline.exp
+++ b/gdb/testsuite/gdb.cp/mb-inline.exp
@@ -62,7 +62,7 @@ set bp_location [gdb_get_line_number "set breakpoint here" $hdrfile]
# Set a breakpoint with multiple locations.
gdb_test "break $hdrfile:$bp_location" \
- "Breakpoint.*at.* file .*$hdrfile, line.*\\(2 locations\\).*" \
+ "Breakpoint.*at.*: $hdrfile:$bp_location. \\(2 locations\\).*" \
"set breakpoint"
gdb_run_cmd
@@ -128,7 +128,7 @@ if { ![runto_main] } {
}
gdb_test "break $hdrfile:$bp_location" \
- "Breakpoint.*at.* file .*$hdrfile, line.*\\(2 locations\\).*" \
+ "Breakpoint.*at.*: $hdrfile:$bp_location. \\(2 locations\\).*" \
"set multi_line_foo breakpoint"
gdb_test "continue" \
".*Breakpoint.*multi_line_foo \\(i=0\\).*" \
diff --git a/gdb/testsuite/gdb.cp/mb-templates.exp b/gdb/testsuite/gdb.cp/mb-templates.exp
index 80c080b0929..933d690152d 100644
--- a/gdb/testsuite/gdb.cp/mb-templates.exp
+++ b/gdb/testsuite/gdb.cp/mb-templates.exp
@@ -52,7 +52,7 @@ set bp_location [gdb_get_line_number "set breakpoint here"]
# and a condition.
gdb_test "break $srcfile:$bp_location if i==1" \
- "Breakpoint.*at.* file .*$srcfile, line.*\\(2 locations\\).*" \
+ "Breakpoint.*at.*: $srcfile:$bp_location. \\(2 locations\\).*" \
"initial condition: set breakpoint"
gdb_run_cmd
@@ -80,7 +80,7 @@ gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
gdb_test "break $srcfile:$bp_location" \
- "Breakpoint.*at.* file .*$srcfile, line.*\\(2 locations\\).*" \
+ "Breakpoint.*at.*: $srcfile:$bp_location. \\(2 locations\\).*" \
"separate condition: set breakpoint"
gdb_test_no_output "condition 1 i==1" \
@@ -177,7 +177,7 @@ if { ![runto_main] } {
}
gdb_test "break $srcfile:$bp_location" \
- "Breakpoint.*at.* file .*$srcfile, line.*\\(2 locations\\).*" \
+ "Breakpoint.*at.*: $srcfile:$bp_location. \\(2 locations\\).*" \
"set multi_line_foo breakpoint"
gdb_test "continue" \
".*Breakpoint.*multi_line_foo<int> \\(i=0\\).*" \
diff --git a/gdb/testsuite/gdb.cp/method2.exp b/gdb/testsuite/gdb.cp/method2.exp
index 2fa41697576..29a387de886 100644
--- a/gdb/testsuite/gdb.cp/method2.exp
+++ b/gdb/testsuite/gdb.cp/method2.exp
@@ -51,7 +51,7 @@ proc test_break { lang } {
"setting language $lang"
gdb_test_multiple "break A::method" "breaking in method ($lang)" {
- -re ".0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. A::method\\(A\\*\\) at .*\[\r\n\]*.3. A::method\\(int\\) at .*\[\r\n\]*\[\r\n\]*.4. A::method\\(\\) at .*\[\r\n\]*> $" {
+ -re ".0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. .*:A::method\\(A\\*\\)\[\r\n\]*.3. .*:A::method\\(int\\)\[\r\n\]*.4. .*:A::method\\(\\)\[\r\n\]*> $" {
gdb_test "0" \
"canceled" \
"breaking in method ($lang)"
diff --git a/gdb/testsuite/gdb.cp/ovldbreak.exp b/gdb/testsuite/gdb.cp/ovldbreak.exp
index f5d4051fae5..f5b41abe601 100644
--- a/gdb/testsuite/gdb.cp/ovldbreak.exp
+++ b/gdb/testsuite/gdb.cp/ovldbreak.exp
@@ -130,18 +130,18 @@ proc set_bp_overloaded {name expectedmenu mychoice bpnumber linenumber} {
set menu_overload1arg "\\\[0\\\] cancel\r\n"
append menu_overload1arg "\\\[1\\\] all\r\n"
-append menu_overload1arg "\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n"
-append menu_overload1arg "\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n"
-append menu_overload1arg "\\\[4\\\] foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r\n"
-append menu_overload1arg "\\\[5\\\] foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r\n"
-append menu_overload1arg "\\\[6\\\] foo::overload1arg\\((unsigned int|unsigned)\\) at.*$srcfile:117\r\n"
-append menu_overload1arg "\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n"
-append menu_overload1arg "\\\[8\\\] foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r\n"
-append menu_overload1arg "\\\[9\\\] foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r\n"
-append menu_overload1arg "\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n"
-append menu_overload1arg "\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n"
-append menu_overload1arg "\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n"
-append menu_overload1arg "\\\[13\\\] foo::overload1arg\\((void|)\\) at.*$srcfile:110\r\n"
+append menu_overload1arg "\\\[2\\\] .*$srcfile:foo::overload1arg\\(double\\)\r\n"
+append menu_overload1arg "\\\[3\\\] .*$srcfile:foo::overload1arg\\(float\\)\r\n"
+append menu_overload1arg "\\\[4\\\] .*$srcfile:foo::overload1arg\\((unsigned long|long unsigned)( int)?\\)\r\n"
+append menu_overload1arg "\\\[5\\\] .*$srcfile:foo::overload1arg\\(long( int)?\\)\r\n"
+append menu_overload1arg "\\\[6\\\] .*$srcfile:foo::overload1arg\\((unsigned int|unsigned)\\)\r\n"
+append menu_overload1arg "\\\[7\\\] .*$srcfile:foo::overload1arg\\(int\\)\r\n"
+append menu_overload1arg "\\\[8\\\] .*$srcfile:foo::overload1arg\\((unsigned short|short unsigned)( int)?\\)\r\n"
+append menu_overload1arg "\\\[9\\\] .*$srcfile:foo::overload1arg\\(short( int)?\\)\r\n"
+append menu_overload1arg "\\\[10\\\] .*$srcfile:foo::overload1arg\\(unsigned char\\)\r\n"
+append menu_overload1arg "\\\[11\\\] .*$srcfile:foo::overload1arg\\(signed char\\)\r\n"
+append menu_overload1arg "\\\[12\\\] .*$srcfile:foo::overload1arg\\(char\\)\r\n"
+append menu_overload1arg "\\\[13\\\] .*$srcfile:foo::overload1arg\\((void|)\\)\r\n"
append menu_overload1arg "> $"
# Set multiple-symbols to "ask", to allow us to test the use
@@ -279,7 +279,7 @@ gdb_expect {
# Choose all.
send_gdb "1\n"
gdb_expect {
- -re "Breakpoint $decimal at $hex: file.*$srcfile, line 121.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 120.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 119.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 118.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 117.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 116.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 115.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 114.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 113.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 112.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 111.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 110.\r\nwarning: Multiple breakpoints were set.\r\nUse the .delete. command to delete unwanted breakpoints.\r\n$gdb_prompt $" {
+ -re "Breakpoint $decimal at $hex: foo::overload1arg. .12 locations.\r\n.*$gdb_prompt $" {
pass "set bp on overload1arg all"
}
-re ".*$gdb_prompt $" {
@@ -306,18 +306,19 @@ gdb_expect {
gdb_test "info break" \
"Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:121\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:120\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:116\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$srcfile:110" \
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+<MULTIPLE>\[\t \]*\r
+\[0-9\]+.1\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:121\r
+\[0-9\]+.2\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:120\r
+\[0-9\]+.3\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r
+\[0-9\]+.4\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r
+\[0-9\]+.5\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r
+\[0-9\]+.6\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:116\r
+\[0-9\]+.7\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r
+\[0-9\]+.8\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r
+\[0-9\]+.9\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
+\[0-9\]+.10\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
+\[0-9\]+.11\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r
+\[0-9\]+.12\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$srcfile:110" \
"breakpoint info (after setting on all)"
@@ -333,10 +334,10 @@ proc continue_to_bp_overloaded {might_kfail bpnumber argtype actuals} {
send_gdb "continue\n"
gdb_expect {
- -re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, (${hex} in )?foo::overload1arg(\\(${argtype}\\))? \\(this=${hex}(, )?${actuals}\\) at.*${srcfile}:${decimal}\r\n${decimal}\[\t \]+int foo::overload1arg \\(${argtype}( arg)?\\).*\r\n.*$gdb_prompt $" {
+ -re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, foo::overload1arg \\(this=${hex}(, )?${actuals}\\) at.*${srcfile}:${decimal}\r\n${decimal}\[\t \]+int foo::overload1arg \\(${argtype}( arg)?\\).*\r\n.*$gdb_prompt $" {
pass "continue to bp overloaded : ${argtype}"
}
- -re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, (${hex} in )?foo::overload1arg(\\(${argtype}\\))? \\(this=${hex}, arg=.*\\) at.*${srcfile}:${decimal}\r\n${decimal}\[\t \]+int foo::overload1arg \\(${argtype}( arg)?\\).*\r\n.*$gdb_prompt $" {
+ -re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, foo::overload1arg \\(this=${hex}, arg=.*\\) at.*${srcfile}:${decimal}\r\n${decimal}\[\t \]+int foo::overload1arg \\(${argtype}( arg)?\\).*\r\n.*$gdb_prompt $" {
if $might_kfail {
kfail "gdb/1025" "continue to bp overloaded : ${argtype}"
} else {
@@ -352,17 +353,17 @@ proc continue_to_bp_overloaded {might_kfail bpnumber argtype actuals} {
}
}
-continue_to_bp_overloaded 0 25 "(void|)" ""
-continue_to_bp_overloaded 1 24 "char" "arg=2 \\'\\\\002\\'"
-continue_to_bp_overloaded 1 23 "signed char" "arg=3 \\'\\\\003\\'"
-continue_to_bp_overloaded 1 22 "unsigned char" "arg=4 \\'\\\\004\\'"
-continue_to_bp_overloaded 1 21 "short" "arg=5"
-continue_to_bp_overloaded 1 20 "unsigned short" "arg=6"
-continue_to_bp_overloaded 0 19 "int" "arg=7"
-continue_to_bp_overloaded 0 18 "(unsigned|unsigned int)" "arg=8"
-continue_to_bp_overloaded 0 17 "long" "arg=9"
-continue_to_bp_overloaded 0 16 "unsigned long" "arg=10"
-continue_to_bp_overloaded 0 15 "float" "arg=100"
+continue_to_bp_overloaded 0 14 "(void|)" ""
+continue_to_bp_overloaded 1 14 "char" "arg=2 \\'\\\\002\\'"
+continue_to_bp_overloaded 1 14 "signed char" "arg=3 \\'\\\\003\\'"
+continue_to_bp_overloaded 1 14 "unsigned char" "arg=4 \\'\\\\004\\'"
+continue_to_bp_overloaded 1 14 "short" "arg=5"
+continue_to_bp_overloaded 1 14 "unsigned short" "arg=6"
+continue_to_bp_overloaded 0 14 "int" "arg=7"
+continue_to_bp_overloaded 0 14 "(unsigned|unsigned int)" "arg=8"
+continue_to_bp_overloaded 0 14 "long" "arg=9"
+continue_to_bp_overloaded 0 14 "unsigned long" "arg=10"
+continue_to_bp_overloaded 0 14 "float" "arg=100"
continue_to_bp_overloaded 1 14 "double" "arg=200"
# Test breaking on an overloaded function when multiple-symbols
@@ -375,7 +376,7 @@ gdb_test "break foo::foofunc" \
# is set to "all"
gdb_test_no_output "set multiple-symbols all"
gdb_test "break foo::foofunc" \
- "Breakpoint \[0-9\]+ at ${hex}: file .*ovldbreak\\.cc, line \[0-9\]+\\.\r\nBreakpoint \[0-9\]+ at ${hex}: file .*ovldbreak\\.cc, line \[0-9\]+\\.\r\nwarning: Multiple breakpoints were set\\.\r\nUse the \"delete\" command to delete unwanted breakpoints\\."
+ "Breakpoint \[0-9\]+ at ${hex}: foo::foofunc. .2 locations..*"
# That's all, folks.
diff --git a/gdb/testsuite/gdb.cp/ovsrch.exp b/gdb/testsuite/gdb.cp/ovsrch.exp
index b509a2519d8..f6ad34bc79c 100644
--- a/gdb/testsuite/gdb.cp/ovsrch.exp
+++ b/gdb/testsuite/gdb.cp/ovsrch.exp
@@ -49,7 +49,7 @@ proc test_class {class} {
# Test whether open parentheses are correctly identified as overload
# information or conditional.
- gdb_test "break ${class}::foo if (a == 3)" "Breakpoint (\[0-9\]).*"
+ gdb_test "break ${class}::hibob if (a_param == 3)" "Breakpoint (\[0-9\]).*"
}
if { [skip_cplus_tests] } { continue }
@@ -73,28 +73,28 @@ if {![runto_main]} {
}
# Break in A::stop_here and run tests.
-if {[gdb_breakpoint "stop_here"]} {
- pass "break stop_here"
+if {[gdb_breakpoint "A::stop_here"]} {
+ pass "break A::stop_here"
}
-if {[gdb_breakpoint "'stop_here'"]} {
- pass "break 'stop_here'"
+if {[gdb_breakpoint "'A::stop_here'"]} {
+ pass "break 'A::stop_here'"
}
gdb_continue_to_breakpoint "stop_here"
-test_class outer
+test_class A::outer
# Break in A::B::stop_here_too and run tests.
-if {[gdb_breakpoint "B::stop_here_too"]} {
- pass "break B::stop_here_too"
+if {[gdb_breakpoint "A::B::stop_here_too"]} {
+ pass "break A::B::stop_here_too"
}
-if {[gdb_breakpoint "'B::stop_here_too'"]} {
- pass "break 'B::stop_here_too'"
+if {[gdb_breakpoint "'A::B::stop_here_too'"]} {
+ pass "break 'A::B::stop_here_too'"
}
gdb_continue_to_breakpoint "stop_here_too"
-test_class inner
+test_class A::B::inner
gdb_exit
return 0
diff --git a/gdb/testsuite/gdb.cp/ovsrch.h b/gdb/testsuite/gdb.cp/ovsrch.h
index b2e518d2a21..983b51e5fb5 100644
--- a/gdb/testsuite/gdb.cp/ovsrch.h
+++ b/gdb/testsuite/gdb.cp/ovsrch.h
@@ -24,6 +24,8 @@ namespace A
void foo (int) const;
void foo (char *) const;
bool func (void) { return true; }
+ void hibob (int) const;
+ void hibob (char *) const;
};
namespace B
@@ -34,6 +36,8 @@ namespace A
void foo (void) const;
void foo (int) const;
void foo (char *) const;
+ void hibob (int) const;
+ void hibob (char *) const;
};
}
}
diff --git a/gdb/testsuite/gdb.cp/ovsrch3.cc b/gdb/testsuite/gdb.cp/ovsrch3.cc
index e6e38a4507b..a7d9551a1fb 100644
--- a/gdb/testsuite/gdb.cp/ovsrch3.cc
+++ b/gdb/testsuite/gdb.cp/ovsrch3.cc
@@ -18,11 +18,21 @@
#include "ovsrch.h"
void
-A::outer::foo (int a) const
+A::outer::foo (int a_param) const
{
}
void
-A::B::inner::foo (int a) const
+A::B::inner::foo (int a_param) const
+{
+}
+
+void
+A::outer::hibob (int a_param) const
+{
+}
+
+void
+A::B::inner::hibob (int a_param) const
{
}
diff --git a/gdb/testsuite/gdb.cp/ovsrch4.cc b/gdb/testsuite/gdb.cp/ovsrch4.cc
index 2f0c1a62a07..5bb08b37d5a 100644
--- a/gdb/testsuite/gdb.cp/ovsrch4.cc
+++ b/gdb/testsuite/gdb.cp/ovsrch4.cc
@@ -18,11 +18,21 @@
#include "ovsrch.h"
void
-A::outer::foo (char *a) const
+A::outer::foo (char *a_param) const
{
}
void
-A::B::inner::foo (char *a) const
+A::B::inner::foo (char *a_param) const
+{
+}
+
+void
+A::outer::hibob (char *a_param) const
+{
+}
+
+void
+A::B::inner::hibob (char *a_param) const
{
}
diff --git a/gdb/testsuite/gdb.cp/re-set-overloaded.exp b/gdb/testsuite/gdb.cp/re-set-overloaded.exp
index 2052552ca0b..bd5f3bad224 100644
--- a/gdb/testsuite/gdb.cp/re-set-overloaded.exp
+++ b/gdb/testsuite/gdb.cp/re-set-overloaded.exp
@@ -46,7 +46,6 @@ gdb_test_no_output {set variable $brk = $bpnum}
# runto or runto_main would call delete_breakpoints.
gdb_breakpoint "main"
gdb_run_cmd
-setup_kfail breakpoints/11657 *-*-*
gdb_test "" ".*" "start"
set test "breakpoint resolved"
diff --git a/gdb/testsuite/gdb.cp/templates.exp b/gdb/testsuite/gdb.cp/templates.exp
index 6612b4a8c19..59e94763fed 100644
--- a/gdb/testsuite/gdb.cp/templates.exp
+++ b/gdb/testsuite/gdb.cp/templates.exp
@@ -109,12 +109,7 @@ proc test_template_breakpoints {} {
global hp_aCC_compiler
gdb_test_multiple "break T5<int>::T5" "constructor breakpoint" {
- -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. T5<int>::T5\\(int\\) at .*\[\r\n\]*.3. T5<int>::T5\\((T5<int> const|const T5<int>) ?&\\) at .*\[\r\n\]*> $" {
- gdb_test "0" \
- "canceled" \
- "constructor breakpoint (obsolete format!)"
- }
- -re ".0. cancel\[\r\n\]*.1. all\[\r\n\]*.2. T5<int>::T5\\((T5<int> const|const T5<int>) ?&\\) at .*templates.cc:.*\[\r\n\]*.3. T5<int>::T5\\(int\\) at .*templates.cc:.*\[\r\n\]*> $" {
+ -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2.*templates.cc:T5<int>::T5\\((T5<int> const|const T5<int>) ?&\\)\[\r\n\]*.3.*templates.cc:T5<int>::T5\\(int\\)\[\r\n\]*> $" {
gdb_test "0" \
"canceled" \
"constructor breakpoint"
@@ -152,9 +147,26 @@ proc test_template_breakpoints {} {
set bp_location [gdb_get_line_number \
"set breakpoint on a line with no real code"]
- gdb_test "break ${testfile}.cc:${bp_location}" \
- "Breakpoint.*at.* file .*${testfile}.cc, line.*(2 locations).*" \
- "breakpoint on a line with no real code"
+
+ gdb_test_multiple "break ${testfile}.cc:${bp_location}" \
+ "breakpoint on a line with no real code" {
+ -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2.*templates.cc:GetMax<int>\\(int, int\\)\[\r\n\]*.3.*templates.cc:GetMax<long>\\(long, long\\)\[\r\n\]*> $" {
+ gdb_test "0" \
+ "canceled" \
+ "breakpoint on a line with no real code"
+ }
+ -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2.*\[\r\n\]*.3.*\[\r\n\]*> $" {
+ gdb_test "0" \
+ "nonsense intended to insure that this test fails" \
+ "breakpoint on a line with no real code"
+ }
+ -re ".*\n> $" {
+ gdb_test "0" \
+ "nonsense intended to insure that this test fails" \
+ "breakpoint on a line with no real code"
+ }
+ }
+
delete_breakpoints
}
diff --git a/gdb/testsuite/gdb.linespec/Makefile.in b/gdb/testsuite/gdb.linespec/Makefile.in
new file mode 100644
index 00000000000..2658a241ce9
--- /dev/null
+++ b/gdb/testsuite/gdb.linespec/Makefile.in
@@ -0,0 +1,14 @@
+VPATH = @srcdir@
+srcdir = @srcdir@
+
+EXECUTABLES = lspec
+
+all info install-info dvi install uninstall installcheck check:
+ @echo "Nothing to be done for $@..."
+
+clean mostlyclean:
+ -rm -f *~ *.o *.ci
+ -rm -f core $(EXECUTABLES)
+
+distclean maintainer-clean realclean: clean
+ -rm -f Makefile config.status config.log gdb.log gdb.sum
diff --git a/gdb/testsuite/gdb.linespec/base/one/thefile.cc b/gdb/testsuite/gdb.linespec/base/one/thefile.cc
new file mode 100644
index 00000000000..f8712c2af0d
--- /dev/null
+++ b/gdb/testsuite/gdb.linespec/base/one/thefile.cc
@@ -0,0 +1,20 @@
+/* The commented line must have the same line number in the other
+ "thefile.c". */
+
+#define WANT_F1
+#include "../../lspec.h"
+
+
+
+
+
+
+int m(int x)
+{
+ return x + 23; /* thefile breakpoint */
+}
+
+int NameSpace::overload(int x)
+{
+ return x + 23;
+}
diff --git a/gdb/testsuite/gdb.linespec/base/two/thefile.cc b/gdb/testsuite/gdb.linespec/base/two/thefile.cc
new file mode 100644
index 00000000000..ffca87a4e87
--- /dev/null
+++ b/gdb/testsuite/gdb.linespec/base/two/thefile.cc
@@ -0,0 +1,20 @@
+/* The commented line must have the same line number in the other
+ "thefile.c". */
+
+#define WANT_F2
+#include "../../lspec.h"
+
+static int dupname(int y)
+{
+ label: return y;
+}
+
+int n(int y)
+{
+ return dupname(y) - 23; /* thefile breakpoint */
+}
+
+int NameSpace::overload(double x)
+{
+ return (int) x - 23;
+}
diff --git a/gdb/testsuite/gdb.linespec/body.h b/gdb/testsuite/gdb.linespec/body.h
new file mode 100644
index 00000000000..e8765f69dff
--- /dev/null
+++ b/gdb/testsuite/gdb.linespec/body.h
@@ -0,0 +1,5 @@
+/* This is included directly into the body of a function. */
+
+/* body breakpoint no code */
+
+return x;
diff --git a/gdb/testsuite/gdb.linespec/linespec.exp b/gdb/testsuite/gdb.linespec/linespec.exp
new file mode 100644
index 00000000000..440233a5d1a
--- /dev/null
+++ b/gdb/testsuite/gdb.linespec/linespec.exp
@@ -0,0 +1,117 @@
+# Copyright 2011 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/>.
+
+# Tests of ambiguous linespecs.
+
+set testfile linespec
+
+set exefile lspec
+set binfile ${objdir}/${subdir}/${exefile}
+
+set baseone base/one/thefile.cc
+set basetwo base/two/thefile.cc
+
+if {[skip_cplus_tests]} {
+ unsupported linespec.exp
+ return
+}
+
+if {[prepare_for_testing ${testfile}.exp $exefile \
+ [list lspec.cc $baseone $basetwo] \
+ {debug nowarnings}]} {
+ return -1
+}
+
+gdb_test_no_output "set multiple-symbols all" \
+ "set multiple-symbols to all for linespec tests"
+
+set l1 [gdb_get_line_number "thefile breakpoint" $baseone]
+set l2 [gdb_get_line_number "thefile breakpoint" $basetwo]
+
+if {$l1 != $l2} {
+ error "somebody incompatibly modified the source files needed by linespec.exp"
+}
+
+gdb_test "break thefile.cc:$l1" \
+ "Breakpoint 1 at $hex: thefile.cc:$l1. \[(\]2 locations\[)\]" \
+ "multi-location break using file:line"
+
+# We'd like this to work, but it currently does not.
+# gdb_test "break one/thefile.cc:$l1"
+
+gdb_test "break dupname" \
+ "Breakpoint 2 at $hex: dupname. \[(\]2 locations\[)\]" \
+ "multi-location break using duplicate function name"
+
+gdb_test "break dupname:label" \
+ "Breakpoint 3 at $hex: dupname:label. \[(\]2 locations\[)\]" \
+ "multi-location break using duplicate function name and label"
+
+gdb_test_no_output "set breakpoint pending off" \
+ "disable pending breakpoints for linespec tests"
+
+# This is PR breakpoints/12856.
+gdb_test "break lspec.cc:nosuchfunction" \
+ "Function \"nosuchfunction\" not defined in \"lspec.cc\"." \
+ "set breakpoint on non-existent function"
+
+gdb_test "break NameSpace::overload" \
+ "Breakpoint \[0-9\]+ at $hex: NameSpace::overload. \[(\]3 locations\[)\]" \
+ "set breakpoint at all instances of NameSpace::overload"
+
+gdb_test "break lspec.cc:NameSpace::overload" \
+ "Breakpoint \[0-9\]+ at $hex: file .*lspec.cc, line 7." \
+ "set breakpoint at lspec.cc instance of NameSpace::overload"
+
+gdb_test "break lspec.cc:NameSpace::overload(double)" \
+ "Function \"NameSpace::overload\\(double\\)\" not defined in \"lspec.cc\"." \
+ "set breakpoint at non-existent lspec.cc instance of NameSpace::overload"
+
+gdb_test "break NameSpace::overload()" \
+ "Breakpoint \[0-9\]+ at $hex: file .*lspec.cc, line 7." \
+ "set breakpoint at specific instance of NameSpace::overload"
+
+# This should manage to set a breakpoint even though body.h does not
+# include all of the function in question.
+set line [gdb_get_line_number "body breakpoint no code" body.h]
+gdb_test "break body.h:$line" \
+ "Breakpoint \[0-9\]+.*" \
+ "set breakpoint in body.h"
+
+# This should only have a single location -- in f1.
+set line [gdb_get_line_number "f1 breakpoint" lspec.h]
+gdb_test "break lspec.h:$line" \
+ "Breakpoint \[0-9\]+ at $hex: file .*lspec.h, line $line." \
+ "set breakpoint in f1"
+
+#
+# Multi-inferior tests.
+#
+
+gdb_test "add-inferior" "Added inferior 2" \
+ "add inferior for linespec tests"
+
+gdb_test "inferior 2" "Switching to inferior 2 .*" \
+ "switch to inferior 2 for linespec tests"
+
+# Note that in particular this should not cause errors when re-setting
+# breakpoints.
+gdb_test "file $binfile" \
+ "Reading symbols from .*done." \
+ "set the new inferior file for linespec tests"
+
+gdb_test "break main" \
+ "Breakpoint \[0-9\]+ at $hex: main. .2 locations." \
+ "set breakpoint at main in both inferiors"
diff --git a/gdb/testsuite/gdb.linespec/lspec.cc b/gdb/testsuite/gdb.linespec/lspec.cc
new file mode 100644
index 00000000000..b1092e22d75
--- /dev/null
+++ b/gdb/testsuite/gdb.linespec/lspec.cc
@@ -0,0 +1,19 @@
+#include "lspec.h"
+
+static int dupname (int x) { label: return x; }
+
+int NameSpace::overload()
+{
+ return 23;
+}
+
+int body_elsewhere()
+{
+ int x = 5;
+#include "body.h"
+}
+
+int main()
+{
+ return dupname(0) + m(0) + n(0) + f1() + f2() + body_elsewhere();
+}
diff --git a/gdb/testsuite/gdb.linespec/lspec.h b/gdb/testsuite/gdb.linespec/lspec.h
new file mode 100644
index 00000000000..0a647fafce6
--- /dev/null
+++ b/gdb/testsuite/gdb.linespec/lspec.h
@@ -0,0 +1,26 @@
+extern int m(int x);
+extern int n(int y);
+
+namespace NameSpace {
+ int overload ();
+ int overload (int);
+ int overload (double);
+};
+
+#ifdef WANT_F1
+int f1(void)
+{
+ return 1; /* f1 breakpoint */
+}
+#else
+extern int f1(void);
+#endif
+
+#ifdef WANT_F2
+int f2(void)
+{
+ return 1; /* f2 breakpoint */
+}
+#else
+extern int f2(void);
+#endif
diff --git a/gdb/testsuite/gdb.objc/objcdecode.exp b/gdb/testsuite/gdb.objc/objcdecode.exp
index 720bfd85616..e3916f6996c 100644
--- a/gdb/testsuite/gdb.objc/objcdecode.exp
+++ b/gdb/testsuite/gdb.objc/objcdecode.exp
@@ -52,17 +52,19 @@ proc do_objc_tests {} {
do_objc_tests
+gdb_test_no_output "set multiple-symbols ask"
+
#
# Break on multiply defined method (PR objc/1236)
#
set name "break on multiply defined method"
gdb_test_multiple "break multipleDef" $name \
{
- -re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] -.Decode multipleDef. at .*\r\n\\\[3\\\] multipleDef at .*\r\n> $" {
+ -re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] .*${srcfile}:-.Decode multipleDef.\r\n\\\[3\\\] .*${srcfile}:multipleDef\r\n> $" {
send_gdb "3\n"
exp_continue
}
- -re "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*\r\n$gdb_prompt $" { pass $name }
+ -re "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: .*\r\n$gdb_prompt $" { pass $name }
-re ".*$gdb_prompt $" { kfail "gdb/1236" $name }
}
diff --git a/gdb/testsuite/gdb.trace/tracecmd.exp b/gdb/testsuite/gdb.trace/tracecmd.exp
index 679cc32cc36..89a2e24bba7 100644
--- a/gdb/testsuite/gdb.trace/tracecmd.exp
+++ b/gdb/testsuite/gdb.trace/tracecmd.exp
@@ -74,6 +74,7 @@ gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline2" \
# 1.2 trace invalid source line
gdb_delete_tracepoints
+gdb_test_no_output "set breakpoint pending off"
gdb_test "trace $srcfile:99999" "No line 99999 in file \".*$srcfile\"." \
"1.2a: trace invalid line in sourcefile"
gdb_test "info trace" "No tracepoints.*" \
@@ -81,7 +82,6 @@ gdb_test "info trace" "No tracepoints.*" \
# 1.3 trace line in invalid source file
gdb_delete_tracepoints
-gdb_test_no_output "set breakpoint pending off"
gdb_test "trace NoSuChFiLe.c:1" "No source file named NoSuChFiLe.c." \
"1.3a: trace invalid source file"
gdb_test "info trace" "No tracepoints.*" \