Tweak gdb.base/corefile.exp is_remote check

1. Otherwise, when we make native-gdbserver board no longer is_remote,
   we get:

  Running .../src/gdb/testsuite/gdb.base/corefile.exp ...
  ERROR: tcl error sourcing .../src/gdb/testsuite/gdb.base/corefile.exp.
  ERROR: gdbserver does not support attach 9327 without extended-remote
      while executing
  "error "gdbserver does not support $command without extended-remote""

  That's fixed by using can_spawn_for_attach instead.

2. The gdb_protocol check fixes this current problem with
   --target_board=extended-remote-gdbserver:

     Running .../src/gdb/testsuite/gdb.base/corefile.exp ...
     FAIL: gdb.base/corefile.exp: run: with core
     FAIL: gdb.base/corefile.exp: run: core file is cleared
     FAIL: gdb.base/corefile.exp: attach: with core
     FAIL: gdb.base/corefile.exp: attach: core file is cleared

   gdb.log:
     (...)
     attach 10859
     Don't know how to attach.  Try "help target".
     (...)

The fix for #2 alone would fix #1 too, but can_spawn_for_attach
expresses the requirement directly, so I still left it there.

gdb/testsuite/ChangeLog:
2017-10-13  Pedro Alves  <palves@redhat.com>

	* gdb.base/corefile.exp (corefile_test_run): Skip if gdb_protocol
	is set.
	(corefile_test_attach): Likewise.  Check can_spawn_for_attach
	instead of is_remote.
This commit is contained in:
Pedro Alves 2017-10-13 11:25:42 +01:00
parent 23fb630af0
commit df479dc6e0
2 changed files with 26 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/corefile.exp (corefile_test_run): Skip if gdb_protocol
is set.
(corefile_test_attach): Likewise. Check can_spawn_for_attach
instead of is_remote.
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/remote.exp: Check gdb_protocol instead of is_remote.

View File

@ -188,6 +188,15 @@ gdb_test "core" "No core file now."
proc corefile_test_run {} {
global corefile gdb_prompt
# This test is trying to check whether the "run" command finds the
# default run target when already debugging a core, so it would
# fail on boards that set auto-connect-native-target off. Since
# there's no real point in running the test but with the native
# target, it's easier to just skip elsewhere.
if {[target_info gdb_protocol] != ""} {
return
}
gdb_test "core-file $corefile" "Core was generated by .*" "run: load core again"
gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "run: sanity check we see the core file"
@ -244,7 +253,16 @@ gdb_exit
proc corefile_test_attach {} {
global binfile corefile gdb_prompt
if ![is_remote target] {
# This test is checking whether the "attach" command finds the
# default run target when already debugging a core, so it would
# fail on boards that set auto-connect-native-target off. Since
# there's no real point in running the test but with the native
# target, it's easier to just skip elsewhere.
if {[target_info gdb_protocol] != ""} {
return
}
if [can_spawn_for_attach] {
set test "attach: spawn sleep"
set res [remote_spawn host "$binfile sleep"]
if { $res < 0 || $res == "" } {