summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/StackFrame.cpp
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2015-11-19 22:28:58 +0000
committerEnrico Granata <egranata@apple.com>2015-11-19 22:28:58 +0000
commit46252398f012414616052a4d5a15a87cb0fbf6f7 (patch)
tree890f5762d5f0d23ab6b7edd891f5745a3926db3a /lldb/source/Target/StackFrame.cpp
parent379cc5e71b2b6deb1e88240994761358741d2c9f (diff)
downloadbcm5719-llvm-46252398f012414616052a4d5a15a87cb0fbf6f7.tar.gz
bcm5719-llvm-46252398f012414616052a4d5a15a87cb0fbf6f7.zip
Fix up LLDB for a change in the way clang represents anonymous unions such that the 'frame variable' command can still find the members of such union as if they were top-level variables in the current scope
llvm-svn: 253613
Diffstat (limited to 'lldb/source/Target/StackFrame.cpp')
-rw-r--r--lldb/source/Target/StackFrame.cpp38
1 files changed, 35 insertions, 3 deletions
diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
index f8b3eb05a65..5f3ed29eafd 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -24,6 +24,7 @@
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Symbol/SymbolContextScope.h"
+#include "lldb/Symbol/Type.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
@@ -667,7 +668,8 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr,
{
var_path.erase (0, name_const_string.GetLength ());
}
- else if (options & eExpressionPathOptionsAllowDirectIVarAccess)
+
+ if (!var_sp && (options & eExpressionPathOptionsAllowDirectIVarAccess))
{
// Check for direct ivars access which helps us with implicit
// access to ivars with the "this->" or "self->"
@@ -689,13 +691,43 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr,
}
}
}
+
+ if (!var_sp && (options & eExpressionPathOptionsInspectAnonymousUnions))
+ {
+ // Check if any anonymous unions are there which contain a variable with the name we need
+ for (size_t i = 0;
+ i < variable_list->GetSize();
+ i++)
+ {
+ if (VariableSP variable_sp = variable_list->GetVariableAtIndex(i))
+ {
+ if (variable_sp->GetName().IsEmpty())
+ {
+ if (Type *var_type = variable_sp->GetType())
+ {
+ if (var_type->GetForwardCompilerType().IsAnonymousType())
+ {
+ valobj_sp = GetValueObjectForFrameVariable (variable_sp, use_dynamic);
+ if (!valobj_sp)
+ return valobj_sp;
+ valobj_sp = valobj_sp->GetChildMemberWithName(name_const_string, true);
+ if (valobj_sp)
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
- if (var_sp)
+ if (var_sp && !valobj_sp)
{
valobj_sp = GetValueObjectForFrameVariable (var_sp, use_dynamic);
if (!valobj_sp)
return valobj_sp;
-
+ }
+ if (valobj_sp)
+ {
// We are dumping at least one child
while (separator_idx != std::string::npos)
{
OpenPOWER on IntegriCloud