[Lldb-commits] [PATCH] D121038: [lldb/crashlog] Make interactive mode display more user-friendly
Jonas Devlieghere via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 8 16:27:28 PST 2022
JDevlieghere added a comment.
LGTM. I left a comment with a suggestion for a context manager but that's up to you.
================
Comment at: lldb/examples/python/crashlog.py:1023-1024
+
+ async_state = debugger.GetAsync()
+ debugger.SetAsync(False)
+
----------------
This is the perfect pattern for a context manager:
```
@contextlib.contextmanager
def synchronous(debugger):
async = debugger.GetAsync()
debugger.SetAsync(False)
try:
yield
finally:
debugger.SetAsync(async)
```
and then you can do:
```
with synchronous(debugger):
...
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121038/new/
https://reviews.llvm.org/D121038
More information about the lldb-commits
mailing list