summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/Process')
-rw-r--r--lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp8
-rw-r--r--lldb/source/Plugins/Process/Utility/ThreadMemory.cpp21
-rw-r--r--lldb/source/Plugins/Process/Utility/ThreadMemory.h52
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp8
-rw-r--r--lldb/source/Plugins/Process/mach-core/ThreadMachCore.cpp6
5 files changed, 82 insertions, 13 deletions
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
index 29616430a05..a8b1b08bcdb 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
@@ -166,8 +166,12 @@ ThreadKDP::CreateRegisterContextForFrame (StackFrame *frame)
}
}
}
- else if (m_unwinder_ap.get())
- reg_ctx_sp = m_unwinder_ap->CreateRegisterContextForFrame (frame);
+ else
+ {
+ Unwind *unwinder = GetUnwinder ();
+ if (unwinder)
+ reg_ctx_sp = unwinder->CreateRegisterContextForFrame (frame);
+ }
return reg_ctx_sp;
}
diff --git a/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp b/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp
index 7ab5db73fcd..e7602b89020 100644
--- a/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp
+++ b/lldb/source/Plugins/Process/Utility/ThreadMemory.cpp
@@ -21,6 +21,7 @@ ThreadMemory::ThreadMemory (Process &process,
tid_t tid,
const ValueObjectSP &thread_info_valobj_sp) :
Thread (process, tid),
+ m_backing_thread_sp (),
m_thread_info_valobj_sp (thread_info_valobj_sp),
m_name(),
m_queue()
@@ -34,6 +35,7 @@ ThreadMemory::ThreadMemory (Process &process,
const char *queue,
lldb::addr_t register_data_addr) :
Thread (process, tid),
+ m_backing_thread_sp (),
m_thread_info_valobj_sp (),
m_name(),
m_queue(),
@@ -65,6 +67,9 @@ ThreadMemory::WillResume (StateType resume_state)
RegisterContextSP
ThreadMemory::GetRegisterContext ()
{
+ if (m_backing_thread_sp)
+ return m_backing_thread_sp->GetRegisterContext();
+
if (!m_reg_context_sp)
{
ProcessSP process_sp (GetProcess());
@@ -81,6 +86,9 @@ ThreadMemory::GetRegisterContext ()
RegisterContextSP
ThreadMemory::CreateRegisterContextForFrame (StackFrame *frame)
{
+ if (m_backing_thread_sp)
+ return m_backing_thread_sp->CreateRegisterContextForFrame(frame);
+
RegisterContextSP reg_ctx_sp;
uint32_t concrete_frame_idx = 0;
@@ -91,9 +99,11 @@ ThreadMemory::CreateRegisterContextForFrame (StackFrame *frame)
{
reg_ctx_sp = GetRegisterContext ();
}
- else if (m_unwinder_ap.get())
+ else
{
- reg_ctx_sp = m_unwinder_ap->CreateRegisterContextForFrame (frame);
+ Unwind *unwinder = GetUnwinder ();
+ if (unwinder)
+ reg_ctx_sp = unwinder->CreateRegisterContextForFrame (frame);
}
return reg_ctx_sp;
}
@@ -101,6 +111,9 @@ ThreadMemory::CreateRegisterContextForFrame (StackFrame *frame)
lldb::StopInfoSP
ThreadMemory::GetPrivateStopReason ()
{
+ if (m_backing_thread_sp)
+ return m_backing_thread_sp->GetPrivateStopReason();
+
ProcessSP process_sp (GetProcess());
if (process_sp)
@@ -135,6 +148,10 @@ ThreadMemory::GetPrivateStopReason ()
void
ThreadMemory::RefreshStateAfterStop()
{
+ if (m_backing_thread_sp)
+ return m_backing_thread_sp->RefreshStateAfterStop();
+
+
// Don't fetch the registers by calling Thread::GetRegisterContext() below.
// We might not have fetched any registers yet and we don't want to fetch
// the registers just to call invalidate on them...
diff --git a/lldb/source/Plugins/Process/Utility/ThreadMemory.h b/lldb/source/Plugins/Process/Utility/ThreadMemory.h
index 7ee9758783c..095078676be 100644
--- a/lldb/source/Plugins/Process/Utility/ThreadMemory.h
+++ b/lldb/source/Plugins/Process/Utility/ThreadMemory.h
@@ -33,9 +33,6 @@ public:
//------------------------------------------------------------------
// lldb_private::Thread methods
//------------------------------------------------------------------
- virtual void
- RefreshStateAfterStop();
-
virtual lldb::RegisterContextSP
GetRegisterContext ();
@@ -46,30 +43,75 @@ public:
GetPrivateStopReason ();
virtual const char *
+ GetInfo ()
+ {
+ if (m_backing_thread_sp)
+ m_backing_thread_sp->GetInfo();
+ return NULL;
+ }
+
+ virtual const char *
GetName ()
{
- return m_name.c_str();
+ if (!m_name.empty())
+ return m_name.c_str();
+ if (m_backing_thread_sp)
+ m_backing_thread_sp->GetName();
+ return NULL;
}
virtual const char *
GetQueueName ()
{
- return m_queue.c_str();
+ if (!m_queue.empty())
+ return m_queue.c_str();
+ if (m_backing_thread_sp)
+ m_backing_thread_sp->GetQueueName();
+ return NULL;
}
virtual bool
WillResume (lldb::StateType resume_state);
+ virtual void
+ DidResume ()
+ {
+ if (m_backing_thread_sp)
+ m_backing_thread_sp->DidResume();
+ }
+
+ virtual void
+ RefreshStateAfterStop();
+
lldb::ValueObjectSP &
GetValueObject ()
{
return m_thread_info_valobj_sp;
}
+
+ virtual void
+ ClearBackingThread ()
+ {
+ m_backing_thread_sp.reset();
+ }
+
+ virtual bool
+ SetBackingThread (const lldb::ThreadSP &thread_sp)
+ {
+ m_backing_thread_sp = thread_sp;
+ return (bool)thread_sp;
+ }
protected:
//------------------------------------------------------------------
// For ThreadMemory and subclasses
//------------------------------------------------------------------
+ // If this memory thread is actually represented by a thread from the
+ // lldb_private::Process subclass, then fill in the thread here and
+ // all APIs will be routed through this thread object. If m_backing_thread_sp
+ // is empty, then this thread is simply in memory with no representation
+ // through the process plug-in.
+ lldb::ThreadSP m_backing_thread_sp;
lldb::ValueObjectSP m_thread_info_valobj_sp;
std::string m_name;
std::string m_queue;
diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
index 4ac3f687aba..f1084d68bd4 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
@@ -202,8 +202,12 @@ ThreadGDBRemote::CreateRegisterContextForFrame (StackFrame *frame)
reg_ctx_sp.reset (new GDBRemoteRegisterContext (*this, concrete_frame_idx, gdb_process->m_register_info, read_all_registers_at_once));
}
}
- else if (m_unwinder_ap.get())
- reg_ctx_sp = m_unwinder_ap->CreateRegisterContextForFrame (frame);
+ else
+ {
+ Unwind *unwinder = GetUnwinder ();
+ if (unwinder)
+ reg_ctx_sp = unwinder->CreateRegisterContextForFrame (frame);
+ }
return reg_ctx_sp;
}
diff --git a/lldb/source/Plugins/Process/mach-core/ThreadMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ThreadMachCore.cpp
index f88c4887aa9..81d3426eab5 100644
--- a/lldb/source/Plugins/Process/mach-core/ThreadMachCore.cpp
+++ b/lldb/source/Plugins/Process/mach-core/ThreadMachCore.cpp
@@ -118,9 +118,11 @@ ThreadMachCore::CreateRegisterContextForFrame (StackFrame *frame)
}
reg_ctx_sp = m_thread_reg_ctx_sp;
}
- else if (m_unwinder_ap.get())
+ else
{
- reg_ctx_sp = m_unwinder_ap->CreateRegisterContextForFrame (frame);
+ Unwind *unwinder = GetUnwinder ();
+ if (unwinder)
+ reg_ctx_sp = unwinder->CreateRegisterContextForFrame (frame);
}
return reg_ctx_sp;
}
OpenPOWER on IntegriCloud