This is an archive of the discontinued LLVM Phabricator instance.

[lldb/api] Add checks for StackFrame::GetRegisterContext calls (NFC)
ClosedPublic

Authored by mib on Jul 7 2020, 1:16 PM.

Details

Summary

This patch fixes a crash that is happening because of a null pointer
dereference in SBFrame.

StackFrame::GetRegisterContext says explicitly that you might not get
a valid RegisterContext back but the pointer wasn't tested before,
resulting in crashes. This should solve the issue.

rdar://54462095

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

Diff Detail

Event Timeline

mib created this revision.Jul 7 2020, 1:16 PM
mib updated this revision to Diff 276209.Jul 7 2020, 2:27 PM

Changed style.

JDevlieghere accepted this revision.Jul 7 2020, 2:29 PM

A test would be great but since we can't repro this is strictly better than the current state. LGTM.

This revision is now accepted and ready to land.Jul 7 2020, 2:29 PM
This revision was automatically updated to reflect the committed changes.