summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2010-09-30 00:54:27 +0000
committerJim Ingham <jingham@apple.com>2010-09-30 00:54:27 +0000
commit6c68fb45495192b676466f0595c262fb2ec53e8f (patch)
tree6ba309dd4226727dfe6637ac2f45ccf23a6b7767 /lldb/source/Expression
parent083f368be1090ca60c4e98aea496608abd1defa0 (diff)
downloadbcm5719-llvm-6c68fb45495192b676466f0595c262fb2ec53e8f.tar.gz
bcm5719-llvm-6c68fb45495192b676466f0595c262fb2ec53e8f.zip
Add "-o" option to "expression" which prints the object description if available.
llvm-svn: 115115
Diffstat (limited to 'lldb/source/Expression')
-rw-r--r--lldb/source/Expression/ClangExpressionVariable.cpp23
-rw-r--r--lldb/source/Expression/ClangFunction.cpp3
2 files changed, 12 insertions, 14 deletions
diff --git a/lldb/source/Expression/ClangExpressionVariable.cpp b/lldb/source/Expression/ClangExpressionVariable.cpp
index 37fc6c2354b..f406583dd72 100644
--- a/lldb/source/Expression/ClangExpressionVariable.cpp
+++ b/lldb/source/Expression/ClangExpressionVariable.cpp
@@ -50,23 +50,14 @@ ClangExpressionVariable::Print (Stream &output_stream,
{
Error err;
- if (!m_data_vars.get() || !m_data_vars->m_data)
+ Value val;
+ if (!PointValueAtData (val, &exe_ctx))
{
err.SetErrorToGenericError();
err.SetErrorStringWithFormat("Variable doesn't contain a value");
return err;
}
- Value val;
-
- clang::ASTContext *ast_context = m_user_type.GetASTContext();
-
- val.SetContext (Value::eContextTypeOpaqueClangQualType, m_user_type.GetOpaqueQualType ());
- val.SetValueType (Value::eValueTypeHostAddress);
- val.GetScalar() = (uint64_t)m_data_vars->m_data->GetBytes ();
-
- val.ResolveValue (&exe_ctx, ast_context);
-
if (val.GetContextType () == Value::eContextTypeInvalid &&
val.GetValueType () == Value::eValueTypeScalar &&
format == lldb::eFormatDefault)
@@ -77,6 +68,8 @@ ClangExpressionVariable::Print (Stream &output_stream,
return err;
}
+ clang::ASTContext *ast_context = m_user_type.GetASTContext();
+
// The expression result is more complex and requires special handling
DataExtractor data;
Error expr_error = val.GetValueAsData (&exe_ctx, ast_context, data, 0);
@@ -165,14 +158,18 @@ ClangExpressionVariable::ClangExpressionVariable(const ClangExpressionVariable &
}
bool
-ClangExpressionVariable::PointValueAtData(Value &value)
+ClangExpressionVariable::PointValueAtData(Value &value, ExecutionContext *exe_ctx)
{
- if (!m_data_vars.get())
+ if (!m_data_vars.get() || !m_data_vars->m_data)
return false;
value.SetContext(Value::eContextTypeOpaqueClangQualType, m_user_type.GetOpaqueQualType());
value.SetValueType(Value::eValueTypeHostAddress);
value.GetScalar() = (uint64_t)m_data_vars->m_data->GetBytes();
+ clang::ASTContext *ast_context = m_user_type.GetASTContext();
+
+ if (exe_ctx)
+ value.ResolveValue (exe_ctx, ast_context);
return true;
}
diff --git a/lldb/source/Expression/ClangFunction.cpp b/lldb/source/Expression/ClangFunction.cpp
index aaff16dbb6f..7f8d3ae77df 100644
--- a/lldb/source/Expression/ClangFunction.cpp
+++ b/lldb/source/Expression/ClangFunction.cpp
@@ -667,7 +667,8 @@ ClangFunction::ExecuteFunction (
// Thread we ran the function in may have gone away because we ran the target
// Check that it's still there.
exe_ctx.thread = exe_ctx.process->GetThreadList().FindThreadByIndexID(tid, true).get();
- exe_ctx.frame = exe_ctx.thread->GetStackFrameAtIndex(0).get();
+ if (exe_ctx.thread)
+ exe_ctx.frame = exe_ctx.thread->GetStackFrameAtIndex(0).get();
// Also restore the current process'es selected frame & thread, since this function calling may
// be done behind the user's back.
OpenPOWER on IntegriCloud