@@ -136,6 +136,7 @@ def __init__(
136
136
self .initialized = False
137
137
self .frame_scopes = {}
138
138
self .init_commands = init_commands
139
+ self .resolved_breakpoints = set ([])
139
140
140
141
@classmethod
141
142
def encode_content (cls , s : str ) -> bytes :
@@ -279,6 +280,14 @@ def _process_continued(self, all_threads_continued: bool):
279
280
if all_threads_continued :
280
281
self .thread_stop_reasons = {}
281
282
283
+ def _update_verified_breakpoints (self , breakpoints ):
284
+ for breakpoint in breakpoints :
285
+ if "verified" in breakpoint :
286
+ if breakpoint ["verified" ]:
287
+ self .resolved_breakpoints .add (str (breakpoint ["id" ]))
288
+ else :
289
+ self .resolved_breakpoints .discard (str (breakpoint ["id" ]))
290
+
282
291
def send_packet (self , command_dict : Request , set_sequence = True ):
283
292
"""Take the "command_dict" python dictionary and encode it as a JSON
284
293
string and send the contents as a packet to the VSCode debug
@@ -422,8 +431,27 @@ def wait_for_breakpoint_events(self, timeout: Optional[float] = None):
422
431
if not event :
423
432
break
424
433
breakpoint_events .append (event )
434
+
435
+ self ._update_verified_breakpoints (
436
+ [event ["body" ]["breakpoint" ] for event in breakpoint_events ]
437
+ )
425
438
return breakpoint_events
426
439
440
+ def wait_for_breakpoints_to_be_verified (
441
+ self , breakpoint_ids : list [str ], timeout : Optional [float ] = None
442
+ ):
443
+ """Wait for all breakpoints to be verified. Return all unverified breakpoints."""
444
+ unresolved_breakpoints = set (breakpoint_ids )
445
+ unresolved_breakpoints -= self .resolved_breakpoints
446
+ while len (unresolved_breakpoints ) > 0 :
447
+ breakpoint_event = self .wait_for_event ("breakpoint" , timeout = timeout )
448
+ if breakpoint_event is None :
449
+ break
450
+
451
+ self ._update_verified_breakpoints ([breakpoint_event ["body" ]["breakpoint" ]])
452
+ unresolved_breakpoints -= self .resolved_breakpoints
453
+ return unresolved_breakpoints
454
+
427
455
def wait_for_exited (self , timeout : Optional [float ] = None ):
428
456
event_dict = self .wait_for_event ("exited" , timeout = timeout )
429
457
if event_dict is None :
@@ -985,7 +1013,10 @@ def request_setBreakpoints(self, file_path, line_array, data=None):
985
1013
"type" : "request" ,
986
1014
"arguments" : args_dict ,
987
1015
}
988
- return self .send_recv (command_dict )
1016
+ response = self .send_recv (command_dict )
1017
+ breakpoints = response ["body" ]["breakpoints" ]
1018
+ self ._update_verified_breakpoints (breakpoints )
1019
+ return response
989
1020
990
1021
def request_setExceptionBreakpoints (self , filters ):
991
1022
args_dict = {"filters" : filters }
@@ -1188,17 +1219,15 @@ def request_locations(self, locationReference):
1188
1219
}
1189
1220
return self .send_recv (command_dict )
1190
1221
1191
- def request_testGetTargetBreakpoints (self , only_resolved = False ):
1222
+ def request_testGetTargetBreakpoints (self ):
1192
1223
"""A request packet used in the LLDB test suite to get all currently
1193
1224
set breakpoint infos for all breakpoints currently set in the
1194
1225
target.
1195
1226
"""
1196
1227
command_dict = {
1197
1228
"command" : "_testGetTargetBreakpoints" ,
1198
1229
"type" : "request" ,
1199
- "arguments" : {
1200
- "onlyResolved" : only_resolved ,
1201
- },
1230
+ "arguments" : {},
1202
1231
}
1203
1232
return self .send_recv (command_dict )
1204
1233
0 commit comments