summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-02-21 00:09:25 +0000
committerGreg Clayton <gclayton@apple.com>2012-02-21 00:09:25 +0000
commit1ac04c308832f7a9b2e07e360f07c82f7cb2a02c (patch)
treebb908a56f1d08a946f4f25aa7b4b762066e1ec57 /lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
parent3508a0054301ef24b8d8619351788698bcd97620 (diff)
downloadbcm5719-llvm-1ac04c308832f7a9b2e07e360f07c82f7cb2a02c.tar.gz
bcm5719-llvm-1ac04c308832f7a9b2e07e360f07c82f7cb2a02c.zip
Thread hardening part 3. Now lldb_private::Thread objects have std::weak_ptr
objects for the backlink to the lldb_private::Process. The issues we were running into before was someone was holding onto a shared pointer to a lldb_private::Thread for too long, and the lldb_private::Process parent object would get destroyed and the lldb_private::Thread had a "Process &m_process" member which would just treat whatever memory that used to be a Process as a valid Process. This was mostly happening for lldb_private::StackFrame objects that had a member like "Thread &m_thread". So this completes the internal strong/weak changes. Documented the ExecutionContext and ExecutionContextRef classes so that our LLDB developers can understand when and where to use ExecutionContext and ExecutionContextRef objects. llvm-svn: 151009
Diffstat (limited to 'lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp')
-rw-r--r--lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
index 3477695425f..5e6d27b0d64 100644
--- a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
+++ b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
@@ -264,14 +264,14 @@ ABIMacOSX_arm::PrepareTrivialCall (Thread &thread,
}
- Target *target = &thread.GetProcess().GetTarget();
+ TargetSP target_sp (thread.CalculateTarget());
Address so_addr;
// Figure out if our return address is ARM or Thumb by using the
// Address::GetCallableLoadAddress(Target*) which will figure out the ARM
// thumb-ness and set the correct address bits for us.
- so_addr.SetLoadAddress (return_addr, target);
- return_addr = so_addr.GetCallableLoadAddress (target);
+ so_addr.SetLoadAddress (return_addr, target_sp.get());
+ return_addr = so_addr.GetCallableLoadAddress (target_sp.get());
// Set "lr" to the return address
if (!reg_ctx->WriteRegisterFromUnsigned (ra_reg_num, return_addr))
@@ -283,8 +283,8 @@ ABIMacOSX_arm::PrepareTrivialCall (Thread &thread,
// If bit zero or 1 is set, this must be a thumb function, no need to figure
// this out from the symbols.
- so_addr.SetLoadAddress (function_addr, target);
- function_addr = so_addr.GetCallableLoadAddress (target);
+ so_addr.SetLoadAddress (function_addr, target_sp.get());
+ function_addr = so_addr.GetCallableLoadAddress (target_sp.get());
const RegisterInfo *cpsr_reg_info = reg_ctx->GetRegisterInfoByName("cpsr");
const uint32_t curr_cpsr = reg_ctx->ReadRegisterAsUnsigned(cpsr_reg_info, 0);
@@ -319,10 +319,11 @@ ABIMacOSX_arm::GetArgumentValues (Thread &thread,
uint32_t num_values = values.GetSize();
+ ExecutionContext exe_ctx (thread.shared_from_this());
// For now, assume that the types in the AST values come from the Target's
// scratch AST.
- clang::ASTContext *ast_context = thread.CalculateTarget()->GetScratchClangASTContext()->getASTContext();
+ clang::ASTContext *ast_context = exe_ctx.GetTargetRef().GetScratchClangASTContext()->getASTContext();
// Extract the register context so we can read arguments from registers
@@ -364,7 +365,7 @@ ABIMacOSX_arm::GetArgumentValues (Thread &thread,
return false;
}
- if (bit_width <= (thread.GetProcess().GetAddressByteSize() * 8))
+ if (bit_width <= (exe_ctx.GetProcessRef().GetAddressByteSize() * 8))
{
if (value_idx < 4)
{
@@ -407,7 +408,7 @@ ABIMacOSX_arm::GetArgumentValues (Thread &thread,
// Arguments 5 on up are on the stack
const uint32_t arg_byte_size = (bit_width + (8-1)) / 8;
Error error;
- if (!thread.GetProcess().ReadScalarIntegerFromMemory(sp, arg_byte_size, is_signed, value->GetScalar(), error))
+ if (!exe_ctx.GetProcessRef().ReadScalarIntegerFromMemory(sp, arg_byte_size, is_signed, value->GetScalar(), error))
return false;
sp += arg_byte_size;
OpenPOWER on IntegriCloud