[PATCH 1/2] [gdb/testsuite] Fix gdb.dap/scopes.exp on s390x

Tom de Vries tdevries@suse.de
Thu Dec 5 07:35:10 GMT 2024


On s390x-linux, I run into:
...
>>> {"seq": 12, "type": "request", "command": "setExpression", "arguments": {"expression": "$pswm", "value": "505810539591499783", "frameId": 0}}
Content-Length: 154^M
^M
{"request_seq": 12, "type": "response", "command": "setExpression", "success": false, "message": "Couldn't write registers: Invalid argument.", "seq": 25}FAIL: gdb.dap/scopes.exp: set first register success
...

This is not specific to DAP support, we get the same on the command-line:
...
$ gdb -q -batch a.out -ex start -ex 'set var $pswm = 0'
  ...
Couldn't write registers: Invalid argument.
...

Fix this by declaring the test unsupported.

Tested on s390x-linux.
---
 gdb/testsuite/gdb.dap/scopes.exp | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/gdb.dap/scopes.exp b/gdb/testsuite/gdb.dap/scopes.exp
index aa3bb688c0e..4f1038ea597 100644
--- a/gdb/testsuite/gdb.dap/scopes.exp
+++ b/gdb/testsuite/gdb.dap/scopes.exp
@@ -143,11 +143,22 @@ set val [expr {$val ^ 7}]
 # setVariable isn't implemented yet, so use the register name.  Note
 # that we sneak the "$" into the name, written in a slightly funny way
 # to work around apparent TON limitations.
-set response [dap_check_request_and_response "set first register" \
-		  setExpression \
-		  [format {o expression [s \$%s] value [s %d] frameId [i %d]} \
-		       $name $val $frame_id]]
-set response [lindex $response 0]
+set test "set first register"
+set response_and_events \
+    [dap_request_and_response \
+	 setExpression \
+	 [format {o expression [s \$%s] value [s %d] frameId [i %d]} \
+	      $name $val $frame_id]]
+set response [lindex $response_and_events 0]
+
+# On s390x, the first register is pswm, which can't be written.
+set unsupported_message "Couldn't write registers: Invalid argument."
+if { [dict get $response success] == "false"
+     && [dict get $response message] == $unsupported_message } {
+    unsupported $test
+    return
+}
+gdb_assert { [dict get $response success] == "true" } $test
 
 gdb_assert {[dict get $response body value] == $val} \
     "setting register yields updated value"
-- 
2.35.3



More information about the Gdb-patches mailing list