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.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151009 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/ThreadPlanRunToAddress.cpp b/source/Target/ThreadPlanRunToAddress.cpp
index 0779a1f..f406c37 100644
--- a/source/Target/ThreadPlanRunToAddress.cpp
+++ b/source/Target/ThreadPlanRunToAddress.cpp
@@ -39,7 +39,7 @@
m_addresses (),
m_break_ids ()
{
- m_addresses.push_back (address.GetOpcodeLoadAddress (&m_thread.GetProcess().GetTarget()));
+ m_addresses.push_back (address.GetOpcodeLoadAddress (m_thread.CalculateTarget().get()));
SetInitialBreakpoints();
}
@@ -54,7 +54,7 @@
m_addresses (),
m_break_ids ()
{
- m_addresses.push_back(m_thread.GetProcess().GetTarget().GetOpcodeLoadAddress(address));
+ m_addresses.push_back(m_thread.CalculateTarget()->GetOpcodeLoadAddress(address));
SetInitialBreakpoints();
}
@@ -71,7 +71,7 @@
{
// Convert all addressses into opcode addresses to make sure we set
// breakpoints at the correct address.
- Target &target = thread.GetProcess().GetTarget();
+ Target &target = thread.GetProcess()->GetTarget();
std::vector<lldb::addr_t>::iterator pos, end = m_addresses.end();
for (pos = m_addresses.begin(); pos != end; ++pos)
*pos = target.GetOpcodeLoadAddress (*pos);
@@ -88,7 +88,7 @@
for (size_t i = 0; i < num_addresses; i++)
{
Breakpoint *breakpoint;
- breakpoint = m_thread.GetProcess().GetTarget().CreateBreakpoint (m_addresses[i], true).get();
+ breakpoint = m_thread.CalculateTarget()->CreateBreakpoint (m_addresses[i], true).get();
if (breakpoint != NULL)
{
m_break_ids[i] = breakpoint->GetID();
@@ -102,7 +102,7 @@
size_t num_break_ids = m_break_ids.size();
for (size_t i = 0; i < num_break_ids; i++)
{
- m_thread.GetProcess().GetTarget().RemoveBreakpointByID (m_break_ids[i]);
+ m_thread.CalculateTarget()->RemoveBreakpointByID (m_break_ids[i]);
}
}
@@ -153,7 +153,7 @@
s->Address(m_addresses[i], sizeof (addr_t));
s->Printf (" using breakpoint: %d - ", m_break_ids[i]);
- Breakpoint *breakpoint = m_thread.GetProcess().GetTarget().GetBreakpointByID (m_break_ids[i]).get();
+ Breakpoint *breakpoint = m_thread.CalculateTarget()->GetBreakpointByID (m_break_ids[i]).get();
if (breakpoint)
breakpoint->Dump (s);
else
@@ -236,7 +236,7 @@
{
if (m_break_ids[i] != LLDB_INVALID_BREAK_ID)
{
- m_thread.GetProcess().GetTarget().RemoveBreakpointByID (m_break_ids[i]);
+ m_thread.CalculateTarget()->RemoveBreakpointByID (m_break_ids[i]);
m_break_ids[i] = LLDB_INVALID_BREAK_ID;
}
}