diff options
author | Pedro Alves <palves@redhat.com> | 2015-02-20 19:50:36 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2015-02-20 19:50:36 +0000 |
commit | 60fb7e9efa12266437d28d19191e49e7f1e0013d (patch) | |
tree | 07b0712392de880b248e8903288345f30485a07e | |
parent | 5c5019c27c5a4a73ec53281b4b69044f82b179f0 (diff) | |
download | gdb-60fb7e9efa12266437d28d19191e49e7f1e0013d.zip gdb-60fb7e9efa12266437d28d19191e49e7f1e0013d.tar.gz gdb-60fb7e9efa12266437d28d19191e49e7f1e0013d.tar.bz2 |
Fix no-attach-trace.exp with "target remote" / gdbserver
$ 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.
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.trace/no-attach-trace.exp | 14 |
2 files changed, 10 insertions, 9 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index d9a752b..050f98c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,10 @@ 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. + +2015-02-20 Pedro Alves <palves@redhat.com> + PR threads/18006 * gdb.threads/clone-thread_db.c: New file. * gdb.threads/clone-thread_db.exp: New file. diff --git a/gdb/testsuite/gdb.trace/no-attach-trace.exp b/gdb/testsuite/gdb.trace/no-attach-trace.exp index 96135cb..2be19bd 100644 --- a/gdb/testsuite/gdb.trace/no-attach-trace.exp +++ b/gdb/testsuite/gdb.trace/no-attach-trace.exp @@ -15,7 +15,7 @@ # 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 program attached fails properly. +# Test that trying to trace without a process attached fails properly. load_lib trace-support.exp @@ -25,20 +25,16 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} { return -1 } -if ![runto_main] { - fail "Can't run to main to check for trace support" - 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 - } -# Clean test state so that we have no process attached. -clean_restart $testfile - gdb_test "trace main" \ "Tracepoint \[0-9\] at.* file .*$srcfile, line.*" \ "set tracepoint on main" |