https://github.com/OCHyams created 
https://github.com/llvm/llvm-project/pull/152715

None

>From f73eb33233caa4bf550d47798e068e3e25709ac4 Mon Sep 17 00:00:00 2001
From: Orlando Cazalet-Hyams <orlando.hy...@sony.com>
Date: Thu, 7 Aug 2025 11:50:38 +0100
Subject: [PATCH] [Dexter] Track DAP capabilities

---
 .../dexter/dex/debugger/DAP.py                | 41 +++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py 
b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py
index d68c6140578fb..3191a0acb05ae 100644
--- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py
+++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py
@@ -102,6 +102,35 @@ def write_message(self, message: dict, incoming: bool):
             )
 
 
+# Debuggers communicate optional feature support.
+class DAPDebuggerCapabilities:
+    def __init__(self):
+        self.supportsConfigurationDoneRequest: bool = False
+        self.supportsFunctionBreakpoints: bool = False
+        self.supportsConditionalBreakpoints: bool = False
+        self.supportsHitConditionalBreakpoints: bool = False
+        self.supportsEvaluateForHovers: bool = False
+        self.supportsSetVariable: bool = False
+        self.supportsStepInTargetsRequest: bool = False
+        self.supportsModulesRequest: bool = False
+        self.supportsValueFormattingOptions: bool = False
+        self.supportsLogPoints: bool = False
+        self.supportsSetExpression: bool = False
+        self.supportsDataBreakpoints: bool = False
+        self.supportsReadMemoryRequest: bool = False
+        self.supportsWriteMemoryRequest: bool = False
+        self.supportsDisassembleRequest: bool = False
+        self.supportsCancelRequest: bool = False
+        self.supportsSteppingGranularity: bool = False
+        self.supportsInstructionBreakpoints: bool = False
+
+    def update(self, logger: Logger, feature_dict: dict):
+        for k, v in feature_dict.items():
+            if hasattr(self, k):
+                setattr(self, k, v)
+            else:
+                logger.warning(f"DAP: Unknown support flag: {k}")
+
 # As DAP does not give us a trivially query-able process, we are responsible 
for maintaining our own state information,
 # including what breakpoints are currently set, and whether the debugger is 
running or stopped.
 # This class holds all state that is set based on events sent by the debug 
adapter; most responses are forwarded through
@@ -144,6 +173,9 @@ def __init__(self):
         # Map of DAP breakpoint IDs to resolved instruction addresses.
         self.bp_addr_map: dict[int, str] = {}
 
+        # DAP features supported by the debugger.
+        self.capabilities = DAPDebuggerCapabilities()
+
     def set_response(self, req_id: int, response: dict):
         if len(self.responses) > req_id:
             self.responses[req_id] = response
@@ -320,6 +352,9 @@ def _handle_message(
                         and debugger_state.thread is None
                     ):
                         debugger_state.thread = event_details["threadId"]
+                case "capabilities":
+                    # Unchanged capabilites may not be included.
+                    debugger_state.capabilities.update(logger, event_details)
                 # There are many events we do not care about, just skip 
processing them.
                 case _:
                     pass
@@ -343,6 +378,12 @@ def _handle_message(
                 debugger_state.frame_map = [
                     stackframe["id"] for stackframe in 
message["body"]["stackFrames"]
                 ]
+            # The debugger communicates which optional DAP features are
+            # supported in its initalize response.
+            if message["command"] == "initialize" and message["success"] == 
True:
+                body = message.get("body")
+                if body:
+                    debugger_state.capabilities.update(logger, body)
 
     def _colorize_dap_message(message: dict) -> dict:
         colorized_message = copy.deepcopy(message)

_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to