]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix no-attach-trace.exp with "target remote" / gdbserver
authorPedro Alves <palves@redhat.com>
Fri, 20 Feb 2015 19:50:36 +0000 (19:50 +0000)
committerPedro Alves <palves@redhat.com>
Fri, 20 Feb 2015 19:50:36 +0000 (19:50 +0000)
 $ 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.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.trace/no-attach-trace.exp

index d9a752b3943918eaa74f056071c76ec54303eb97..050f98cb69a8094cf68bf369a87671e8cae7b156 100644 (file)
@@ -1,3 +1,8 @@
+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
index 96135cbf35555a25378fca85cde8af4688e2d61a..2be19bd34f6e847f277842f4f097b43e47f6a971 100644 (file)
@@ -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"