This is an archive of the discontinued LLVM Phabricator instance.

[lldb/crashlog] Add `-s|--skip-status` option to interactive mode
ClosedPublic

Authored by mib on Aug 2 2022, 5:28 PM.

Details

Summary

This patch introduces a new option for the interactive crashlog mode,
that will prevent it from dumping the process status & thread backtrace
output to the debugger console.

This is necessary when lldb in running from an IDE, to prevent flooding
the console with information that should be already present in the UI.

rdar://96813296

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

Diff Detail

Event Timeline

mib created this revision.Aug 2 2022, 5:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2022, 5:28 PM
mib requested review of this revision.Aug 2 2022, 5:28 PM
JDevlieghere added inline comments.Aug 3 2022, 11:03 AM
lldb/examples/python/crashlog.py
1196–1202

Is there another way to detect that we're running in this kind of environment? For example, could we check if we're in an interactive lldb session? I imagine you'd like to have the same behavior as the IDE case if you imported the crashlog module in another Python file for example. One easy way to determine this is to check if lldb.debugger exists, but I'm not sure if that will cover the IDE case you're trying to solve.

jingham added a subscriber: jingham.Aug 3 2022, 4:03 PM

The code looks fine to me. This is a new capability, and I don't see how we can guess with certainty whether the clients want this output or not, so I think we should add it as an explicit option, as in the current patch.

lldb/examples/python/crashlog.py
1196–1202

I don't think we should be in the business of trying to auto-detect what the caller's intentions are in this regard. For instance, I can easily imagine a python utility that wants to get the crashlog, show it to the user, and also do some logic on it, and having us dump it is really convenient. Plus the development experience here would be bad. Someone would try out the crashlog command in lldb and see the dump. Then they would run it in their program and not see it. Then I think they would take our names in vain...

JDevlieghere added inline comments.Aug 3 2022, 9:17 PM
lldb/examples/python/crashlog.py
1196–1202

The reason I brought it up is because we have another patch that adds another flag for Xcode. Each flag makes sense by itself, but if there's a way to detect this more generally and avoid a sprawl of flags I would prefer that. But I don't feel strongly about it as this more of a "slippery slope argument".

mib marked 2 inline comments as done.Aug 4 2022, 10:39 AM
mib added inline comments.
lldb/examples/python/crashlog.py
1196–1202

As @jingham mentioned, I don't think we should be in the business of inferring what the user wants to show. I think it's better to make this choice clear.

This revision is now accepted and ready to land.Aug 8 2022, 5:34 PM
This revision was landed with ongoing or failed builds.Aug 9 2022, 9:02 PM
This revision was automatically updated to reflect the committed changes.