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.
This commit is contained in:
Andreas Arnez 2018-03-19 13:13:09 +01:00
parent 315aa1cf83
commit 194ed4130d
26 changed files with 79 additions and 50 deletions

View File

@ -1,3 +1,32 @@
2018-03-19 Andreas Arnez <arnez@linux.vnet.ibm.com>
* 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.
2018-03-16 Andreas Arnez <arnez@linux.vnet.ibm.com>
* gdb.trace/tspeed.exp: Add invocation of gdb_load_shlib to ensure

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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 } {

View File

@ -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"

View File

@ -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"

View File

@ -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" ".*" ""

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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" "^$" \

View File

@ -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"

View File

@ -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.*" \

View File

@ -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.*"

View File

@ -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.*" \

View File

@ -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"

View File

@ -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"

View File

@ -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}" {

View File

@ -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.*"

View File

@ -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"

View File

@ -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"

View File

@ -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" ".*"

View File

@ -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 } {

View File

@ -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"