diff options
author | Greg Clayton <gclayton@apple.com> | 2011-01-20 19:27:18 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2011-01-20 19:27:18 +0000 |
commit | 6d5e68eaf2a5d144553c84b2f93fb8ad0b10072d (patch) | |
tree | a60ddaa91b7d7cda2d5caefe85196195299e2acb /lldb/source/Target/StackFrame.cpp | |
parent | 1f69de3983f3e897a7572311cc7e7872ff6a23a7 (diff) | |
download | bcm5719-llvm-6d5e68eaf2a5d144553c84b2f93fb8ad0b10072d.tar.gz bcm5719-llvm-6d5e68eaf2a5d144553c84b2f93fb8ad0b10072d.zip |
Added the ability to StackFrame::GetValueForVariableExpressionPath(...) to avoid
fragile ivars if requested. This was done by changing the previous second parameter
to an options bitfield that can be populated by logical OR'ing the new
StackFrame::ExpressionPathOption enum values together:
typedef enum ExpressionPathOption
{
eExpressionPathOptionCheckPtrVsMember = (1u << 0),
eExpressionPathOptionsNoFragileObjcIvar = (1u << 1),
};
So the old function was:
lldb::ValueObjectSP
StackFrame::GetValueForVariableExpressionPath (const char *var_expr, bool check_ptr_vs_member, Error &error);
But it is now:
lldb::ValueObjectSP
StackFrame::GetValueForVariableExpressionPath (const char *var_expr, uint32_t options, Error &error);
This allows the expression parser in Target::EvaluateExpression(...) to avoid
using simple frame variable expression paths when evaluating something that might
be a fragile ivar.
llvm-svn: 123938
Diffstat (limited to 'lldb/source/Target/StackFrame.cpp')
-rw-r--r-- | lldb/source/Target/StackFrame.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp index eb86f465f10..633d394cf07 100644 --- a/lldb/source/Target/StackFrame.cpp +++ b/lldb/source/Target/StackFrame.cpp @@ -480,11 +480,13 @@ StackFrame::GetVariableList (bool get_file_globals) } ValueObjectSP -StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, bool check_ptr_vs_member, Error &error) +StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, uint32_t options, Error &error) { if (var_expr_cstr && var_expr_cstr[0]) { + const bool check_ptr_vs_member = (options & eExpressionPathOptionCheckPtrVsMember) != 0; + const bool no_fragile_ivar = (options & eExpressionPathOptionsNoFragileObjcIvar) != 0; error.Clear(); bool deref = false; bool address_of = false; @@ -536,6 +538,20 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr, bool c if (var_path.size() >= 2 && var_path[1] != '>') return ValueObjectSP(); + if (no_fragile_ivar) + { + // Make sure we aren't trying to deref an objective + // C ivar if this is not allowed + const uint32_t pointer_type_flags = ClangASTContext::GetTypeInfo (valobj_sp->GetClangType(), NULL, NULL); + if ((pointer_type_flags & ClangASTContext::eTypeIsObjC) && + (pointer_type_flags & ClangASTContext::eTypeIsPointer)) + { + // This was an objective C object pointer and + // it was requested we skip any fragile ivars + // so return nothing here + return ValueObjectSP(); + } + } var_path.erase (0, 1); // Remove the '-' // Fall through case '.': |