]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix gdb.base/attach.exp --pid test skipping on native-extended-gdbserver
authorPedro Alves <pedro@palves.net>
Wed, 17 Apr 2024 18:47:51 +0000 (19:47 +0100)
committerPedro Alves <pedro@palves.net>
Fri, 26 Apr 2024 20:22:48 +0000 (21:22 +0100)
When testing with the native-extended-gdbserver board,
gdb.base/attach.exp shows a couple failures, like so:

 Running /home/pedro/gdb/src/gdb/testsuite/gdb.base/attach.exp ...
 FAIL: gdb.base/attach.exp: do_command_attach_tests: gdb_spawn_attach_cmdline: start gdb with --pid
 FAIL: gdb.base/attach.exp: do_command_attach_tests: gdb_spawn_attach_cmdline: info thread (no thread)

From gdb.log:

 builtin_spawn /home/pedro/gdb/build/gdb/testsuite/../../gdb/gdb -nw -nx -q -iex set height 0 -iex set width 0 -data-directory /home/pedro/gdb/build
 /gdb/data-directory -iex set auto-connect-native-target off -iex set sysroot -quiet --pid=2115260
 Don't know how to attach.  Try "help target".
 (gdb) FAIL: gdb.base/attach.exp: do_command_attach_tests: gdb_spawn_attach_cmdline: start gdb with --pid

There is a check for [isnative] to skip the test on anything but
target native, but that is the wrong check.  native-extended-gdbserver
is "isnative".  Fix it by using a gdb_protocol check instead.

Change-Id: I37ee730b8d6f1913b12c118838f511bd1c0b3768
Approved-By: Tom Tromey <tom@tromey.com>
gdb/testsuite/gdb.base/attach.exp

index 637f287f59e9761958a84ae6b040f2a1cee59b07..831e11f96a6f06ffb4cc8b80664af24d3be069a1 100644 (file)
@@ -445,7 +445,9 @@ proc_with_prefix do_command_attach_tests {} {
     global gdb_prompt
     global binfile
 
-    if {![isnative]} {
+    # The --pid option is used to attach to a process using the native
+    # target.
+    if { ![gdb_protocol_is_native] } {
        unsupported "command attach test"
        return 0
     }