summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/FormatClasses.cpp
diff options
context:
space:
mode:
authorEnrico Granata <granata.enrico@gmail.com>2011-08-02 17:27:39 +0000
committerEnrico Granata <granata.enrico@gmail.com>2011-08-02 17:27:39 +0000
commitc3e320a7a0ccf754bd9e4ec0cac252845d5a24d2 (patch)
treeffc06a5a8545d9043ff96ee8cd576a84238d1cfe /lldb/source/Core/FormatClasses.cpp
parent9ab728bb058429358fc1aba008e2d32c71106240 (diff)
downloadbcm5719-llvm-c3e320a7a0ccf754bd9e4ec0cac252845d5a24d2.tar.gz
bcm5719-llvm-c3e320a7a0ccf754bd9e4ec0cac252845d5a24d2.zip
Fixed a bug where a variable could not be formatted in a summary if its datatype already had a custom format
Fixed a bug where Objective-C variables coming out of the expression parser could crash the Python synthetic providers: - expression parser output has a "frozen data" component, which is a byte-exact copy of the value (in host memory), if trying to read into memory based on the host address, LLDB would crash. we are now passing the correct (target) pointer to the Python code Objective-C "id" variables are now formatted according to their dynamic type, if the -d option to frame variable is used: - Code based on the Objective-C 2.0 runtime is used to obtain this information without running code on the target llvm-svn: 136695
Diffstat (limited to 'lldb/source/Core/FormatClasses.cpp')
-rw-r--r--lldb/source/Core/FormatClasses.cpp45
1 files changed, 43 insertions, 2 deletions
diff --git a/lldb/source/Core/FormatClasses.cpp b/lldb/source/Core/FormatClasses.cpp
index 046cc705d00..48097087253 100644
--- a/lldb/source/Core/FormatClasses.cpp
+++ b/lldb/source/Core/FormatClasses.cpp
@@ -21,6 +21,7 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/FormatClasses.h"
#include "lldb/Core/StreamString.h"
+#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Target/StackFrame.h"
@@ -121,8 +122,29 @@ StringSummaryFormat::GetDescription()
std::string
ScriptSummaryFormat::FormatObject(lldb::ValueObjectSP object)
{
+ lldb::ValueObjectSP target_object;
+ if (object->GetIsExpressionResult() &&
+ ClangASTContext::IsPointerType(object->GetClangType()) &&
+ object->GetValue().GetValueType() == Value::eValueTypeHostAddress)
+ {
+ // when using the expression parser, an additional layer of "frozen data"
+ // can be created, which is basically a byte-exact copy of the data returned
+ // by the expression, but in host memory. because Python code might need to read
+ // into the object memory in non-obvious ways, we need to hand it the target version
+ // of the expression output
+ lldb::addr_t tgt_address = object->GetValueAsUnsigned();
+ target_object = ValueObjectConstResult::Create (object->GetExecutionContextScope(),
+ object->GetClangAST(),
+ object->GetClangType(),
+ object->GetName(),
+ tgt_address,
+ eAddressTypeLoad,
+ object->GetUpdatePoint().GetProcessSP()->GetAddressByteSize());
+ }
+ else
+ target_object = object;
return std::string(ScriptInterpreterPython::CallPythonScriptFunction(m_function_name.c_str(),
- object).c_str());
+ target_object).c_str());
}
std::string
@@ -171,7 +193,26 @@ m_python_class(pclass)
return;
}
- m_interpreter = be->GetUpdatePoint().GetTargetSP()->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
+ if (be->GetIsExpressionResult() &&
+ ClangASTContext::IsPointerType(be->GetClangType()) &&
+ be->GetValue().GetValueType() == Value::eValueTypeHostAddress)
+ {
+ // when using the expression parser, an additional layer of "frozen data"
+ // can be created, which is basically a byte-exact copy of the data returned
+ // by the expression, but in host memory. because Python code might need to read
+ // into the object memory in non-obvious ways, we need to hand it the target version
+ // of the expression output
+ lldb::addr_t tgt_address = be->GetValueAsUnsigned();
+ m_backend = ValueObjectConstResult::Create (be->GetExecutionContextScope(),
+ be->GetClangAST(),
+ be->GetClangType(),
+ be->GetName(),
+ tgt_address,
+ eAddressTypeLoad,
+ be->GetUpdatePoint().GetProcessSP()->GetAddressByteSize());
+ }
+
+ m_interpreter = m_backend->GetUpdatePoint().GetTargetSP()->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
if (m_interpreter == NULL)
m_wrapper = NULL;
OpenPOWER on IntegriCloud