aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/python/lib/gdb/dap/evaluate.py1
-rw-r--r--gdb/python/lib/gdb/dap/server.py11
-rw-r--r--gdb/python/lib/gdb/dap/varref.py3
-rw-r--r--gdb/testsuite/gdb.dap/basic-dap.exp3
-rw-r--r--gdb/testsuite/lib/dap-support.exp4
5 files changed, 19 insertions, 3 deletions
diff --git a/gdb/python/lib/gdb/dap/evaluate.py b/gdb/python/lib/gdb/dap/evaluate.py
index 1db6962..2b40065 100644
--- a/gdb/python/lib/gdb/dap/evaluate.py
+++ b/gdb/python/lib/gdb/dap/evaluate.py
@@ -70,7 +70,6 @@ def _repl(command, frame_id):
}
-# FIXME supportsVariableType handling
@request("evaluate")
def eval_request(
*,
diff --git a/gdb/python/lib/gdb/dap/server.py b/gdb/python/lib/gdb/dap/server.py
index be66676..b1c75ab 100644
--- a/gdb/python/lib/gdb/dap/server.py
+++ b/gdb/python/lib/gdb/dap/server.py
@@ -186,6 +186,17 @@ def capability(name, value=True):
return wrap
+def client_bool_capability(name):
+ """Return the value of a boolean client capability.
+
+ If the capability was not specified, or did not have boolean type,
+ False is returned."""
+ global _server
+ if name in _server.config and isinstance(_server.config[name], bool):
+ return _server.config[name]
+ return False
+
+
@request("initialize")
def initialize(**args):
global _server, _capabilities
diff --git a/gdb/python/lib/gdb/dap/varref.py b/gdb/python/lib/gdb/dap/varref.py
index 88c34c2..23f18d6 100644
--- a/gdb/python/lib/gdb/dap/varref.py
+++ b/gdb/python/lib/gdb/dap/varref.py
@@ -15,6 +15,7 @@
import gdb
from .startup import in_gdb_thread
+from .server import client_bool_capability
from abc import abstractmethod
@@ -165,6 +166,8 @@ class VariableReference(BaseReference):
result["memoryReference"] = hex(int(self.value))
elif self.value.address is not None:
result["memoryReference"] = hex(int(self.value.address))
+ if client_bool_capability("supportsVariableType"):
+ result["type"] = str(self.value.type)
return result
@in_gdb_thread
diff --git a/gdb/testsuite/gdb.dap/basic-dap.exp b/gdb/testsuite/gdb.dap/basic-dap.exp
index 9aaa940..ca0d1be 100644
--- a/gdb/testsuite/gdb.dap/basic-dap.exp
+++ b/gdb/testsuite/gdb.dap/basic-dap.exp
@@ -162,7 +162,8 @@ dap_match_values "global value in main" [lindex $obj 0] \
set obj [dap_check_request_and_response "set global in main" \
setExpression {o expression [s global_variable] value [s 23]}]
dap_match_values "global value in main after set" [lindex $obj 0] \
- "body result" 23
+ "body result" 23 \
+ "body type" int
set obj [dap_request_and_response \
evaluate {o expression [s nosuchvariable]}]
diff --git a/gdb/testsuite/lib/dap-support.exp b/gdb/testsuite/lib/dap-support.exp
index 8667164..5c54748 100644
--- a/gdb/testsuite/lib/dap-support.exp
+++ b/gdb/testsuite/lib/dap-support.exp
@@ -230,7 +230,9 @@ proc _dap_initialize {name} {
if {[dap_gdb_start]} {
return ""
}
- return [dap_check_request_and_response $name initialize]
+ return [dap_check_request_and_response $name initialize \
+ {o clientID [s "gdb testsuite"] \
+ supportsVariableType [l true]}]
}
# Start gdb, send a DAP initialize request, and then a launch request