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

Message ID 20241205073511.4236-2-tdevries@suse.de
State Superseded
Headers
Series Fix gdb.dap with s390x-linux |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed

Commit Message

Tom de Vries Dec. 5, 2024, 7:35 a.m. UTC
  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(-)
  

Comments

Tom Tromey Dec. 9, 2024, 7:50 p.m. UTC | #1
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> Fix this by declaring the test unsupported.

I don't mind this, but the comment in the code is out of date:

Tom>  # setVariable isn't implemented yet, so use the register name.  Note

... setVariable is implemented now and I wonder if the test could just
be changed to set "scalar" to some other value.

I'd say that maybe this part could be deleted entirely but it may be the
only frame-relative "set" test.

Tom
  
Tom de Vries Dec. 10, 2024, 11:47 a.m. UTC | #2
On 12/9/24 20:50, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
> 
> Tom> Fix this by declaring the test unsupported.
> 
> I don't mind this, but the comment in the code is out of date:
> 
> Tom>  # setVariable isn't implemented yet, so use the register name.  Note
> 
> ... setVariable is implemented now and I wonder if the test could just
> be changed to set "scalar" to some other value.
> 

I've given this a try.  Submitted here ( 
https://sourceware.org/pipermail/gdb-patches/2024-December/213933.html ).

Thanks,
- Tom

> I'd say that maybe this part could be deleted entirely but it may be the
> only frame-relative "set" test.
> 
> Tom
  

Patch

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"