Skip to content

Commit f2c98a2

Browse files
committed
Greg comment feedback
1 parent adb146f commit f2c98a2

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

lldb/bindings/interface/SBProgressDocstrings.i

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,33 @@ throttling rate than deterministic ones.
2525
2626
Below are examples in Python for deterministic and non-deterministic progresses.
2727
28-
deterministic_progress = lldb.SBProgress('Deterministic Progress', 'Detail', 3, lldb.SBDebugger)
29-
for i in range(3):
30-
deterministic_progress.Increment(1, f'Update {i}')
28+
deterministic_progress1 = lldb.SBProgress('Deterministic Progress', 'Detail', 3, lldb.SBDebugger)
29+
for i in range(3):
30+
deterministic_progress1.Increment(1, f'Update {i}')
31+
32+
# The call to Finalize() is a no-op as we already incremented the right amount of
33+
# times and caused the end event to be sent.
34+
deterministic_progress1.Finalize()
35+
deterministic_progress2 = lldb.SBProgress('Deterministic Progress', 'Detail', 10, lldb.SBDebugger)
36+
for i in range(3):
37+
deterministic_progress2.Increment(1, f'Update {i}')
38+
39+
# Cause the progress end event to be sent even if we didn't increment the right
40+
# number of times. Real world examples would be in a try-finally block to ensure
41+
# progress clean-up.
42+
43+
deterministic_progress2.Finalize()
44+
If you don't call Finalize() when the progress is not done, the progress object will eventually get
45+
garbage collected by the Python runtime, the end event will eventually get sent, but it is best not to
46+
rely on the garbage collection when using lldb.SBProgress.
47+
48+
Non-deterministic progresses behave the same, but omit the total in the constructor.
3149
3250
non_deterministic_progress = lldb.SBProgress('Non deterministic progress, 'Detail', lldb.SBDebugger)
3351
for i in range(10):
3452
non_deterministic_progress.Increment(1)
35-
36-
# Explicitly send a progressEnd from Python.
53+
# Explicitly send a progressEnd, otherwise this will be sent
54+
# when the python runtime cleans up this object.
3755
non_deterministic_progress.Finalize()
3856
") lldb::SBProgress;
3957

lldb/test/API/tools/lldb-dap/progress/TestDAP_Progress.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def verify_progress_events(
1919
expected_not_in_message=None,
2020
only_verify_first_update=False,
2121
):
22-
self.dap_server.wait_for_event("progressEnd", 5)
22+
self.dap_server.wait_for_event("progressEnd", 15)
2323
self.assertTrue(len(self.dap_server.progress_events) > 0)
2424
start_found = False
2525
update_found = False

0 commit comments

Comments
 (0)