@@ -257,6 +257,9 @@ def make_set_breakpoint_request(source: str, bps: list[BreakpointRequest]) -> di
257257 {"source" : {"path" : source }, "breakpoints" : [bp .toDict () for bp in bps ]},
258258 )
259259
260+ ############################################################################
261+ ## DAP communication & state-handling functions
262+
260263 # Sends a request to the adapter, returning the seq value of the request.
261264 def send_message (self , payload : dict ) -> int :
262265 self .seq = self .seq + 1
@@ -459,6 +462,9 @@ def _await_response(self, seq: int, timeout: float = 0.0) -> dict:
459462 time .sleep (0.001 )
460463 return self ._debugger_state .get_response (seq )
461464
465+ ## End of DAP communication methods
466+ ############################################################################
467+
462468 def _translate_stop_reason (self , reason : str | None ):
463469 if reason is None :
464470 return None
@@ -756,13 +762,10 @@ def frames_below_main(self):
756762 @staticmethod
757763 @abc .abstractmethod
758764 def _evaluate_result_value (expression : str , result_string : str ) -> ValueIR :
759- """ " For the result of an "evaluate" message, return a ValueIR. Implementation must be debugger-specific."""
765+ """For the result of an "evaluate" message, return a ValueIR. Implementation must be debugger-specific."""
760766
761- # FIXME: You don't use indexed-from-0 IDs for evaluate here, you use a unique ID assigned to each stack frame,
762- # which we get from the 'stackTrace' request; for now, we will pass that special ID and use it here, but since this
763- # can get called from more generic contexts that don't understand DAP, we need to set up some kind of translation
764- # here in future.
765767 def evaluate_expression (self , expression , frame_idx = 0 ) -> ValueIR :
768+ # The frame_idx passed in here needs to be translated to the debug adapter's internal frame ID.
766769 dap_frame_id = self ._debugger_state .frame_map [frame_idx ]
767770 eval_req_id = self .send_message (
768771 self .make_request (
0 commit comments