[testsuite] Clean up gdb.trace results
Commit Message
On 10/07/2018 08:24 PM, Simon Marchi wrote:
> Thanks for this, fixes to make the testsuite run more cleanly is always
> appreciated.
>
> I just did a quick smoke check, and noticed some errors when running on
> x86:
>
> Running
> /home/emaisin/src/binutils-gdb/gdb/testsuite/gdb.trace/signal.exp ...
> ERROR: no fileid for elxacz23q12
>
> (elxacz23q12 is my hostname)
>
> This looks like a check done a bit too early. Can you make sure that
> these tests:
>
> $ make check TESTS="gdb.trace/*.exp"
> $ make check TESTS="gdb.trace/*.exp"
> RUNTESTFLAGS="--target_board=native-gdbserver"
> $ make check TESTS="gdb.trace/*.exp"
> RUNTESTFLAGS="--target_board=native-extended-gdbserver"
>
> Don't have significant differences before/after your patch (on
> x86/Linux)? If you don't see any difference, maybe the problem is on my
> side, then I'll look into it.
Thanks, I tried that and made a couple tweaks to the patch to fix those
errors. Is this version OK?
-Sandra
Comments
On 2018-10-10 22:01, Sandra Loosemore wrote:
> Thanks, I tried that and made a couple tweaks to the patch to fix
> those errors. Is this version OK?
>
> -Sandra
Hi Sandra,
I'd just like to understand the situation a bit more. From what I
understand, trace-common.h is only useful for fast tracepoint tests.
Let's take the actions.exp test, for example. It uses actions.c, which
includes trace-common.h, therefore you added a
gdb_trace_common_supports_arch check. However, actions.exp does not
rely on fast tracepoint support at all. actions.c happens to be used by
another test that tests fast tracepoints. The result is that if an
architecture supports tracepoints, but not fast tracepoints, the
actions.exp test will be skipped even though it would be relevant.
Trying to read between the lines: if your target did not support
tracepoints at all, then the gdb_target_supports_trace calls would be
enough. If your target did support regular and fast tracepoints, then
you would just add support for it in trace-common.h, because you would
want to run the fast tracepoint tests. So the remaining combination is
that your target supports regular tracepoints, but not fast tracepoints.
Is it the case?
If so, I think the right fix would be to untangle fast tracepoints tests
from regular tracepoints tests. The goal being to make it possible to
run as many tests as possible against targets that only support regular
tracepoints.
Or maybe I'm completely lost, in which case can you clarify what your
use case is?
Thanks,
Simon
On 10/10/2018 10:08 PM, Simon Marchi wrote:
> On 2018-10-10 22:01, Sandra Loosemore wrote:
>> Thanks, I tried that and made a couple tweaks to the patch to fix
>> those errors. Is this version OK?
>>
>> -Sandra
>
> Hi Sandra,
>
> I'd just like to understand the situation a bit more. From what I
> understand, trace-common.h is only useful for fast tracepoint tests.
> Let's take the actions.exp test, for example. It uses actions.c, which
> includes trace-common.h, therefore you added a
> gdb_trace_common_supports_arch check. However, actions.exp does not
> rely on fast tracepoint support at all. actions.c happens to be used by
> another test that tests fast tracepoints. The result is that if an
> architecture supports tracepoints, but not fast tracepoints, the
> actions.exp test will be skipped even though it would be relevant.
If the architecture isn't one of those supported by trace-common.h, then
actions.c (or any other program that includes trace-common.h) won't
compile. E.g. here is a recent gdb.sum extract for nios2-elf (using gdb
8.2 branch):
Running
/scratch/sandra/nios2-elf-fall-preview/src/gdb-master-8.2/gdb/testsuite/gdb.trace/actions.exp
...
gdb compile failed, In file included from
/scratch/sandra/nios2-elf-fall-preview/src/gdb-master-8.2/gdb/testsuite/gdb.trace/actions.c:24:
/scratch/sandra/nios2-elf-fall-preview/src/gdb-master-8.2/gdb/testsuite/gdb.trace/trace-common.h:61:2:
error: #error "unsupported architecture for trace tests"
#error "unsupported architecture for trace tests"
^~~~~
/scratch/sandra/nios2-elf-fall-preview/src/gdb-master-8.2/gdb/testsuite/gdb.trace/actions.c:
In function 'main':
/scratch/sandra/nios2-elf-fall-preview/src/gdb-master-8.2/gdb/testsuite/gdb.trace/actions.c:146:26:
error: 'fast_tracepoint_loc' undeclared (first use in this function)
FAST_TRACEPOINT_LABEL (fast_tracepoint_loc);
^~~~~~~~~~~~~~~~~~~
/scratch/sandra/nios2-elf-fall-preview/src/gdb-master-8.2/gdb/testsuite/gdb.trace/actions.c:146:26:
note: each undeclared identifier is reported only once for each function
it appears in
UNTESTED: gdb.trace/actions.exp: failed to compile
My patch does not change what targets the tests work on, it only makes
it fail gracefully with UNSUPPORTED instead of spewing a bunch of
compilation errors into the gdb.sum file and reporting UNTESTED.
> Trying to read between the lines: if your target did not support
> tracepoints at all, then the gdb_target_supports_trace calls would be
> enough. If your target did support regular and fast tracepoints, then
> you would just add support for it in trace-common.h, because you would
> want to run the fast tracepoint tests. So the remaining combination is
> that your target supports regular tracepoints, but not fast tracepoints.
> Is it the case?
>
> If so, I think the right fix would be to untangle fast tracepoints tests
> from regular tracepoints tests. The goal being to make it possible to
> run as many tests as possible against targets that only support regular
> tracepoints.
>
> Or maybe I'm completely lost, in which case can you clarify what your
> use case is?
Well, the particular use case I've been looking at are nios2-linux-gnu
and nios2-elf, and seeing my gdb.sum files full of random compilation
errors and TCL ERRORs where I think it should just be reporting
UNSUPPORTED. Most of the compilation errors are coming from
trace-common.h, and as I said, I'm under the impression that making this
work involves adding target hooks to gdb and/or gdbserver and not just
adding some stub for the arch to trace-common.h to prevent it from
hitting the preprocessor #error and undefined symbol errors. I'm really
not even clear on the difference between "tracepoints" and "fast
tracepoints" is, or which things which testcases are trying to test.
IMO the problem here is that these tests were written with the
assumption that the all support is present -- not just the tracepoint
support, but things like shared libraries and signals that typically
aren't supported on bare-metal targets, so they're just failing in
really ugly ways when the necessary support isn't there.
-Sandra
On 2018-10-11 01:19, Sandra Loosemore wrote:
> If the architecture isn't one of those supported by trace-common.h,
> then actions.c (or any other program that includes trace-common.h)
> won't compile. E.g. here is a recent gdb.sum extract for nios2-elf
> (using gdb 8.2 branch):
>
> Running
> /scratch/sandra/nios2-elf-fall-preview/src/gdb-master-8.2/gdb/testsuite/gdb.trace/actions.exp
> ...
> gdb compile failed, In file included from
> /scratch/sandra/nios2-elf-fall-preview/src/gdb-master-8.2/gdb/testsuite/gdb.trace/actions.c:24:
> /scratch/sandra/nios2-elf-fall-preview/src/gdb-master-8.2/gdb/testsuite/gdb.trace/trace-common.h:61:2:
> error: #error "unsupported architecture for trace tests"
> #error "unsupported architecture for trace tests"
> ^~~~~
> /scratch/sandra/nios2-elf-fall-preview/src/gdb-master-8.2/gdb/testsuite/gdb.trace/actions.c:
> In function 'main':
> /scratch/sandra/nios2-elf-fall-preview/src/gdb-master-8.2/gdb/testsuite/gdb.trace/actions.c:146:26:
> error: 'fast_tracepoint_loc' undeclared (first use in this function)
> FAST_TRACEPOINT_LABEL (fast_tracepoint_loc);
> ^~~~~~~~~~~~~~~~~~~
> /scratch/sandra/nios2-elf-fall-preview/src/gdb-master-8.2/gdb/testsuite/gdb.trace/actions.c:146:26:
> note: each undeclared identifier is reported only once for each
> function it appears in
> UNTESTED: gdb.trace/actions.exp: failed to compile
>
> My patch does not change what targets the tests work on, it only makes
> it fail gracefully with UNSUPPORTED instead of spewing a bunch of
> compilation errors into the gdb.sum file and reporting UNTESTED.
Ah I see. So to properly reproduce it (by faking it) on x86, I need to
both make x86_supports_tracepoints return 0 and remove the x86-specific
code in trace-common.h. If I do that, I see that indeed, the output is
not pretty (lots of compilation failures + untested).
> Well, the particular use case I've been looking at are nios2-linux-gnu
> and nios2-elf, and seeing my gdb.sum files full of random compilation
> errors and TCL ERRORs where I think it should just be reporting
> UNSUPPORTED. Most of the compilation errors are coming from
> trace-common.h, and as I said, I'm under the impression that making
> this work involves adding target hooks to gdb and/or gdbserver and not
> just adding some stub for the arch to trace-common.h to prevent it
> from hitting the preprocessor #error and undefined symbol errors. I'm
> really not even clear on the difference between "tracepoints" and
> "fast tracepoints" is, or which things which testcases are trying to
> test.
>
>
> IMO the problem here is that these tests were written with the
> assumption that the all support is present -- not just the tracepoint
> support, but things like shared libraries and signals that typically
> aren't supported on bare-metal targets, so they're just failing in
> really ugly ways when the necessary support isn't there.
That's true, and I'd say many tests are gdbserver-specific, since they
load the in-process agent library. If somebody has a different gdb stub
implementation that supports tracepoints, that would be a good candidate
to clean up the testsuite further, making sure we only run
gdbserver-specific tests when testing against the actual gdbserver.
I have compared runs with/without your patch on x86 with the unix
(default) and native-gdbserver boards, the results did not change. I
then compared before/after runs using these boards but also mocking that
tracepoints are not supported on x86, and the output is now much better.
So the patch LGTM, thanks!
Simon
commit 438b4d02aaef566f7a48e32091a65950f25aee31
Author: Sandra Loosemore <sandra@codesourcery.com>
Date: Wed Oct 10 15:33:49 2018 -0700
Clean up gdb.trace test results.
2018-10-10 Sandra Loosemore <sandra@codesourcery.com>
* gdb.trace/actions-changed.exp: Check for arch support.
* gdb.trace/actions.exp: Likewise.
* gdb.trace/ax.exp: Likewise.
* gdb.trace/backtrace.exp: Likewise.
* gdb.trace/change-loc.exp: Likewise.
* gdb.trace/deltrace.exp: Likewise.
* gdb.trace/ftrace-lock.exp: Check for shlib and arch support.
* gdb.trace/ftrace.exp: Likewise.
* gdb.trace/infotrace.exp: Check for arch support.
* gdb.trace/mi-trace-frame-collected.exp: Likewise.
* gdb.trace/mi-tracepoint-changed.exp: Likewise.
* gdb.trace/mi-tsv-changed.exp: Likewise.
* gdb.trace/packetlen.exp: Likewise.
* gdb.trace/passc-dyn.exp: Likewise.
* gdb.trace/passcount.exp: Likewise.
* gdb.trace/pending.exp: Likewise.
* gdb.trace/range-stepping.exp: Check for shlib support.
* gdb.trace/report.exp: Check for arch support.
* gdb.trace/save-trace.exp: Likewise.
* gdb.trace/signal.exp: Check for signal support.
* gdb.trace/tfind.exp: Check for arch support.
* gdb.trace/trace-break.exp: Check for arch and shlib support.
* gdb.trace/trace-common.h: Add comment.
* gdb.trace/trace-condition.exp: Check for shlib and arch support.
* gdb.trace/trace-enable-disable.exp: Likewise.
* gdb.trace/trace-mt.exp: Likewise. Remove redundant untested call.
* gdb.trace/tracecmd.exp: Check for arch support.
* gdb.trace/tspeed.c: Add missing header for sleep.
* gdb.trace/tspeed.exp: Check for shlib and target support.
(prepare_for_trace_test): Declare ipalib variable.
* gdb.trace/tstatus.exp: Check for arch support.
* gdb.trace/tsv.exp: Likewise.
* gdb.trace/while-dyn.exp: Likewise.
* gdb.trace/while-stepping.exp: Likewise.
* lib/trace-support.exp (gdb_trace_common_supports_arch): New.
@@ -1,3 +1,41 @@
+2018-10-10 Sandra Loosemore <sandra@codesourcery.com>
+
+ * gdb.trace/actions-changed.exp: Check for arch support.
+ * gdb.trace/actions.exp: Likewise.
+ * gdb.trace/ax.exp: Likewise.
+ * gdb.trace/backtrace.exp: Likewise.
+ * gdb.trace/change-loc.exp: Likewise.
+ * gdb.trace/deltrace.exp: Likewise.
+ * gdb.trace/ftrace-lock.exp: Check for shlib and arch support.
+ * gdb.trace/ftrace.exp: Likewise.
+ * gdb.trace/infotrace.exp: Check for arch support.
+ * gdb.trace/mi-trace-frame-collected.exp: Likewise.
+ * gdb.trace/mi-tracepoint-changed.exp: Likewise.
+ * gdb.trace/mi-tsv-changed.exp: Likewise.
+ * gdb.trace/packetlen.exp: Likewise.
+ * gdb.trace/passc-dyn.exp: Likewise.
+ * gdb.trace/passcount.exp: Likewise.
+ * gdb.trace/pending.exp: Likewise.
+ * gdb.trace/range-stepping.exp: Check for shlib support.
+ * gdb.trace/report.exp: Check for arch support.
+ * gdb.trace/save-trace.exp: Likewise.
+ * gdb.trace/signal.exp: Check for signal support.
+ * gdb.trace/tfind.exp: Check for arch support.
+ * gdb.trace/trace-break.exp: Check for arch and shlib support.
+ * gdb.trace/trace-common.h: Add comment.
+ * gdb.trace/trace-condition.exp: Check for shlib and arch support.
+ * gdb.trace/trace-enable-disable.exp: Likewise.
+ * gdb.trace/trace-mt.exp: Likewise. Remove redundant untested call.
+ * gdb.trace/tracecmd.exp: Check for arch support.
+ * gdb.trace/tspeed.c: Add missing header for sleep.
+ * gdb.trace/tspeed.exp: Check for shlib and target support.
+ (prepare_for_trace_test): Declare ipalib variable.
+ * gdb.trace/tstatus.exp: Check for arch support.
+ * gdb.trace/tsv.exp: Likewise.
+ * gdb.trace/while-dyn.exp: Likewise.
+ * gdb.trace/while-stepping.exp: Likewise.
+ * lib/trace-support.exp (gdb_trace_common_supports_arch): New.
+
2018-10-10 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.gdb/unittest.exp: Update expected message informing that
@@ -17,6 +17,11 @@ load_lib trace-support.exp
standard_testfile
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
+
if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
return -1
}
@@ -22,6 +22,10 @@ gdb_exit
gdb_start
standard_testfile
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
executable {debug nowarnings}] != "" } {
untested "failed to compile"
@@ -24,6 +24,12 @@ load_lib "trace-support.exp"
gdb_exit
gdb_start
standard_testfile actions.c
+
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
+
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
executable {debug nowarnings}] != "" } {
untested "failed to compile"
@@ -21,6 +21,11 @@ standard_testfile actions.c
set executable $testfile
set expfile $testfile.exp
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
+
if [prepare_for_testing "failed to prepare" $executable $srcfile \
[list debug nowarnings]] {
return -1
@@ -18,6 +18,11 @@ if {[skip_shlib_tests]} {
return 0
}
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
+
standard_testfile
set libfile1 "change-loc-1"
set libfile2 "change-loc-2"
@@ -22,6 +22,12 @@ gdb_exit
gdb_start
standard_testfile actions.c
+
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
+
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
executable {debug nowarnings}] != "" } {
untested "failed to compile"
@@ -14,6 +14,10 @@
load_lib "trace-support.exp"
+if {[skip_shlib_tests]} {
+ return 0
+}
+
standard_testfile
set executable $testfile
set expfile $testfile.exp
@@ -29,6 +33,10 @@ set options [list debug [gdb_target_symbol_prefix_flags] \
additional_flags=-DNUM_THREADS=$NUM_THREADS]
# Check that the target supports trace.
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
untested "failed to compile"
return -1
@@ -14,6 +14,10 @@
load_lib "trace-support.exp"
+if {[skip_shlib_tests]} {
+ return 0
+}
+
standard_testfile
set executable $testfile
set expfile $testfile.exp
@@ -21,6 +25,11 @@ set expfile $testfile.exp
# Some targets have leading underscores on assembly symbols.
set additional_flags [gdb_target_symbol_prefix_flags]
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
+
if [prepare_for_testing "failed to prepare" $executable $srcfile \
[list debug $additional_flags]] {
return -1
@@ -22,6 +22,12 @@ gdb_exit
gdb_start
standard_testfile actions.c
+
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
+
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
executable {debug nowarnings}] != "" } {
untested "failed to compile"
@@ -17,6 +17,11 @@ load_lib trace-support.exp
standard_testfile actions.c
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
+
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}] } {
return -1
}
@@ -18,6 +18,10 @@ load_lib trace-support.exp
if {[skip_shlib_tests]} {
return 0
}
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
standard_testfile pending.c
set libfile1 "pendshr1"
@@ -17,6 +17,12 @@ load_lib trace-support.exp
load_lib mi-support.exp
standard_testfile actions.c
+
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
+
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
executable {debug nowarnings}] != "" } {
untested "failed to compile"
@@ -22,6 +22,10 @@ gdb_exit
gdb_start
standard_testfile actions.c
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
executable {debug nowarnings}] != "" } {
untested "failed to compile"
@@ -21,6 +21,10 @@ load_lib "trace-support.exp"
gdb_exit
gdb_start
standard_testfile actions.c
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
executable {debug nowarnings}] != "" } {
untested "failed to compile"
@@ -21,6 +21,10 @@ load_lib "trace-support.exp"
gdb_exit
gdb_start
standard_testfile actions.c
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
executable {debug nowarnings}] != "" } {
untested "failed to compile"
@@ -18,6 +18,11 @@ if {[skip_shlib_tests]} {
return 0
}
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
+
standard_testfile
set libfile1 "pendshr1"
set libfile2 "pendshr2"
@@ -66,6 +66,10 @@ proc range_stepping_with_tracepoint { type } {
range_stepping_with_tracepoint "trace"
+if {[skip_shlib_tests]} {
+ return 0
+}
+
set libipa [get_in_proc_agent]
set remote_libipa [gdb_load_shlib $libipa]
@@ -22,6 +22,10 @@ gdb_exit
gdb_start
standard_testfile actions.c
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
executable {debug nowarnings}] != "" } {
untested "failed to compile"
@@ -22,6 +22,10 @@ gdb_exit
gdb_start
standard_testfile actions.c
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
executable {debug nowarnings}] != "" } {
untested "failed to compile"
@@ -28,6 +28,11 @@
load_lib "trace-support.exp"
+if [target_info exists gdb,nosignals] {
+ verbose "Skipping signal.exp because of nosignals."
+ return -1
+}
+
standard_testfile
if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
@@ -23,6 +23,11 @@ gdb_start
standard_testfile actions.c
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
+
if { [gdb_compile "$srcdir/$subdir/$srcfile" "$binfile" \
executable {debug nowarnings}] != "" } {
untested "failed to compile"
@@ -21,6 +21,11 @@ set expfile $testfile.exp
# Some targets have leading underscores on assembly symbols.
set additional_flags [gdb_target_symbol_prefix_flags]
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
+
if [prepare_for_testing "failed to prepare" $executable $srcfile \
[list debug $additional_flags]] {
return -1
@@ -347,6 +352,10 @@ foreach at_first_loc { "1" "0" } {
break_trace_same_addr_6 "trace" "enable" "trace" "disable"
break_trace_same_addr_6 "trace" "disable" "trace" "enable"
+if {[skip_shlib_tests]} {
+ return 0
+}
+
set libipa [get_in_proc_agent]
set remote_libipa [gdb_load_shlib $libipa]
@@ -25,6 +25,9 @@
a fast tracepoint jump. The parameter is the label where we'll set
tracepoints and breakpoints. */
+/* Please keep gdb_trace_common_supports_arch in lib/trace-support.exp
+ in sync when adding new targets to this file. */
+
#if (defined __x86_64__ || defined __i386__)
static void
@@ -14,6 +14,10 @@
load_lib "trace-support.exp"
+if {[skip_shlib_tests]} {
+ return 0
+}
+
standard_testfile
set executable $testfile
set expfile $testfile.exp
@@ -21,6 +25,11 @@ set expfile $testfile.exp
# Some targets have leading underscores on assembly symbols.
set additional_flags [gdb_target_symbol_prefix_flags]
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
+
if [prepare_for_testing "failed to prepare" $executable $srcfile \
[list debug $additional_flags]] {
return -1
@@ -14,6 +14,10 @@
load_lib "trace-support.exp"
+if {[skip_shlib_tests]} {
+ return 0
+}
+
standard_testfile
set executable $testfile
set expfile $testfile.exp
@@ -22,6 +26,10 @@ set expfile $testfile.exp
set options [list debug [gdb_target_symbol_prefix_flags]]
# Check that the target supports trace.
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
untested "failed to compile"
return -1
@@ -21,9 +21,14 @@ set expfile $testfile.exp
# Some targets have leading underscores on assembly symbols.
set additional_flags [gdb_target_symbol_prefix_flags]
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
+
if { [gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile \
executable [list debug $additional_flags] ] != "" } {
- untested "failed to compile"
+ # gdb_compile_pthreads provides an appropriate unsupported message.
return -1
}
@@ -106,6 +111,10 @@ foreach break_always_inserted { "on" "off" } {
step_over_tracepoint "trace"
+if {[skip_shlib_tests]} {
+ return 0
+}
+
set libipa [get_in_proc_agent]
set remote_libipa [gdb_load_shlib $libipa]
@@ -21,6 +21,10 @@ load_lib "trace-support.exp"
gdb_exit
gdb_start
standard_testfile actions.c
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
executable {debug nowarnings}] != "" } {
untested "failed to compile"
@@ -28,6 +28,7 @@
#include <time.h>
#include <sys/time.h>
#include <sys/resource.h>
+#include <unistd.h>
int trace_speed_test (void);
@@ -15,9 +15,32 @@
load_lib "trace-support.exp"
+if {[skip_shlib_tests]} {
+ return 0
+}
+
standard_testfile
set executable $testfile
+# Check that the target supports trace.
+if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
+ untested "failed to compile"
+ return -1
+}
+
+clean_restart ${testfile}
+
+if ![runto_main] {
+ fail "can't run to main to check for trace support"
+ return -1
+}
+
+if ![gdb_target_supports_trace] {
+ unsupported "target does not support trace"
+ return -1
+}
+
+# Compile the test case with the in-process agent library.
set ipalib [get_in_proc_agent]
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
@@ -38,6 +61,7 @@ set cr "\[\r\n\]+"
proc prepare_for_trace_test {} {
global executable
+ global ipalib
clean_restart $executable
gdb_load_shlib $ipalib
@@ -18,6 +18,11 @@ standard_testfile actions.c
set executable $testfile
set expfile tstatus.exp
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
+
if [prepare_for_testing "failed to prepare" $executable $srcfile \
[list debug]] {
return -1
@@ -19,6 +19,10 @@ load_lib "trace-support.exp"
gdb_exit
gdb_start
standard_testfile actions.c
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
executable {debug nowarnings}] != "" } {
untested "failed to compile"
@@ -23,6 +23,10 @@ gdb_start
standard_testfile actions.c
set executable $testfile
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
executable {debug nowarnings}] != "" } {
untested "failed to compile"
@@ -22,6 +22,10 @@ gdb_exit
gdb_start
standard_testfile actions.c
+if ![gdb_trace_common_supports_arch] {
+ unsupported "no trace-common.h support for arch"
+ return -1
+}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" $binfile \
executable {debug nowarnings}] != "" } {
untested "failed to compile"
@@ -51,6 +51,25 @@ if [is_amd64_regs_target] {
}
#
+# Procedure: gdb_trace_common_supports_arch
+# Returns true if gdb.trace/trace-common.h knows about this target.
+# Allows skipping tests that depend on being able to include this file.
+# Please keep this in sync with the supported targets in the header.
+#
+
+proc gdb_trace_common_supports_arch { } {
+ if { [istarget "x86_64*-*-*"]
+ || [istarget "i386*-*-*"]
+ || [istarget "aarch64*-*-*"]
+ || [istarget "powerpc*-*-*"]
+ || [istarget "s390*-*-*"] } {
+ return 1
+ } else {
+ return 0
+ }
+}
+
+#
# Procedure: gdb_target_supports_trace
# Returns true if GDB is connected to a target that supports tracing.
# Allows tests to abort early if not running on a trace-aware target.