This is an archive of the discontinued LLVM Phabricator instance.

[crashlog] Pass the debugger around instead of relying on lldb.debugger
ClosedPublic

Authored by JDevlieghere on Nov 3 2020, 12:05 PM.

Details

Summary

The lldb.debugger et al convenience variables are only available from the interactive script interpreter. In all other scenarios, they are None (since fc1fd6bf9fcfac412b10b4193805ec5de0e8df57) before that they were default initialized.

The crashlog script was hacking around that by setting the lldb.debugger to a newly created debugger instance when running outside of the script interpreter, which works fine until lldb creates a script interpreter instance under the hood and clears the variables. This was resulting in an AttributeError when invoking the script directly (from outside of lldb):

AttributeError: 'NoneType' object has no attribute 'GetSourceManager'

This patch fixes that by passing around the debugger instance.

rdar://64775776

Diff Detail

Event Timeline

JDevlieghere requested review of this revision.Nov 3 2020, 12:05 PM
JDevlieghere updated this revision to Diff 302655.
JDevlieghere created this revision.
JDevlieghere edited the summary of this revision. (Show Details)

Fix partial upload.

vsk added a subscriber: vsk.Nov 4 2020, 9:19 AM
vsk added inline comments.
lldb/examples/python/crashlog.py
853

Why does crashlog.Symbolicate accept a debugger parameter?

JDevlieghere marked an inline comment as done.Nov 4 2020, 10:29 AM
JDevlieghere added inline comments.
lldb/examples/python/crashlog.py
853

It's the signature lldb expects for command script add, but good point, we shouldn't use lldb.debugger and just forward the one we're passed in.

JDevlieghere marked an inline comment as done.

Address @vsk's comment

vsk accepted this revision.Nov 4 2020, 12:50 PM

Looks good to me.

This revision is now accepted and ready to land.Nov 4 2020, 12:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 4 2020, 12:51 PM