[2/3] Testsuite: Rename "end()" to avoid libinproctrace C++ symbol clash

Message ID 1521043903-18837-3-git-send-email-arnez@linux.vnet.ibm.com
State New
Headers show
Series
  • Some gdbserver test suite fixes
Related show

Commit Message

Andreas Arnez March 14, 2018, 4:11 p.m.
Some of GDB's trace test cases define a function end() and place a
breakpoint there with "break end".  However, when libinproctrace is linked
to the binary, there are multiple methods named "end", such as
std::string::end() from the C++ library or format_pieces::end() from
common/format.h.  GDB then creates multiple breakpoints instead of just a
single one, and some FAILs result, such as these:

  FAIL: gdb.trace/trace-mt.exp: ftrace on: break end
  FAIL: gdb.trace/trace-mt.exp: ftrace off: break end

This is fixed by renaming end() to my_end().  For consistency, where end()
was paired with a previous begin(), the latter is renamed to my_begin() as
well.

gdb/testsuite/ChangeLog:

	* gdb.trace/trace-break.c (end): Rename to...
	(my_end): ...this.
	(main): Adjust call.
	* gdb.trace/trace-mt.c (end): Rename to...
	(my_end): ...this.
	(main): Adjust call.
	* gdb.trace/unavailable.cc (begin): Rename to...
	(my_begin): ...this.
	(end): Rename to...
	(my_end): ...this.
	(main): Adjust calls.
	* gdb.trace/trace-break.exp: Reflect function name change.
	* gdb.trace/trace-mt.exp: Likewise.
	* gdb.trace/unavailable.exp: Likewise.
---
 gdb/testsuite/gdb.trace/trace-break.c   |  4 ++--
 gdb/testsuite/gdb.trace/trace-break.exp | 12 ++++++------
 gdb/testsuite/gdb.trace/trace-mt.c      |  4 ++--
 gdb/testsuite/gdb.trace/trace-mt.exp    |  2 +-
 gdb/testsuite/gdb.trace/unavailable.cc  |  8 ++++----
 gdb/testsuite/gdb.trace/unavailable.exp | 20 ++++++++++----------
 6 files changed, 25 insertions(+), 25 deletions(-)

-- 
2.14.3

Comments

Simon Marchi March 15, 2018, 9:57 p.m. | #1
On 2018-03-14 12:11 PM, Andreas Arnez wrote:
> Some of GDB's trace test cases define a function end() and place a

> breakpoint there with "break end".  However, when libinproctrace is linked

> to the binary, there are multiple methods named "end", such as

> std::string::end() from the C++ library or format_pieces::end() from

> common/format.h.  GDB then creates multiple breakpoints instead of just a

> single one, and some FAILs result, such as these:

> 

>   FAIL: gdb.trace/trace-mt.exp: ftrace on: break end

>   FAIL: gdb.trace/trace-mt.exp: ftrace off: break end

> 

> This is fixed by renaming end() to my_end().  For consistency, where end()

> was paired with a previous begin(), the latter is renamed to my_begin() as

> well.

> 

> gdb/testsuite/ChangeLog:

> 

> 	* gdb.trace/trace-break.c (end): Rename to...

> 	(my_end): ...this.

> 	(main): Adjust call.

> 	* gdb.trace/trace-mt.c (end): Rename to...

> 	(my_end): ...this.

> 	(main): Adjust call.

> 	* gdb.trace/unavailable.cc (begin): Rename to...

> 	(my_begin): ...this.

> 	(end): Rename to...

> 	(my_end): ...this.

> 	(main): Adjust calls.

> 	* gdb.trace/trace-break.exp: Reflect function name change.

> 	* gdb.trace/trace-mt.exp: Likewise.

> 	* gdb.trace/unavailable.exp: Likewise.


Hi Andreas,

Another way would have been to pass "-qualified" to the break command,
or use gdb_breakpoint and pass the "qualified" arg.  There are also
other instances of the same "problem" in tests that don't check the
output of the break command at all...

  gdb_test "break end" ".*" ""

In any case, this patch LGTM.

Thanks,

Simon
Andreas Arnez March 16, 2018, 7:47 p.m. | #2
On Thu, Mar 15 2018, Simon Marchi wrote:

> On 2018-03-14 12:11 PM, Andreas Arnez wrote:

>> Some of GDB's trace test cases define a function end() and place a

>> breakpoint there with "break end".  However, when libinproctrace is linked

>> to the binary, there are multiple methods named "end", such as

>> std::string::end() from the C++ library or format_pieces::end() from

>> common/format.h.  GDB then creates multiple breakpoints instead of just a

>> single one, and some FAILs result, such as these:

>> 

>>   FAIL: gdb.trace/trace-mt.exp: ftrace on: break end

>>   FAIL: gdb.trace/trace-mt.exp: ftrace off: break end

>> 

>> This is fixed by renaming end() to my_end().  For consistency, where end()

>> was paired with a previous begin(), the latter is renamed to my_begin() as

>> well.

>> 

>> gdb/testsuite/ChangeLog:

>> 

>> 	* gdb.trace/trace-break.c (end): Rename to...

>> 	(my_end): ...this.

>> 	(main): Adjust call.

>> 	* gdb.trace/trace-mt.c (end): Rename to...

>> 	(my_end): ...this.

>> 	(main): Adjust call.

>> 	* gdb.trace/unavailable.cc (begin): Rename to...

>> 	(my_begin): ...this.

>> 	(end): Rename to...

>> 	(my_end): ...this.

>> 	(main): Adjust calls.

>> 	* gdb.trace/trace-break.exp: Reflect function name change.

>> 	* gdb.trace/trace-mt.exp: Likewise.

>> 	* gdb.trace/unavailable.exp: Likewise.

>

> Hi Andreas,

>

> Another way would have been to pass "-qualified" to the break command,

> or use gdb_breakpoint and pass the "qualified" arg.  There are also

> other instances of the same "problem" in tests that don't check the

> output of the break command at all...

>

>   gdb_test "break end" ".*" ""

>

> In any case, this patch LGTM.


Hm, actually the use of "-qualified" is a good point.  I'd rather go
with that.  How about the patch below?

--
Andreas

-- >8 --
Subject: [PATCH] Testsuite: Fix ambiguous "break" due to libinproctrace

Some of GDB's trace test cases define a function end() and place a
breakpoint there with "break end".  However, when libinproctrace is linked
to the binary, there are multiple methods named "end", such as
std::string::end() from the C++ library or format_pieces::end() from
common/format.h.  GDB then creates multiple breakpoints instead of just a
single one, and some FAILs result, such as these:

  FAIL: gdb.trace/trace-mt.exp: ftrace on: break end
  FAIL: gdb.trace/trace-mt.exp: ftrace off: break end

Fix this by adding the "-qualified" option to the break commands.  For
consistency, change all occurrences of "break end" (and similar) in all
trace test cases, even if the current behavior does not cause problems.
Also, consequently use the gdb_breakpoint convenience proc.

gdb/testsuite/ChangeLog:

	* gdb.trace/actions-changed.exp: Call gdb_breakpoint with the
	"qualified" option when setting breakpoints.
	* gdb.trace/backtrace.exp: Likewise.
	* gdb.trace/circ.exp: Likewise.
	* gdb.trace/collection.exp: Likewise.
	* gdb.trace/disconnected-tracing.exp: Likewise.
	* gdb.trace/ftrace-lock.exp: Likewise.
	* gdb.trace/ftrace.exp: Likewise.
	* gdb.trace/infotrace.exp: Likewise.
	* gdb.trace/packetlen.exp: Likewise.
	* gdb.trace/passc-dyn.exp: Likewise.
	* gdb.trace/qtro.exp: Likewise.
	* gdb.trace/read-memory.exp: Likewise.
	* gdb.trace/report.exp: Likewise.
	* gdb.trace/signal.exp: Likewise.
	* gdb.trace/status-stop.exp: Likewise.
	* gdb.trace/strace.exp: Likewise.
	* gdb.trace/tfind.exp: Likewise.
	* gdb.trace/trace-break.exp: Likewise.
	* gdb.trace/trace-condition.exp: Likewise.
	* gdb.trace/trace-mt.exp: Likewise.
	* gdb.trace/tstatus.exp: Likewise.
	* gdb.trace/tsv.exp: Likewise.
	* gdb.trace/unavailable-dwarf-piece.exp: Likewise.
	* gdb.trace/unavailable.exp: Likewise.
	* gdb.trace/while-dyn.exp: Likewise.
---
 gdb/testsuite/gdb.trace/actions-changed.exp        |  2 +-
 gdb/testsuite/gdb.trace/backtrace.exp              |  2 +-
 gdb/testsuite/gdb.trace/circ.exp                   |  4 ++--
 gdb/testsuite/gdb.trace/collection.exp             |  4 ++--
 gdb/testsuite/gdb.trace/disconnected-tracing.exp   |  4 ++--
 gdb/testsuite/gdb.trace/ftrace-lock.exp            |  4 ++--
 gdb/testsuite/gdb.trace/ftrace.exp                 |  4 ++--
 gdb/testsuite/gdb.trace/infotrace.exp              |  2 +-
 gdb/testsuite/gdb.trace/packetlen.exp              |  2 +-
 gdb/testsuite/gdb.trace/passc-dyn.exp              |  2 +-
 gdb/testsuite/gdb.trace/qtro.exp                   |  2 +-
 gdb/testsuite/gdb.trace/read-memory.exp            |  2 +-
 gdb/testsuite/gdb.trace/report.exp                 |  2 +-
 gdb/testsuite/gdb.trace/signal.exp                 |  6 ++---
 gdb/testsuite/gdb.trace/status-stop.exp            |  4 ++--
 gdb/testsuite/gdb.trace/strace.exp                 |  6 ++---
 gdb/testsuite/gdb.trace/tfind.exp                  |  2 +-
 gdb/testsuite/gdb.trace/trace-break.exp            | 26 +++++++++++-----------
 gdb/testsuite/gdb.trace/trace-condition.exp        |  4 ++--
 gdb/testsuite/gdb.trace/trace-mt.exp               |  2 +-
 gdb/testsuite/gdb.trace/tstatus.exp                |  4 ++--
 gdb/testsuite/gdb.trace/tsv.exp                    |  2 +-
 .../gdb.trace/unavailable-dwarf-piece.exp          |  2 +-
 gdb/testsuite/gdb.trace/unavailable.exp            |  4 ++--
 gdb/testsuite/gdb.trace/while-dyn.exp              |  2 +-
 25 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/gdb/testsuite/gdb.trace/actions-changed.exp b/gdb/testsuite/gdb.trace/actions-changed.exp
index 5482291c01..102f04f734 100644
--- a/gdb/testsuite/gdb.trace/actions-changed.exp
+++ b/gdb/testsuite/gdb.trace/actions-changed.exp
@@ -22,7 +22,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
 }
 
 proc test_actions_changed { } {
-    gdb_breakpoint "end"
+    gdb_breakpoint "end" qualified
 
     gdb_test "trace subr" "Tracepoint .*" \
 	"tracepoint at subr"
diff --git a/gdb/testsuite/gdb.trace/backtrace.exp b/gdb/testsuite/gdb.trace/backtrace.exp
index 1842627046..6b41f8945b 100644
--- a/gdb/testsuite/gdb.trace/backtrace.exp
+++ b/gdb/testsuite/gdb.trace/backtrace.exp
@@ -145,7 +145,7 @@ gdb_trace_setactions "8.6: setup TP to collect stack mem cast expr" \
 
 gdb_test_no_output "tstart" ""
 
-gdb_test "break end" ".*" ""
+gdb_breakpoint "end" qualified
 gdb_test "continue" \
     "Continuing.*Breakpoint $decimal, end.*" \
     "run trace experiment"
diff --git a/gdb/testsuite/gdb.trace/circ.exp b/gdb/testsuite/gdb.trace/circ.exp
index f5312bdd3f..5af84feb24 100644
--- a/gdb/testsuite/gdb.trace/circ.exp
+++ b/gdb/testsuite/gdb.trace/circ.exp
@@ -66,7 +66,7 @@ proc run_trace_experiment { } {
     global decimal
 
     setup_tracepoints
-    gdb_test "break end" "Breakpoint $decimal.*" "breakpoint at end"
+    gdb_breakpoint "end" qualified
     gdb_test "tstart" "\[\r\n\]*" "start trace experiment"
     gdb_test "continue" "Continuing.*Breakpoint \[0-9\]+, end.*" \
 	"run to end"
@@ -174,7 +174,7 @@ set frame_size -1
 with_test_prefix "frame size" {
     set_a_tracepoint func0
 
-    gdb_test "break end" "Breakpoint $decimal.*" "breakpoint at end"
+    gdb_breakpoint "end" qualified
 
     gdb_test "tstart" "\[\r\n\]*" "start trace"
 
diff --git a/gdb/testsuite/gdb.trace/collection.exp b/gdb/testsuite/gdb.trace/collection.exp
index 4d3dc6bdab..b7eee6dbf4 100644
--- a/gdb/testsuite/gdb.trace/collection.exp
+++ b/gdb/testsuite/gdb.trace/collection.exp
@@ -64,8 +64,8 @@ proc prepare_for_trace_test {} {
 
     runto_main
 
-    gdb_test "break begin" ".*" ""
-    gdb_test "break end" ".*" ""
+    gdb_breakpoint "begin" qualified
+    gdb_breakpoint "end" qualified
 }
 
 proc run_trace_experiment { msg test_func } {
diff --git a/gdb/testsuite/gdb.trace/disconnected-tracing.exp b/gdb/testsuite/gdb.trace/disconnected-tracing.exp
index c806482fc6..7e77699d0c 100644
--- a/gdb/testsuite/gdb.trace/disconnected-tracing.exp
+++ b/gdb/testsuite/gdb.trace/disconnected-tracing.exp
@@ -62,7 +62,7 @@ proc disconnected_tracing {  } {
 	gdb_test "trace start" ".*"
 	gdb_trace_setactions "collect on tracepoint 2" "2" \
 	    "collect foo" "^$"
-	gdb_test "break end" "Breakpoint ${decimal} at .*"
+	gdb_breakpoint "end" qualified
 
 	gdb_test_no_output "tstart"
 
@@ -125,7 +125,7 @@ proc disconnected_tfind {  } {
 	gdb_test "trace start" ".*"
 	gdb_test_no_output "tstart"
 
-	gdb_test "break end" "Breakpoint ${decimal} at .*"
+	gdb_breakpoint "end" qualified
 	gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*"
 	gdb_test_no_output "tstop"
 
diff --git a/gdb/testsuite/gdb.trace/ftrace-lock.exp b/gdb/testsuite/gdb.trace/ftrace-lock.exp
index 4675e190b2..3e5f0b8712 100644
--- a/gdb/testsuite/gdb.trace/ftrace-lock.exp
+++ b/gdb/testsuite/gdb.trace/ftrace-lock.exp
@@ -69,8 +69,8 @@ if { [gdb_test "info sharedlibrary" ".*${remote_libipa}.*" "IPA loaded"] != 0 }
     return 1
 }
 
-gdb_test "break end" ""
-gdb_test "break fail" ""
+gdb_breakpoint "end" qualified
+gdb_breakpoint "fail" qualified
 
 gdb_test "ftrace set_point" "Fast tracepoint .*" \
     "fast tracepoint at a long insn"
diff --git a/gdb/testsuite/gdb.trace/ftrace.exp b/gdb/testsuite/gdb.trace/ftrace.exp
index 6389924cb8..5c494c6bb4 100644
--- a/gdb/testsuite/gdb.trace/ftrace.exp
+++ b/gdb/testsuite/gdb.trace/ftrace.exp
@@ -104,9 +104,9 @@ proc test_fast_tracepoints {} {
 
     set fourgood 0
 
-    gdb_test "break begin" ".*" ""
+    gdb_breakpoint "begin" qualified
 
-    gdb_test "break end" ".*" ""
+    gdb_breakpoint "end" qualified
 
     gdb_test "print gdb_agent_gdb_trampoline_buffer_error" ".*" ""
 
diff --git a/gdb/testsuite/gdb.trace/infotrace.exp b/gdb/testsuite/gdb.trace/infotrace.exp
index 053dafb0d7..b01365822c 100644
--- a/gdb/testsuite/gdb.trace/infotrace.exp
+++ b/gdb/testsuite/gdb.trace/infotrace.exp
@@ -111,7 +111,7 @@ if { ![gdb_target_supports_trace] } then {
     return 1
 }
 
-gdb_test "break end" "Breakpoint \[0-9\] at .*"
+gdb_breakpoint "end" qualified
 gdb_test_no_output "tstart"
 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
     "continue to end"
diff --git a/gdb/testsuite/gdb.trace/packetlen.exp b/gdb/testsuite/gdb.trace/packetlen.exp
index 3304904c13..ca54cfe159 100644
--- a/gdb/testsuite/gdb.trace/packetlen.exp
+++ b/gdb/testsuite/gdb.trace/packetlen.exp
@@ -61,7 +61,7 @@ gdb_trace_setactions "setup collect actions" \
 	"end" ""
 
 gdb_test_no_output "tstart" "survive the long packet send"
-gdb_test "break end" ".*" ""
+gdb_breakpoint "end" qualified
 gdb_test "continue" \
     "Continuing.*Breakpoint $decimal, end.*" \
     "run trace experiment"
diff --git a/gdb/testsuite/gdb.trace/passc-dyn.exp b/gdb/testsuite/gdb.trace/passc-dyn.exp
index 26ba79a5d0..1738b46234 100644
--- a/gdb/testsuite/gdb.trace/passc-dyn.exp
+++ b/gdb/testsuite/gdb.trace/passc-dyn.exp
@@ -86,7 +86,7 @@ gdb_test "passcount 3 $tdp4" "Setting tracepoint $tdp4's passcount to 3" \
 
 gdb_test "tstart" ".*" ""
 
-gdb_test "break end" ".*" ""
+gdb_breakpoint "end" qualified
 gdb_test "continue" \
     "Continuing.*Breakpoint $decimal, end.*" \
     "run trace experiment"
diff --git a/gdb/testsuite/gdb.trace/qtro.exp b/gdb/testsuite/gdb.trace/qtro.exp
index 5fe1db4afb..830d25f437 100644
--- a/gdb/testsuite/gdb.trace/qtro.exp
+++ b/gdb/testsuite/gdb.trace/qtro.exp
@@ -48,7 +48,7 @@ if ![gdb_target_supports_trace] {
 # frame (IOW, returns while tfind mode is active).
 proc prepare_for_trace_disassembly { } {
     global gdb_prompt
-    gdb_breakpoint "end"
+    gdb_breakpoint "end" qualified
 
     gdb_test "trace subr" "Tracepoint .*" \
 	"tracepoint at subr"
diff --git a/gdb/testsuite/gdb.trace/read-memory.exp b/gdb/testsuite/gdb.trace/read-memory.exp
index 27b23eab06..e91c7fdf74 100644
--- a/gdb/testsuite/gdb.trace/read-memory.exp
+++ b/gdb/testsuite/gdb.trace/read-memory.exp
@@ -42,7 +42,7 @@ proc set_tracepoint_and_collect { } {
 	fail "can't run to main"
 	return -1
     }
-    gdb_test "break end" "Breakpoint \[0-9\] at .*"
+    gdb_breakpoint "end" qualified
     gdb_test "trace start" "Tracepoint \[0-9\] at .*"
     gdb_trace_setactions "set action for tracepoint"  "" \
 	"collect testglob" "^$" \
diff --git a/gdb/testsuite/gdb.trace/report.exp b/gdb/testsuite/gdb.trace/report.exp
index 75a9e1c355..5155165b69 100644
--- a/gdb/testsuite/gdb.trace/report.exp
+++ b/gdb/testsuite/gdb.trace/report.exp
@@ -160,7 +160,7 @@ gdb_trace_setactions "9.x: setup TP to collect expressions" \
 
 gdb_test "tstart" ".*" ""
 
-gdb_test "break end" ".*" ""
+gdb_breakpoint "end" qualified
 gdb_test "continue" \
     "Continuing.*Breakpoint $decimal, end.*" \
     "run trace experiment"
diff --git a/gdb/testsuite/gdb.trace/signal.exp b/gdb/testsuite/gdb.trace/signal.exp
index b2337685da..b860b12d63 100644
--- a/gdb/testsuite/gdb.trace/signal.exp
+++ b/gdb/testsuite/gdb.trace/signal.exp
@@ -66,7 +66,7 @@ if ![runto_main] {
     return -1
 }
 
-gdb_test "break kill" "Breakpoint $decimal at .*"
+gdb_breakpoint "kill" qualified
 gdb_test "handle SIGABRT nostop noprint pass" ".*" "pass SIGABRT"
 
 # Hit the breakpoint on $syscall for the first time.  In this time,
@@ -119,7 +119,7 @@ gdb_test_multiple $test $test {
 }
 
 delete_breakpoints
-gdb_test "break start" "Breakpoint $decimal at .*"
+gdb_breakpoint "start" qualified
 gdb_continue_to_breakpoint "continue to start"
 
 gdb_assert { 0 == [get_integer_valueof "counter" "1"] } "counter is zero"
@@ -135,7 +135,7 @@ set tpnum [get_integer_valueof "\$bpnum" 0]
 gdb_test "trace *$syscall_insn_next" "Tracepoint $decimal at .*" \
     "tracepoint on instruction following syscall instruction"
 
-gdb_test "break end" "Breakpoint $decimal at .*"
+gdb_breakpoint "end" qualified
 
 gdb_test_no_output "tstart"
 gdb_test "continue" ".*Breakpoint.* end .*at.*$srcfile.*" \
diff --git a/gdb/testsuite/gdb.trace/status-stop.exp b/gdb/testsuite/gdb.trace/status-stop.exp
index 551c018b74..378bf2dba9 100644
--- a/gdb/testsuite/gdb.trace/status-stop.exp
+++ b/gdb/testsuite/gdb.trace/status-stop.exp
@@ -51,7 +51,7 @@ proc test_tstart_tstop_tstart { } {
 	gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*"
 	gdb_test_no_output "tstart"
 
-	gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+	gdb_breakpoint "end" qualified
 	gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
 	    "continue to end"
 
@@ -108,7 +108,7 @@ proc test_buffer_full_tstart { } {
 	    "collect buf" "^$"
 
 	gdb_test_no_output "tstart"
-	gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+	gdb_breakpoint "end" qualified
 	gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end"
 
 	gdb_test "tstatus" ".*buffer was full.*"
diff --git a/gdb/testsuite/gdb.trace/strace.exp b/gdb/testsuite/gdb.trace/strace.exp
index 124deb6f7f..4b70674491 100644
--- a/gdb/testsuite/gdb.trace/strace.exp
+++ b/gdb/testsuite/gdb.trace/strace.exp
@@ -185,7 +185,7 @@ proc strace_probe_marker { } {
 	gdb_test "info static-tracepoint-markers" \
 	    "ust/bar\[\t \]+y\[\t \]+$hex .*ust/bar2\[\t \]+y\[\t \]+$hex.*"
 
-	gdb_test "break end" "Breakpoint \[0-9\]+ at.*"
+	gdb_breakpoint "end" qualified
 
 	gdb_test_no_output "tstart"
 	gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
@@ -274,7 +274,7 @@ proc strace_trace_on_same_addr { type } {
 	    }
 	}
 
-	gdb_test "break end" "Breakpoint \[0-9\]+ at.*"
+	gdb_breakpoint "end" qualified
 
 	if [string equal $type "break"] {
 	    gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
@@ -350,7 +350,7 @@ proc strace_trace_on_diff_addr { } {
 	gdb_test "trace *${marker_bar2_addr}" \
 	    "Tracepoint \[0-9\]+ at ${hex}: file.*"
 
-	gdb_test "break end" "Breakpoint \[0-9\]+ at.*"
+	gdb_breakpoint "end" qualified
 
 	gdb_test_no_output "tstart"
 	gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
diff --git a/gdb/testsuite/gdb.trace/tfind.exp b/gdb/testsuite/gdb.trace/tfind.exp
index 251877af37..c466862333 100644
--- a/gdb/testsuite/gdb.trace/tfind.exp
+++ b/gdb/testsuite/gdb.trace/tfind.exp
@@ -127,7 +127,7 @@ if { $return_me == 1 } then {
 # test tstatus (when trace on)
 gdb_test "tstatus" "\[Tt\]race is running.*" "test tstatus on"
 
-gdb_test "break end" ".*" ""
+gdb_breakpoint "end" qualified
 gdb_test "continue" \
     "Continuing.*Breakpoint $decimal, end.*" \
     "run trace experiment"
diff --git a/gdb/testsuite/gdb.trace/trace-break.exp b/gdb/testsuite/gdb.trace/trace-break.exp
index 539fcb5218..84c4780ba2 100644
--- a/gdb/testsuite/gdb.trace/trace-break.exp
+++ b/gdb/testsuite/gdb.trace/trace-break.exp
@@ -53,9 +53,9 @@ proc break_trace_same_addr_1 { trace_type option } \
 
     gdb_test_no_output "set breakpoint always-inserted ${option}"
 
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_breakpoint "end" qualified
 
-    gdb_test "break set_point" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_breakpoint "set_point" qualified
     gdb_test "${trace_type} set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*"
 
     gdb_test_no_output "tstart"
@@ -88,7 +88,7 @@ proc break_trace_same_addr_2 { trace_type1 trace_type2 option } \
 
     gdb_test_no_output "set breakpoint always-inserted ${option}"
 
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_breakpoint "end" qualified
 
     gdb_test "${trace_type1} set_point" \
 	"\(Fast t|T\)racepoint \[0-9\] at $hex: file.*" \
@@ -126,10 +126,10 @@ proc break_trace_same_addr_3 { trace_type option } \
     }
 
     gdb_test_no_output "set breakpoint always-inserted ${option}"
-    gdb_test "break marker" "Breakpoint \[0-9\] at $hex: file.*"
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_breakpoint "marker" qualified
+    gdb_breakpoint "end" qualified
 
-    gdb_test "break set_point" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_breakpoint "set_point" qualified
     gdb_test "${trace_type} set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*"
 
     gdb_test_no_output "tstart"
@@ -164,10 +164,10 @@ proc break_trace_same_addr_4 { trace_type option } \
     }
 
     gdb_test_no_output "set breakpoint always-inserted ${option}"
-    gdb_test "break marker" "Breakpoint \[0-9\] at $hex: file.*"
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_breakpoint "marker" qualified
+    gdb_breakpoint "end" qualified
 
-    gdb_test "break set_point" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_breakpoint "set_point" qualified
     gdb_test "${trace_type} set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*"
 
     gdb_test "continue" "Continuing\\.\[ \r\n\]+(Thread .* hit )?Breakpoint.*" \
@@ -207,8 +207,8 @@ proc break_trace_same_addr_5 { trace1 trace2 trace3 trace3_at_first_loc } \
 	return -1
     }
 
-    gdb_test "break marker" "Breakpoint \[0-9\] at $hex: file.*"
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_breakpoint "marker" qualified
+    gdb_breakpoint "end" qualified
 
     gdb_test "${trace1} set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*" \
 	"${trace1} set_point 1"
@@ -281,8 +281,8 @@ proc break_trace_same_addr_6 { trace1 enable1 trace2 enable2 } \
 	return -1
     }
 
-    gdb_test "break marker" "Breakpoint \[0-9\] at $hex: file.*"
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_breakpoint "marker" qualified
+    gdb_breakpoint "end" qualified
 
     gdb_test "continue" "Continuing\\.\[ \r\n\]+(Thread .* hit )?Breakpoint.*" \
 	"continue to marker"
diff --git a/gdb/testsuite/gdb.trace/trace-condition.exp b/gdb/testsuite/gdb.trace/trace-condition.exp
index 12a42ffb92..d23e6a3f5b 100644
--- a/gdb/testsuite/gdb.trace/trace-condition.exp
+++ b/gdb/testsuite/gdb.trace/trace-condition.exp
@@ -71,9 +71,9 @@ proc test_tracepoints { trace_command condition num_frames { kfail_proc 0 } } {
 	return 0
     }
 
-    gdb_test "break begin" ".*" ""
+    gdb_breakpoint "begin" qualified
 
-    gdb_test "break end" ".*" ""
+    gdb_breakpoint "end" qualified
 
     with_test_prefix "${trace_command}: ${condition}" {
 
diff --git a/gdb/testsuite/gdb.trace/trace-mt.exp b/gdb/testsuite/gdb.trace/trace-mt.exp
index f327406a13..6e18666111 100644
--- a/gdb/testsuite/gdb.trace/trace-mt.exp
+++ b/gdb/testsuite/gdb.trace/trace-mt.exp
@@ -81,7 +81,7 @@ proc break_trace_same_addr { trace_type option } \
 
     gdb_test_no_output "set breakpoint always-inserted ${option}"
 
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_breakpoint "end" qualified
 
     gdb_test "break set_point1" "Breakpoint \[0-9\] at $hex: file.*"
     gdb_test "${trace_type} set_point1" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*"
diff --git a/gdb/testsuite/gdb.trace/tstatus.exp b/gdb/testsuite/gdb.trace/tstatus.exp
index d24c03738a..3498b1c13c 100644
--- a/gdb/testsuite/gdb.trace/tstatus.exp
+++ b/gdb/testsuite/gdb.trace/tstatus.exp
@@ -119,9 +119,9 @@ proc run_trace_experiment {} {
 proc test_tracepoints {} {
     global gdb_prompt
 
-    gdb_test "break begin" ".*" ""
+    gdb_breakpoint "begin" qualified
 
-    gdb_test "break end" ".*" ""
+    gdb_breakpoint "end" qualified
 
     gdb_test "trace gdb_c_test" "Tracepoint .*" \
 	"tracepoint at gdb_c_test"
diff --git a/gdb/testsuite/gdb.trace/tsv.exp b/gdb/testsuite/gdb.trace/tsv.exp
index e08c668c50..a86919a75d 100644
--- a/gdb/testsuite/gdb.trace/tsv.exp
+++ b/gdb/testsuite/gdb.trace/tsv.exp
@@ -136,7 +136,7 @@ gdb_test "print \$tvar5" " = 15" \
     "Print a trace state variable at start of run"
 
 # Be sure not to fall off the end of the program.
-gdb_test "break end" ".*" ""
+gdb_breakpoint "end" qualified
 gdb_test "continue" \
     "Continuing.*Breakpoint $decimal, end.*" \
     "run trace experiment"
diff --git a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
index 99f4fbe05c..9fd3a739a7 100644
--- a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
+++ b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
@@ -303,7 +303,7 @@ if ![gdb_target_supports_trace] {
     return -1
 }
 
-gdb_breakpoint "end"
+gdb_breakpoint "end" qualified
 
 with_test_prefix "tracing foo" {
     gdb_test "trace *foo_start_lbl" ".*"
diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp
index 79aa8ef1b0..181c9af8aa 100644
--- a/gdb/testsuite/gdb.trace/unavailable.exp
+++ b/gdb/testsuite/gdb.trace/unavailable.exp
@@ -61,8 +61,8 @@ proc prepare_for_trace_test {} {
 
     runto_main
 
-    gdb_test "break begin" ".*" ""
-    gdb_test "break end" ".*" ""
+    gdb_breakpoint "begin" qualified
+    gdb_breakpoint "end" qualified
 }
 
 proc run_trace_experiment { test_func } {
diff --git a/gdb/testsuite/gdb.trace/while-dyn.exp b/gdb/testsuite/gdb.trace/while-dyn.exp
index 6728aeda64..0fb6b47b0b 100644
--- a/gdb/testsuite/gdb.trace/while-dyn.exp
+++ b/gdb/testsuite/gdb.trace/while-dyn.exp
@@ -72,7 +72,7 @@ proc test_while_stepping { while_stepping } {
 
     gdb_test "tstart" ".*" ""
 
-    gdb_test "break end" ".*" ""
+    gdb_breakpoint "end" qualified
     gdb_test "continue" \
 	"Continuing.*Breakpoint $decimal, end.*" \
 	"$while_stepping: run trace experiment"
-- 
2.14.3
Simon Marchi March 16, 2018, 9:57 p.m. | #3
On 2018-03-16 03:47 PM, Andreas Arnez wrote:
> On Thu, Mar 15 2018, Simon Marchi wrote:

> 

>> On 2018-03-14 12:11 PM, Andreas Arnez wrote:

>>> Some of GDB's trace test cases define a function end() and place a

>>> breakpoint there with "break end".  However, when libinproctrace is linked

>>> to the binary, there are multiple methods named "end", such as

>>> std::string::end() from the C++ library or format_pieces::end() from

>>> common/format.h.  GDB then creates multiple breakpoints instead of just a

>>> single one, and some FAILs result, such as these:

>>>

>>>   FAIL: gdb.trace/trace-mt.exp: ftrace on: break end

>>>   FAIL: gdb.trace/trace-mt.exp: ftrace off: break end

>>>

>>> This is fixed by renaming end() to my_end().  For consistency, where end()

>>> was paired with a previous begin(), the latter is renamed to my_begin() as

>>> well.

>>>

>>> gdb/testsuite/ChangeLog:

>>>

>>> 	* gdb.trace/trace-break.c (end): Rename to...

>>> 	(my_end): ...this.

>>> 	(main): Adjust call.

>>> 	* gdb.trace/trace-mt.c (end): Rename to...

>>> 	(my_end): ...this.

>>> 	(main): Adjust call.

>>> 	* gdb.trace/unavailable.cc (begin): Rename to...

>>> 	(my_begin): ...this.

>>> 	(end): Rename to...

>>> 	(my_end): ...this.

>>> 	(main): Adjust calls.

>>> 	* gdb.trace/trace-break.exp: Reflect function name change.

>>> 	* gdb.trace/trace-mt.exp: Likewise.

>>> 	* gdb.trace/unavailable.exp: Likewise.

>>

>> Hi Andreas,

>>

>> Another way would have been to pass "-qualified" to the break command,

>> or use gdb_breakpoint and pass the "qualified" arg.  There are also

>> other instances of the same "problem" in tests that don't check the

>> output of the break command at all...

>>

>>   gdb_test "break end" ".*" ""

>>

>> In any case, this patch LGTM.

> 

> Hm, actually the use of "-qualified" is a good point.  I'd rather go

> with that.  How about the patch below?

> 

> --

> Andreas

> 

> -- >8 --

> Subject: [PATCH] Testsuite: Fix ambiguous "break" due to libinproctrace

> 

> Some of GDB's trace test cases define a function end() and place a

> breakpoint there with "break end".  However, when libinproctrace is linked

> to the binary, there are multiple methods named "end", such as

> std::string::end() from the C++ library or format_pieces::end() from

> common/format.h.  GDB then creates multiple breakpoints instead of just a

> single one, and some FAILs result, such as these:

> 

>   FAIL: gdb.trace/trace-mt.exp: ftrace on: break end

>   FAIL: gdb.trace/trace-mt.exp: ftrace off: break end

> 

> Fix this by adding the "-qualified" option to the break commands.  For

> consistency, change all occurrences of "break end" (and similar) in all

> trace test cases, even if the current behavior does not cause problems.

> Also, consequently use the gdb_breakpoint convenience proc.

> 

> gdb/testsuite/ChangeLog:

> 

> 	* gdb.trace/actions-changed.exp: Call gdb_breakpoint with the

> 	"qualified" option when setting breakpoints.

> 	* gdb.trace/backtrace.exp: Likewise.

> 	* gdb.trace/circ.exp: Likewise.

> 	* gdb.trace/collection.exp: Likewise.

> 	* gdb.trace/disconnected-tracing.exp: Likewise.

> 	* gdb.trace/ftrace-lock.exp: Likewise.

> 	* gdb.trace/ftrace.exp: Likewise.

> 	* gdb.trace/infotrace.exp: Likewise.

> 	* gdb.trace/packetlen.exp: Likewise.

> 	* gdb.trace/passc-dyn.exp: Likewise.

> 	* gdb.trace/qtro.exp: Likewise.

> 	* gdb.trace/read-memory.exp: Likewise.

> 	* gdb.trace/report.exp: Likewise.

> 	* gdb.trace/signal.exp: Likewise.

> 	* gdb.trace/status-stop.exp: Likewise.

> 	* gdb.trace/strace.exp: Likewise.

> 	* gdb.trace/tfind.exp: Likewise.

> 	* gdb.trace/trace-break.exp: Likewise.

> 	* gdb.trace/trace-condition.exp: Likewise.

> 	* gdb.trace/trace-mt.exp: Likewise.

> 	* gdb.trace/tstatus.exp: Likewise.

> 	* gdb.trace/tsv.exp: Likewise.

> 	* gdb.trace/unavailable-dwarf-piece.exp: Likewise.

> 	* gdb.trace/unavailable.exp: Likewise.

> 	* gdb.trace/while-dyn.exp: Likewise.


Hi Andreas,

Since the gdb_breakpoint proc accepts the multi-location printout, we may
not even need the "qualified", just using gdb_breakpoint would be sufficient.
But I think it's not bad either to use "qualified", as it makes the test more
robust.  It makes sure the test doesn't stop on another random end function/method.

So this LGTM, thanks.

Simon
Andreas Arnez March 19, 2018, 12:15 p.m. | #4
On Fri, Mar 16 2018, Simon Marchi wrote:

> Since the gdb_breakpoint proc accepts the multi-location printout, we may

> not even need the "qualified", just using gdb_breakpoint would be sufficient.

> But I think it's not bad either to use "qualified", as it makes the test more

> robust.  It makes sure the test doesn't stop on another random end function/method.


Right, these random breakpoints could hit us badly in the future.

> So this LGTM, thanks.


Thanks, pushed.

--
Andreas
Pedro Alves March 26, 2018, 2:44 p.m. | #5
On 03/16/2018 07:47 PM, Andreas Arnez wrote:

> Subject: [PATCH] Testsuite: Fix ambiguous "break" due to libinproctrace

> 

> Some of GDB's trace test cases define a function end() and place a

> breakpoint there with "break end".  However, when libinproctrace is linked

> to the binary, there are multiple methods named "end", such as

> std::string::end() from the C++ library or format_pieces::end() from

> common/format.h.  GDB then creates multiple breakpoints instead of just a

> single one, and some FAILs result, such as these:

> 

>   FAIL: gdb.trace/trace-mt.exp: ftrace on: break end

>   FAIL: gdb.trace/trace-mt.exp: ftrace off: break end

> 

> Fix this by adding the "-qualified" option to the break commands.  For

> consistency, change all occurrences of "break end" (and similar) in all

> trace test cases, even if the current behavior does not cause problems.

> Also, consequently use the gdb_breakpoint convenience proc.

I agree this is the right patch for now.  I actually posted something
like this a while ago, but forgot to push it in:

 https://sourceware.org/ml/gdb-patches/2017-12/msg00123.html

Note that I think it's a design flaw that users can run into this, though.
I had filed:

  https://sourceware.org/bugzilla/show_bug.cgi?id=22560

Thanks,
Pedro Alves

Patch

diff --git a/gdb/testsuite/gdb.trace/trace-break.c b/gdb/testsuite/gdb.trace/trace-break.c
index 6aa9d09214..3349066dcc 100644
--- a/gdb/testsuite/gdb.trace/trace-break.c
+++ b/gdb/testsuite/gdb.trace/trace-break.c
@@ -31,13 +31,13 @@  marker (void)
 }
 
 static void
-end (void)
+my_end (void)
 {}
 
 int
 main ()
 {
   marker ();
-  end ();
+  my_end ();
   return 0;
 }
diff --git a/gdb/testsuite/gdb.trace/trace-break.exp b/gdb/testsuite/gdb.trace/trace-break.exp
index 539fcb5218..602b2e23ec 100644
--- a/gdb/testsuite/gdb.trace/trace-break.exp
+++ b/gdb/testsuite/gdb.trace/trace-break.exp
@@ -53,7 +53,7 @@  proc break_trace_same_addr_1 { trace_type option } \
 
     gdb_test_no_output "set breakpoint always-inserted ${option}"
 
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "break my_end" "Breakpoint \[0-9\] at $hex: file.*"
 
     gdb_test "break set_point" "Breakpoint \[0-9\] at $hex: file.*"
     gdb_test "${trace_type} set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*"
@@ -88,7 +88,7 @@  proc break_trace_same_addr_2 { trace_type1 trace_type2 option } \
 
     gdb_test_no_output "set breakpoint always-inserted ${option}"
 
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "break my_end" "Breakpoint \[0-9\] at $hex: file.*"
 
     gdb_test "${trace_type1} set_point" \
 	"\(Fast t|T\)racepoint \[0-9\] at $hex: file.*" \
@@ -127,7 +127,7 @@  proc break_trace_same_addr_3 { trace_type option } \
 
     gdb_test_no_output "set breakpoint always-inserted ${option}"
     gdb_test "break marker" "Breakpoint \[0-9\] at $hex: file.*"
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "break my_end" "Breakpoint \[0-9\] at $hex: file.*"
 
     gdb_test "break set_point" "Breakpoint \[0-9\] at $hex: file.*"
     gdb_test "${trace_type} set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*"
@@ -165,7 +165,7 @@  proc break_trace_same_addr_4 { trace_type option } \
 
     gdb_test_no_output "set breakpoint always-inserted ${option}"
     gdb_test "break marker" "Breakpoint \[0-9\] at $hex: file.*"
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "break my_end" "Breakpoint \[0-9\] at $hex: file.*"
 
     gdb_test "break set_point" "Breakpoint \[0-9\] at $hex: file.*"
     gdb_test "${trace_type} set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*"
@@ -208,7 +208,7 @@  proc break_trace_same_addr_5 { trace1 trace2 trace3 trace3_at_first_loc } \
     }
 
     gdb_test "break marker" "Breakpoint \[0-9\] at $hex: file.*"
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "break my_end" "Breakpoint \[0-9\] at $hex: file.*"
 
     gdb_test "${trace1} set_point" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*" \
 	"${trace1} set_point 1"
@@ -282,7 +282,7 @@  proc break_trace_same_addr_6 { trace1 enable1 trace2 enable2 } \
     }
 
     gdb_test "break marker" "Breakpoint \[0-9\] at $hex: file.*"
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "break my_end" "Breakpoint \[0-9\] at $hex: file.*"
 
     gdb_test "continue" "Continuing\\.\[ \r\n\]+(Thread .* hit )?Breakpoint.*" \
 	"continue to marker"
diff --git a/gdb/testsuite/gdb.trace/trace-mt.c b/gdb/testsuite/gdb.trace/trace-mt.c
index 6f04ba7775..37d1ee0ea5 100644
--- a/gdb/testsuite/gdb.trace/trace-mt.c
+++ b/gdb/testsuite/gdb.trace/trace-mt.c
@@ -25,7 +25,7 @@  thread_function(void *arg)
 }
 
 static void
-end (void)
+my_end (void)
 {}
 
 int
@@ -40,7 +40,7 @@  main (int argc, char *argv[], char *envp[])
   for (i = 0; i < 2; i++)
     pthread_join (threads[i], NULL);
 
-  end ();
+  my_end ();
 
   return 0;
 }
diff --git a/gdb/testsuite/gdb.trace/trace-mt.exp b/gdb/testsuite/gdb.trace/trace-mt.exp
index f327406a13..bd89c9bec2 100644
--- a/gdb/testsuite/gdb.trace/trace-mt.exp
+++ b/gdb/testsuite/gdb.trace/trace-mt.exp
@@ -81,7 +81,7 @@  proc break_trace_same_addr { trace_type option } \
 
     gdb_test_no_output "set breakpoint always-inserted ${option}"
 
-    gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+    gdb_test "break my_end" "Breakpoint \[0-9\] at $hex: file.*"
 
     gdb_test "break set_point1" "Breakpoint \[0-9\] at $hex: file.*"
     gdb_test "${trace_type} set_point1" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*"
diff --git a/gdb/testsuite/gdb.trace/unavailable.cc b/gdb/testsuite/gdb.trace/unavailable.cc
index 56e5541259..aa4aeef65f 100644
--- a/gdb/testsuite/gdb.trace/unavailable.cc
+++ b/gdb/testsuite/gdb.trace/unavailable.cc
@@ -174,12 +174,12 @@  Virtual *virtualp = &virtual_partial;
 /* Test functions.  */
 
 static void
-begin ()	/* called before anything else */
+my_begin ()	/* called before anything else */
 {
 }
 
 static void
-end ()		/* called after everything else */
+my_end ()		/* called after everything else */
 {
 }
 
@@ -325,7 +325,7 @@  main (int argc, char **argv, char **envp)
   test_struct mystruct;
   int         myarray[4];
 
-  begin ();
+  my_begin ();
   /* Assign collectable values to global variables.  */
   globalc = 71;
   globali = 72;
@@ -395,6 +395,6 @@  main (int argc, char **argv, char **envp)
   g_structref.clear ();
   g_structref_p = NULL;
 
-  end ();
+  my_end ();
   return 0;
 }
diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp
index 79aa8ef1b0..7e8fc8b303 100644
--- a/gdb/testsuite/gdb.trace/unavailable.exp
+++ b/gdb/testsuite/gdb.trace/unavailable.exp
@@ -61,21 +61,21 @@  proc prepare_for_trace_test {} {
 
     runto_main
 
-    gdb_test "break begin" ".*" ""
-    gdb_test "break end" ".*" ""
+    gdb_test "break my_begin" ".*" ""
+    gdb_test "break my_end" ".*" ""
 }
 
 proc run_trace_experiment { test_func } {
     global gdb_prompt
 
     gdb_test "continue" \
-	".*Breakpoint \[0-9\]+, begin .*" \
-	"advance to begin"
+	".*Breakpoint \[0-9\]+, my_begin .*" \
+	"advance to my_begin"
 
     gdb_test_no_output "tstart" "start trace experiment"
 
     gdb_test "continue" \
-	    "Continuing.*Breakpoint \[0-9\]+, end.*" \
+	    "Continuing.*Breakpoint \[0-9\]+, my_end.*" \
 	    "run trace experiment"
     gdb_test "tstop" \
 	    "\[\r\n\]+" \
@@ -189,7 +189,7 @@  proc gdb_collect_args_test {} {
 	gdb_collect_args_test_1
 
 	gdb_test "tfind none" \
-	    "#0  end .*" \
+	    "#0  my_end .*" \
 	    "cease trace debugging"
 
 	set tracefile [standard_output_file ${testfile}]
@@ -273,7 +273,7 @@  proc gdb_collect_locals_test { func msg } {
 	gdb_collect_locals_test_1 $func
 
 	gdb_test "tfind none" \
-	    "#0  end .*" \
+	    "#0  my_end .*" \
 	    "cease trace debugging"
 
 	set tracefile [standard_output_file ${testfile}]
@@ -357,7 +357,7 @@  proc gdb_unavailable_registers_test { } {
 
 	gdb_unavailable_registers_test_1
 
-	gdb_test "tfind none" "#0  end .*" "cease trace debugging"
+	gdb_test "tfind none" "#0  my_end .*" "cease trace debugging"
 
 	set tracefile [standard_output_file ${testfile}]
 	gdb_test "tsave ${tracefile}.registers.tfile" \
@@ -421,7 +421,7 @@  proc gdb_unavailable_floats { } {
 
 	gdb_unavailable_floats_1
 
-	gdb_test "tfind none" "#0  end .*" "cease trace debugging"
+	gdb_test "tfind none" "#0  my_end .*" "cease trace debugging"
 
 	set tracefile [standard_output_file ${testfile}]
 	gdb_test "tsave ${tracefile}.floats.tfile" \
@@ -688,7 +688,7 @@  proc gdb_collect_globals_test { } {
 	gdb_collect_globals_test_1
 
 	gdb_test "tfind none" \
-	    "#0  end .*" \
+	    "#0  my_end .*" \
 	    "cease trace debugging"
 
 	set tracefile [standard_output_file ${testfile}]