@@ -166,6 +166,7 @@ def __init__(
166
166
self .initialized = False
167
167
self .frame_scopes = {}
168
168
self .init_commands = init_commands
169
+ self .resolved_breakpoints = set ([])
169
170
170
171
@classmethod
171
172
def encode_content (cls , s : str ) -> bytes :
@@ -309,6 +310,14 @@ def _process_continued(self, all_threads_continued: bool):
309
310
if all_threads_continued :
310
311
self .thread_stop_reasons = {}
311
312
313
+ def _update_verified_breakpoints (self , breakpoints ):
314
+ for breakpoint in breakpoints :
315
+ if "verified" in breakpoint :
316
+ if breakpoint ["verified" ]:
317
+ self .resolved_breakpoints .add (str (breakpoint ["id" ]))
318
+ else :
319
+ self .resolved_breakpoints .discard (str (breakpoint ["id" ]))
320
+
312
321
def send_packet (self , command_dict : Request , set_sequence = True ):
313
322
"""Take the "command_dict" python dictionary and encode it as a JSON
314
323
string and send the contents as a packet to the VSCode debug
@@ -452,8 +461,27 @@ def wait_for_breakpoint_events(self, timeout: Optional[float] = None):
452
461
if not event :
453
462
break
454
463
breakpoint_events .append (event )
464
+
465
+ self ._update_verified_breakpoints (
466
+ [event ["body" ]["breakpoint" ] for event in breakpoint_events ]
467
+ )
455
468
return breakpoint_events
456
469
470
+ def wait_for_breakpoints_to_be_verified (
471
+ self , breakpoint_ids : list [str ], timeout : Optional [float ] = None
472
+ ):
473
+ """Wait for all breakpoints to be verified. Return all unverified breakpoints."""
474
+ unresolved_breakpoints = set (breakpoint_ids )
475
+ unresolved_breakpoints -= self .resolved_breakpoints
476
+ while len (unresolved_breakpoints ) > 0 :
477
+ breakpoint_event = self .wait_for_event ("breakpoint" , timeout = timeout )
478
+ if breakpoint_event is None :
479
+ break
480
+
481
+ self ._update_verified_breakpoints ([breakpoint_event ["body" ]["breakpoint" ]])
482
+ unresolved_breakpoints -= self .resolved_breakpoints
483
+ return unresolved_breakpoints
484
+
457
485
def wait_for_exited (self , timeout : Optional [float ] = None ):
458
486
event_dict = self .wait_for_event ("exited" , timeout = timeout )
459
487
if event_dict is None :
@@ -1013,7 +1041,10 @@ def request_setBreakpoints(self, source: Source, line_array, data=None):
1013
1041
"type" : "request" ,
1014
1042
"arguments" : args_dict ,
1015
1043
}
1016
- return self .send_recv (command_dict )
1044
+ response = self .send_recv (command_dict )
1045
+ breakpoints = response ["body" ]["breakpoints" ]
1046
+ self ._update_verified_breakpoints (breakpoints )
1047
+ return response
1017
1048
1018
1049
def request_setExceptionBreakpoints (self , filters ):
1019
1050
args_dict = {"filters" : filters }
@@ -1216,17 +1247,15 @@ def request_locations(self, locationReference):
1216
1247
}
1217
1248
return self .send_recv (command_dict )
1218
1249
1219
- def request_testGetTargetBreakpoints (self , only_resolved = False ):
1250
+ def request_testGetTargetBreakpoints (self ):
1220
1251
"""A request packet used in the LLDB test suite to get all currently
1221
1252
set breakpoint infos for all breakpoints currently set in the
1222
1253
target.
1223
1254
"""
1224
1255
command_dict = {
1225
1256
"command" : "_testGetTargetBreakpoints" ,
1226
1257
"type" : "request" ,
1227
- "arguments" : {
1228
- "onlyResolved" : only_resolved ,
1229
- },
1258
+ "arguments" : {},
1230
1259
}
1231
1260
return self .send_recv (command_dict )
1232
1261
0 commit comments