60fb7e9efa
$ make check RUNTESTFLAGS="--target_board=native-gdbserver no-attach-trace.exp" ... (gdb) trace main Tracepoint 1 at 0x400594: file /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.trace/no-attach-trace.c, line 25. (gdb) PASS: gdb.trace/no-attach-trace.exp: set tracepoint on main tstart You can't do that when your target is `exec' (gdb) FAIL: gdb.trace/no-attach-trace.exp: tstart Even though this target supports tracing, the test restarts GDB and doesn't do gdb_run_cmd so does not reconnect to the remote target. So at that point, GDB only has the "exec" target, which obviously doesn't do tracing. The test is about doing "tstart" before running a program, so the fix is to do gdb_target_supports_trace with whatever target GDB ends up connected after clean_restart. Tested on x86_64 Fedora 20, native, native-gdbserver and native-extended-gdbserver boards. The test passes with the latter, and is skipped with the first two. gdb/testsuite/ChangeLog: 2015-02-20 Pedro Alves <palves@redhat.com> * gdb.trace/no-attach-trace.exp: Don't run to main. Do clean_restart before gdb_target_supports_trace.
49 lines
1.5 KiB
Text
49 lines
1.5 KiB
Text
# This testcase is part of GDB, the GNU debugger.
|
|
|
|
# Copyright 2015 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/>.
|
|
|
|
# Test that trying to trace without a process attached fails properly.
|
|
|
|
load_lib trace-support.exp
|
|
|
|
standard_testfile
|
|
|
|
if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
|
|
return -1
|
|
}
|
|
|
|
# Start GDB, but don't run so that we have no process attached.
|
|
# Effectively, this tests targets that can do tracing and where GDB
|
|
# can start programs ("run"), such as e.g., extended-remote gdbserver.
|
|
clean_restart $testfile
|
|
|
|
if { ![gdb_target_supports_trace] } then {
|
|
unsupported "Current target does not support trace"
|
|
return 1
|
|
}
|
|
|
|
gdb_test "trace main" \
|
|
"Tracepoint \[0-9\] at.* file .*$srcfile, line.*" \
|
|
"set tracepoint on main"
|
|
|
|
gdb_test "tstart" "Target returns error code.*\."
|
|
|
|
with_test_prefix "after tstart" {
|
|
if ![runto_main] {
|
|
fail "Can't run to main, target may have died unexpectedly"
|
|
return -1
|
|
}
|
|
}
|