This is an archive of the discontinued LLVM Phabricator instance.

[lldb/crashlog] Make interactive mode display more user-friendly
ClosedPublic

Authored by mib on Mar 4 2022, 6:56 PM.

Details

Summary

This patch makes the crashlog interactive mode show the scripted process
status with the crashed scripted thread backtrace after launching it.

rdar://89634338

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>

Diff Detail

Event Timeline

mib created this revision.Mar 4 2022, 6:56 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 4 2022, 6:56 PM
mib requested review of this revision.Mar 4 2022, 6:56 PM
mib updated this revision to Diff 413941.Mar 8 2022, 2:52 PM

Change implementation to emulate lldb's driver

mib updated this revision to Diff 413943.Mar 8 2022, 2:55 PM

LGTM. I left a comment with a suggestion for a context manager but that's up to you.

lldb/examples/python/crashlog.py
1024–1025

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): 
  ...
mib marked an inline comment as done.Mar 8 2022, 4:34 PM
mib added inline comments.
lldb/examples/python/crashlog.py
1024–1025

TIL, very cool!

mib updated this revision to Diff 413972.Mar 8 2022, 4:35 PM
mib marked an inline comment as done.

Use context manager pattern

JDevlieghere accepted this revision.Mar 9 2022, 12:07 PM
This revision is now accepted and ready to land.Mar 9 2022, 12:07 PM
This revision was landed with ongoing or failed builds.Mar 10 2022, 11:07 AM
This revision was automatically updated to reflect the committed changes.