2016-01-01 05:33:14 +01:00
|
|
|
# Copyright 2013-2016 Free Software Foundation, Inc.
|
2013-05-23 19:19:05 +02:00
|
|
|
|
|
|
|
# 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/>.
|
|
|
|
|
|
|
|
load_lib "trace-support.exp"
|
|
|
|
load_lib "range-stepping-support.exp"
|
|
|
|
|
|
|
|
standard_testfile
|
|
|
|
set executable $testfile
|
|
|
|
|
|
|
|
if [prepare_for_testing $testfile.exp $executable $srcfile \
|
|
|
|
{debug nowarnings}] {
|
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
|
|
|
if ![runto_main] {
|
2016-12-01 21:40:05 +01:00
|
|
|
fail "can't run to main to check for trace support"
|
2013-05-23 19:19:05 +02:00
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
|
|
|
if ![gdb_target_supports_trace] {
|
|
|
|
unsupported "target does not support trace"
|
2013-06-07 19:31:09 +02:00
|
|
|
return -1
|
2013-05-23 19:19:05 +02:00
|
|
|
}
|
|
|
|
|
2015-07-15 15:33:32 +02:00
|
|
|
if ![gdb_range_stepping_enabled] {
|
|
|
|
unsupported "range stepping not supported by the target"
|
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
2013-05-23 19:19:05 +02:00
|
|
|
# Check that range stepping works well with tracepoints.
|
|
|
|
|
|
|
|
proc range_stepping_with_tracepoint { type } {
|
|
|
|
with_test_prefix "${type}" {
|
|
|
|
gdb_breakpoint [gdb_get_line_number "location 1"]
|
|
|
|
gdb_continue_to_breakpoint "location 1"
|
|
|
|
delete_breakpoints
|
|
|
|
|
|
|
|
gdb_test "${type} *set_point" ".*"
|
|
|
|
gdb_test_no_output "tstart"
|
|
|
|
|
|
|
|
# Step a line with a tracepoint in the middle. The tracepoint
|
|
|
|
# itself shouldn't have any effect on range stepping. We
|
Remove checking vCont;s in exec_cmd_expect_vCont_count
Nowadays, in the range-stepping tests, we check not only the number of
vCont;r packets but also the number of vCont;s packets, because we think
the remote target which can do range stepping must support single step.
However, if we turn displaced stepping on, the remote target (GDBserver)
can do range stepping, and support single step, but GDB may decide to
resume instructions in the scratchpad rather than single step them one
by one for displaced stepping. For example, when aarch64 GDB debugs
arm linux program with aarch64 GDBserver, GDBserver supports both range
stepping and single step, but GDB (with the gdbarch for arm-linux)
decides resume instructions in the scratchpad, so in the RSP traffic,
there is no vCont;s packet at all, and some range-stepping.exp tests
fail,
FAIL: gdb.base/range-stepping.exp: multi insns: next: vCont;s=1 vCont;r=1
This patch is to get rid of the checking to the number of vCont;s in
exec_cmd_expect_vCont_count.
gdb/testsuite:
2015-10-21 Yao Qi <yao.qi@linaro.org>
* lib/range-stepping-support.exp (exec_cmd_expect_vCont_count):
Remove argument exp_vCont_s.
* gdb.base/range-stepping.exp: Callers updated.
* gdb.trace/range-stepping.exp: Likewise.
2015-10-21 17:16:25 +02:00
|
|
|
# should see one vCont;r.
|
|
|
|
exec_cmd_expect_vCont_count "step" 1
|
2013-05-23 19:19:05 +02:00
|
|
|
gdb_test_no_output "tstop"
|
|
|
|
gdb_test "tfind" "Found trace frame .*" "first tfind"
|
|
|
|
gdb_test "tfind" \
|
|
|
|
"Target failed to find requested trace frame.*" \
|
|
|
|
"second tfind"
|
|
|
|
|
|
|
|
delete_breakpoints
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
range_stepping_with_tracepoint "trace"
|
|
|
|
|
|
|
|
set libipa [get_in_proc_agent]
|
ftrace tests: Use gdb_load_shlib result to lookup IPA in info sharedlibrary
Some fast tracepoints tests make sure that the in-process agent library
is properly loaded, by searching for the library name in "info
sharedlibrary".
Originally, it would search for the full path. Since patch "Make ftrace
tests work with remote targets" [1], the "runtime" location of the IPA,
in the standard output directory, is not the same as the original
location, in the gdbserver build directory. Therefore, the patch
changed the checks:
gdb_test "info sharedlibrary" ".*${libipa}.*" "IPA loaded"
to
gdb_test "info sharedlibrary" ".*[file tail ${libipa}].*" "IPA loaded"
so that only the "libinproctrace.so" part would be searched for.
Antoine (in CC) pointed out that I missed some, so I have to update
them. In the mean time, I noticed that I missed a few test failures:
adding the SONAME to the IPA makes it possible for the test executable
to erroneously pick up libinproctrace.so from /usr/lib if the test
harness failed to put the libinproctrace.so we want to test in the right
place. To mitigate that kind of error in the future, we can use the
return value of gdb_load_shlib (the path of the "runtime" version of the
library) and use that to search in the output of info sharedlibrary.
When testing locally, gdb_load_shlib returns the full normalized path of
the destination library, which the test executable should use e.g.:
/path/to/gdb/testsuite/outputs/gdb.trace/thetest/libinproctrace.so
My testing showed that it was the same path that gdb displayed in info
sharedlibrary. If the test executable picks up another
libinproctrace.so, the test will fail.
When testing remotely, gdb_load_shlib/gdb_remote_download only returns
us "libinproctrace.so", so the situation doesn't really change. If
there is a rogue libinproctrace.so in /usr/lib on the target and we fail
to download ours, it might cover up a test failure. But that situation
is probably still better than the original one, where it wasn't possible
to test remotely using the IPA at all.
[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=6e774b13c3b81ac2599812adf058796948ce7e95
gdb/testsuite/ChangeLog:
* gdb.arch/ftrace-insn-reloc.exp: Save gdb_load_shlib result,
use it in info sharedlibrary test.
* gdb.trace/ftrace-lock.exp: Likewise.
* gdb.trace/ftrace.exp: Likewise.
* gdb.trace/range-stepping.exp: Likewise.
* gdb.trace/trace-break.exp: Likewise.
* gdb.trace/trace-condition.exp: Likewise.
* gdb.trace/trace-mt.exp: Likewise.
2016-04-28 15:49:01 +02:00
|
|
|
set remote_libipa [gdb_load_shlib $libipa]
|
2013-05-23 19:19:05 +02:00
|
|
|
|
|
|
|
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
|
|
|
|
executable [list debug nowarnings shlib=$libipa] ] != "" } {
|
2016-12-01 21:47:50 +01:00
|
|
|
untested "failed to compile"
|
2013-05-23 19:19:05 +02:00
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
|
|
|
clean_restart ${executable}
|
|
|
|
|
|
|
|
if ![runto_main] {
|
2016-12-01 21:40:05 +01:00
|
|
|
fail "can't run to main for ftrace tests"
|
2013-05-23 19:19:05 +02:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
ftrace tests: Use gdb_load_shlib result to lookup IPA in info sharedlibrary
Some fast tracepoints tests make sure that the in-process agent library
is properly loaded, by searching for the library name in "info
sharedlibrary".
Originally, it would search for the full path. Since patch "Make ftrace
tests work with remote targets" [1], the "runtime" location of the IPA,
in the standard output directory, is not the same as the original
location, in the gdbserver build directory. Therefore, the patch
changed the checks:
gdb_test "info sharedlibrary" ".*${libipa}.*" "IPA loaded"
to
gdb_test "info sharedlibrary" ".*[file tail ${libipa}].*" "IPA loaded"
so that only the "libinproctrace.so" part would be searched for.
Antoine (in CC) pointed out that I missed some, so I have to update
them. In the mean time, I noticed that I missed a few test failures:
adding the SONAME to the IPA makes it possible for the test executable
to erroneously pick up libinproctrace.so from /usr/lib if the test
harness failed to put the libinproctrace.so we want to test in the right
place. To mitigate that kind of error in the future, we can use the
return value of gdb_load_shlib (the path of the "runtime" version of the
library) and use that to search in the output of info sharedlibrary.
When testing locally, gdb_load_shlib returns the full normalized path of
the destination library, which the test executable should use e.g.:
/path/to/gdb/testsuite/outputs/gdb.trace/thetest/libinproctrace.so
My testing showed that it was the same path that gdb displayed in info
sharedlibrary. If the test executable picks up another
libinproctrace.so, the test will fail.
When testing remotely, gdb_load_shlib/gdb_remote_download only returns
us "libinproctrace.so", so the situation doesn't really change. If
there is a rogue libinproctrace.so in /usr/lib on the target and we fail
to download ours, it might cover up a test failure. But that situation
is probably still better than the original one, where it wasn't possible
to test remotely using the IPA at all.
[1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=6e774b13c3b81ac2599812adf058796948ce7e95
gdb/testsuite/ChangeLog:
* gdb.arch/ftrace-insn-reloc.exp: Save gdb_load_shlib result,
use it in info sharedlibrary test.
* gdb.trace/ftrace-lock.exp: Likewise.
* gdb.trace/ftrace.exp: Likewise.
* gdb.trace/range-stepping.exp: Likewise.
* gdb.trace/trace-break.exp: Likewise.
* gdb.trace/trace-condition.exp: Likewise.
* gdb.trace/trace-mt.exp: Likewise.
2016-04-28 15:49:01 +02:00
|
|
|
if { [gdb_test "info sharedlibrary" ".*${remote_libipa}.*" "IPA loaded"] != 0 } {
|
2016-12-01 21:40:05 +01:00
|
|
|
untested "could not find IPA lib loaded"
|
2013-05-23 19:19:05 +02:00
|
|
|
} else {
|
|
|
|
range_stepping_with_tracepoint "ftrace"
|
|
|
|
}
|