[pushed,2/2,gdb/testsuite] Fix gdb.threads/threadcrash.exp for remote host

Message ID 20240424133622.4639-2-tdevries@suse.de
State Committed
Headers
Series [pushed,1/2,gdb/testsuite] Fix gdb.threads/threadcrash.exp with glibc debuginfo |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 warning Patch is already merged
linaro-tcwg-bot/tcwg_gdb_build--master-arm warning Patch is already merged

Commit Message

Tom de Vries April 24, 2024, 1:36 p.m. UTC
  With test-case gdb.threads/threadcrash.exp using host board local-remote-host
and target board remote-gdbserver-on-localhost I run into:
...
(gdb) PASS: gdb.threads/threadcrash.exp: test_gcore: continue to crash
gcore $outputs/gdb.threads/threadcrash/threadcrash.gcore^M
Failed to open '$outputs/gdb.threads/threadcrash/threadcrash.gcore' for output.^M
(gdb) FAIL: gdb.threads/threadcrash.exp: test_gcore: saving gcore
UNSUPPORTED: gdb.threads/threadcrash.exp: test_gcore: couldn't generate gcore file
...

The problem is that the gcore command tries to save a file on a remote host,
but the filename is a location on build.

Fix this by using host_standard_output_file.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.threads/threadcrash.exp | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
  

Patch

diff --git a/gdb/testsuite/gdb.threads/threadcrash.exp b/gdb/testsuite/gdb.threads/threadcrash.exp
index ffbfd83942c..6da70736983 100644
--- a/gdb/testsuite/gdb.threads/threadcrash.exp
+++ b/gdb/testsuite/gdb.threads/threadcrash.exp
@@ -251,17 +251,15 @@  proc_with_prefix test_gcore {} {
     }
     gdb_test "continue" ".*Segmentation fault.*" "continue to crash"
 
-    set gcore_name "${::binfile}.gcore"
-    set gcore_supported [gdb_gcore_cmd "$gcore_name" "saving gcore"]
+    set gcore_host [host_standard_output_file $::testfile.gcore]
+    set gcore_supported [gdb_gcore_cmd "$gcore_host" "saving gcore"]
 
     if {!$gcore_supported} {
 	unsupported "couldn't generate gcore file"
 	return
     }
 
-    set corefile [gdb_remote_download host $gcore_name]
-
-    gdb_test "core-file $corefile" \
+    gdb_test "core-file $gcore_host" \
 	     "" \
 	     "loading_corefile" \
 	     "A program is being debugged already\\\.  Kill it\\\? \\\(y or n\\\) " \