This is an archive of the discontinued LLVM Phabricator instance.

Fix a crasher in StackFrame::GetValueForVariableExpressionPath()
ClosedPublic

Authored by clayborg on Mar 10 2019, 5:37 PM.

Details

Summary

There was a crash that would happen if an IDE would ask for a child of a shared pointer via any SB API call that ends up calling StackFrame::GetValueForVariableExpressionPath(). The previous code expects an error to be set describing why the synthetic child of a type was not able to be found, but we have some synthetic child providers that weren't setting the error and returning an empty value object shared pointer. This fixes that to ensure we don't lose our debug session by crashing, fully tests GetValueForVariableExpressionPath functionality, and ensures we don't crash on GetValueForVariableExpressionPath() in the future.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

clayborg created this revision.Mar 10 2019, 5:37 PM
aprantl added inline comments.Mar 11 2019, 8:59 AM
packages/Python/lldbsuite/test/functionalities/var_path/TestVarPath.py
70

If I'm not mistaken, you might be able to replace the first 40 lines or so of this test with
lldbutil.run_to_source_breakpoint(self, "// Set a break point here", lldb.SBFileSpec("main.cpp"))

aprantl added inline comments.Mar 11 2019, 9:01 AM
packages/Python/lldbsuite/test/functionalities/var_path/TestVarPath.py
102

until here. run_to_source_breakpoint should always return a valid frame or fail.

clayborg updated this revision to Diff 190102.Mar 11 2019, 9:11 AM

Adrian's suggestion was right, much simpler test case now!

clayborg marked 2 inline comments as done.Mar 11 2019, 9:11 AM
zturner added inline comments.Mar 11 2019, 10:10 AM
source/Target/StackFrame.cpp
644–650

Not your code, but incidentally this looks wrong. formatv uses python style format strings where you don't specify the type code but instead specify something like {0}. So either the function is incorrectly named or the call is incorrect.

655–656

I think you can' just write this as SetErrorString, since there is no format happening.

aprantl accepted this revision.Mar 11 2019, 10:10 AM
This revision is now accepted and ready to land.Mar 11 2019, 10:10 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 11 2019, 11:15 AM