[llvm] [Dexter][NFC] Add split step-data collection methods for DAP (PR #196350)

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Fri May 8 01:16:36 PDT 2026


================
@@ -937,6 +937,70 @@ def _get_step_info(self, watches, step_index):
             program_state=ProgramState(state_frames),
         )
 
+    def get_stack_frames(self, step_index: int) -> StepIR:
+        """Returns a StepIR with stackframes and source locations (but no watched values)."""
+        assert (
+            not self._debugger_state.is_running
+        ), "Cannot get step info while debugger is running!"
+        trace_req_id = self.send_message(
+            self.make_request("stackTrace", {"threadId": self._debugger_state.thread})
+        )
+        trace_response = self._await_response(trace_req_id)
+        if not trace_response["success"]:
+            raise DebuggerException("failed to get stack frames")
+        stackframes = trace_response["body"]["stackFrames"]
+
+        frames = []
+
+        for stackframe in stackframes:
+            # No source, skip the frame! Currently I've only observed this for frames below main, so we break here; if
+            # it happens elsewhere, then this will break more stuff and we'll come up with a better solution.
----------------
SLTozer wrote:

This is a duplicate of an existing comment from the original function; I think the short, possibly lazy answer is that this hasn't been a problem yet, and if there's a legitimate case where `main` could not be present on the call stack then we'd be adding an unnecessary failure state.

https://github.com/llvm/llvm-project/pull/196350


More information about the llvm-commits mailing list