[Lldb-commits] [PATCH] D121038: [lldb/crashlog] Make interactive mode display more user-friendly

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 8 16:34:40 PST 2022


mib marked an inline comment as done.
mib added inline comments.


================
Comment at: lldb/examples/python/crashlog.py:1023-1024
+
+    async_state = debugger.GetAsync()
+    debugger.SetAsync(False)
+
----------------
JDevlieghere wrote:
>  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): 
>   ...
> ```
TIL, very cool!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121038/new/

https://reviews.llvm.org/D121038



More information about the lldb-commits mailing list