This is an archive of the discontinued LLVM Phabricator instance.

[LLDB][ClangExpression] Prevent nullptr namespace map access during logging
ClosedPublic

Authored by Michael137 on Jul 26 2022, 3:50 AM.

Details

Summary

Some codepaths lead to namespace_map == nullptr when we get to
ClangASTSource::FindCompleteType. This occurred while debugging
an lldb session that had settings set target.import-std-module true.

In that case, with LLDBLog::Expressions logging enabled, we would
dereference a nullptr and crash.

This commit moves the logging until after we check for nullptr.

Testing

  • Fixed the specific crash I was seeing while debugging an lldb session with import-std-module enabled.

Diff Detail

Event Timeline

Michael137 created this revision.Jul 26 2022, 3:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 26 2022, 3:50 AM
Michael137 requested review of this revision.Jul 26 2022, 3:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 26 2022, 3:50 AM
aprantl accepted this revision.Jul 26 2022, 7:44 AM

Nice!

This revision is now accepted and ready to land.Jul 26 2022, 7:44 AM