summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2010-12-14 00:42:36 +0000
committerSean Callanan <scallanan@apple.com>2010-12-14 00:42:36 +0000
commit9d48e80426bd7fe96e3dc1dfb917bb4a72e900bb (patch)
tree6e4a645b989bb56dd1767fffe0a345eef3a203de /lldb
parenta97a954364f8fa1e37c31909a766521ca4df6840 (diff)
downloadbcm5719-llvm-9d48e80426bd7fe96e3dc1dfb917bb4a72e900bb.tar.gz
bcm5719-llvm-9d48e80426bd7fe96e3dc1dfb917bb4a72e900bb.zip
Bugfixes for the new "self" pointer handling. Specifically,
the code to pass the _cmd pointer has been improved, and _cmd is now set to the value of _cmd for the current context, as opposed to being simply NULL. llvm-svn: 121739
Diffstat (limited to 'lldb')
-rw-r--r--lldb/include/lldb/Expression/ClangExpressionDeclMap.h6
-rw-r--r--lldb/include/lldb/Expression/ClangUserExpression.h3
-rw-r--r--lldb/source/Expression/ClangExpressionDeclMap.cpp7
-rw-r--r--lldb/source/Expression/ClangUserExpression.cpp18
-rw-r--r--lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp2
-rw-r--r--lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp7
6 files changed, 32 insertions, 11 deletions
diff --git a/lldb/include/lldb/Expression/ClangExpressionDeclMap.h b/lldb/include/lldb/Expression/ClangExpressionDeclMap.h
index e2d59c8f9ce..08c17e7ae43 100644
--- a/lldb/include/lldb/Expression/ClangExpressionDeclMap.h
+++ b/lldb/include/lldb/Expression/ClangExpressionDeclMap.h
@@ -302,13 +302,17 @@ public:
/// An Error to populate with any messages related to
/// finding the "this" pointer.
///
+ /// @param[in] suppress_type_check
+ /// True if the type is not needed.
+ ///
/// @return
/// True on success; false otherwise.
//------------------------------------------------------------------
bool GetObjectPointer(lldb::addr_t &object_ptr,
ConstString &object_name,
ExecutionContext &exe_ctx,
- Error &error);
+ Error &error,
+ bool suppress_type_check = false);
//------------------------------------------------------------------
/// [Used by CommandObjectExpression] Pretty-print a materialized
diff --git a/lldb/include/lldb/Expression/ClangUserExpression.h b/lldb/include/lldb/Expression/ClangUserExpression.h
index 94730179420..0e692b5c083 100644
--- a/lldb/include/lldb/Expression/ClangUserExpression.h
+++ b/lldb/include/lldb/Expression/ClangUserExpression.h
@@ -257,7 +257,8 @@ private:
PrepareToExecuteJITExpression (Stream &error_stream,
ExecutionContext &exe_ctx,
lldb::addr_t &struct_address,
- lldb::addr_t &object_ptr);
+ lldb::addr_t &object_ptr,
+ lldb::addr_t &cmd_ptr);
std::string m_expr_text; ///< The text of the expression, as typed by the user
std::string m_expr_prefix; ///< The text of the translation-level definitions, as provided by the user
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp
index 449db416fd2..b210d49821b 100644
--- a/lldb/source/Expression/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp
@@ -373,7 +373,8 @@ ClangExpressionDeclMap::GetObjectPointer
lldb::addr_t &object_ptr,
ConstString &object_name,
ExecutionContext &exe_ctx,
- Error &err
+ Error &err,
+ bool suppress_type_check
)
{
assert (m_struct_vars.get());
@@ -390,7 +391,9 @@ ClangExpressionDeclMap::GetObjectPointer
return false;
}
- Variable *object_ptr_var = FindVariableInScope (*exe_ctx.frame, object_name, &m_struct_vars->m_object_pointer_type);
+ Variable *object_ptr_var = FindVariableInScope (*exe_ctx.frame,
+ object_name,
+ (suppress_type_check ? NULL : &m_struct_vars->m_object_pointer_type));
if (!object_ptr_var)
{
diff --git a/lldb/source/Expression/ClangUserExpression.cpp b/lldb/source/Expression/ClangUserExpression.cpp
index 86696661019..aa51106bce2 100644
--- a/lldb/source/Expression/ClangUserExpression.cpp
+++ b/lldb/source/Expression/ClangUserExpression.cpp
@@ -312,7 +312,8 @@ bool
ClangUserExpression::PrepareToExecuteJITExpression (Stream &error_stream,
ExecutionContext &exe_ctx,
lldb::addr_t &struct_address,
- lldb::addr_t &object_ptr)
+ lldb::addr_t &object_ptr,
+ lldb::addr_t &cmd_ptr)
{
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
@@ -343,6 +344,17 @@ ClangUserExpression::PrepareToExecuteJITExpression (Stream &error_stream,
error_stream.Printf("Couldn't get required object pointer: %s\n", materialize_error.AsCString());
return false;
}
+
+ if (m_objectivec)
+ {
+ ConstString cmd_name("_cmd");
+
+ if (!(m_expr_decl_map->GetObjectPointer(cmd_ptr, cmd_name, exe_ctx, materialize_error, true)))
+ {
+ error_stream.Printf("Couldn't get required object pointer: %s\n", materialize_error.AsCString());
+ return false;
+ }
+ }
}
if (!m_expr_decl_map->Materialize(exe_ctx, struct_address, materialize_error))
@@ -391,7 +403,7 @@ ClangUserExpression::GetThreadPlanToExecuteJITExpression (Stream &error_stream,
lldb::addr_t object_ptr = NULL;
lldb::addr_t cmd_ptr = NULL;
- PrepareToExecuteJITExpression (error_stream, exe_ctx, struct_address, object_ptr);
+ PrepareToExecuteJITExpression (error_stream, exe_ctx, struct_address, object_ptr, cmd_ptr);
// FIXME: This should really return a ThreadPlanCallUserExpression, in order to make sure that we don't release the
// ClangUserExpression resources before the thread plan finishes execution in the target. But because we are
@@ -466,7 +478,7 @@ ClangUserExpression::Execute (Stream &error_stream,
lldb::addr_t object_ptr = NULL;
lldb::addr_t cmd_ptr = NULL;
- if (!PrepareToExecuteJITExpression (error_stream, exe_ctx, struct_address, object_ptr))
+ if (!PrepareToExecuteJITExpression (error_stream, exe_ctx, struct_address, object_ptr, cmd_ptr))
return Process::eExecutionSetupError;
const bool stop_others = true;
diff --git a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
index eb77d332b8f..d2f048ded41 100644
--- a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
+++ b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
@@ -102,7 +102,7 @@ ABIMacOSX_i386::PrepareTrivialCall (Thread &thread,
if (thread.GetProcess().WriteMemory(sp + 4, &argU32, sizeof(argU32), error) != sizeof(argU32))
return false;
}
- if (this_arg)
+ else if (this_arg)
{
uint32_t this_argU32 = *this_arg & 0xffffffffull;
uint32_t argU32 = arg & 0xffffffffull;
diff --git a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
index 32794f31965..b0943216bf6 100644
--- a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
+++ b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
@@ -109,15 +109,16 @@ ABISysV_x86_64::PrepareTrivialCall (Thread &thread,
if (log)
log->Printf("About to write '_cmd' (0x%llx) into RSI", (uint64_t)*cmd_arg);
- if (!reg_ctx->WriteRegisterFromUnsigned(rsiID, *this_arg))
+ if (!reg_ctx->WriteRegisterFromUnsigned(rsiID, *cmd_arg))
return false;
if (log)
log->Printf("About to write the argument (0x%llx) into RDX", (uint64_t)arg);
if (!reg_ctx->WriteRegisterFromUnsigned(rdxID, arg))
- return false; }
- if (this_arg)
+ return false;
+ }
+ else if (this_arg)
{
if (log)
log->PutCString("The trivial call has a this pointer");
OpenPOWER on IntegriCloud