2011-08-22 10:49:39 +08:00
|
|
|
//===-- ThreadMemory.h -----------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef liblldb_ThreadMemory_h_
|
|
|
|
#define liblldb_ThreadMemory_h_
|
|
|
|
|
|
|
|
#include "lldb/Target/Thread.h"
|
|
|
|
|
|
|
|
class ThreadMemory :
|
|
|
|
public lldb_private::Thread
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2012-10-11 02:32:14 +08:00
|
|
|
ThreadMemory (lldb_private::Process &process,
|
2012-02-21 08:09:25 +08:00
|
|
|
lldb::tid_t tid,
|
|
|
|
const lldb::ValueObjectSP &thread_info_valobj_sp);
|
2011-08-22 10:49:39 +08:00
|
|
|
|
2012-10-11 02:32:14 +08:00
|
|
|
ThreadMemory (lldb_private::Process &process,
|
2012-08-24 13:45:15 +08:00
|
|
|
lldb::tid_t tid,
|
|
|
|
const char *name,
|
2012-10-26 01:56:31 +08:00
|
|
|
const char *queue,
|
|
|
|
lldb::addr_t register_data_addr);
|
2012-08-24 13:45:15 +08:00
|
|
|
|
|
|
|
virtual
|
2011-08-22 10:49:39 +08:00
|
|
|
~ThreadMemory();
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
// lldb_private::Thread methods
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
virtual lldb::RegisterContextSP
|
|
|
|
GetRegisterContext ();
|
|
|
|
|
|
|
|
virtual lldb::RegisterContextSP
|
|
|
|
CreateRegisterContextForFrame (lldb_private::StackFrame *frame);
|
|
|
|
|
2013-05-09 09:55:29 +08:00
|
|
|
virtual bool
|
|
|
|
CalculateStopInfo ();
|
2011-08-22 10:49:39 +08:00
|
|
|
|
2013-04-13 04:07:46 +08:00
|
|
|
virtual const char *
|
|
|
|
GetInfo ()
|
|
|
|
{
|
|
|
|
if (m_backing_thread_sp)
|
|
|
|
m_backing_thread_sp->GetInfo();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-08-24 13:45:15 +08:00
|
|
|
virtual const char *
|
|
|
|
GetName ()
|
|
|
|
{
|
2013-04-13 04:07:46 +08:00
|
|
|
if (!m_name.empty())
|
|
|
|
return m_name.c_str();
|
|
|
|
if (m_backing_thread_sp)
|
|
|
|
m_backing_thread_sp->GetName();
|
|
|
|
return NULL;
|
2012-08-24 13:45:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual const char *
|
|
|
|
GetQueueName ()
|
|
|
|
{
|
2013-04-13 04:07:46 +08:00
|
|
|
if (!m_queue.empty())
|
|
|
|
return m_queue.c_str();
|
|
|
|
if (m_backing_thread_sp)
|
|
|
|
m_backing_thread_sp->GetQueueName();
|
|
|
|
return NULL;
|
2012-08-24 13:45:15 +08:00
|
|
|
}
|
|
|
|
|
2013-05-02 05:54:04 +08:00
|
|
|
virtual void
|
2011-08-22 10:49:39 +08:00
|
|
|
WillResume (lldb::StateType resume_state);
|
|
|
|
|
2013-04-13 04:07:46 +08:00
|
|
|
virtual void
|
|
|
|
DidResume ()
|
|
|
|
{
|
|
|
|
if (m_backing_thread_sp)
|
|
|
|
m_backing_thread_sp->DidResume();
|
|
|
|
}
|
2013-05-02 05:54:04 +08:00
|
|
|
|
|
|
|
virtual lldb::user_id_t
|
|
|
|
GetProtocolID () const
|
|
|
|
{
|
|
|
|
if (m_backing_thread_sp)
|
|
|
|
return m_backing_thread_sp->GetProtocolID();
|
|
|
|
return Thread::GetProtocolID();
|
|
|
|
}
|
2013-04-13 04:07:46 +08:00
|
|
|
|
|
|
|
virtual void
|
|
|
|
RefreshStateAfterStop();
|
|
|
|
|
2011-08-22 10:49:39 +08:00
|
|
|
lldb::ValueObjectSP &
|
|
|
|
GetValueObject ()
|
|
|
|
{
|
|
|
|
return m_thread_info_valobj_sp;
|
|
|
|
}
|
2013-04-13 04:07:46 +08:00
|
|
|
|
2013-05-02 05:54:04 +08:00
|
|
|
virtual void
|
|
|
|
ClearStackFrames ();
|
|
|
|
|
2013-04-13 04:07:46 +08:00
|
|
|
virtual void
|
|
|
|
ClearBackingThread ()
|
|
|
|
{
|
|
|
|
m_backing_thread_sp.reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
SetBackingThread (const lldb::ThreadSP &thread_sp)
|
|
|
|
{
|
2013-05-02 05:54:04 +08:00
|
|
|
//printf ("Thread 0x%llx is being backed by thread 0x%llx\n", GetID(), thread_sp->GetID());
|
2013-04-13 04:07:46 +08:00
|
|
|
m_backing_thread_sp = thread_sp;
|
|
|
|
return (bool)thread_sp;
|
|
|
|
}
|
2013-04-20 08:27:58 +08:00
|
|
|
|
|
|
|
virtual lldb::ThreadSP
|
|
|
|
GetBackingThread () const
|
|
|
|
{
|
|
|
|
return m_backing_thread_sp;
|
|
|
|
}
|
2011-08-22 10:49:39 +08:00
|
|
|
|
|
|
|
protected:
|
2013-05-02 05:54:04 +08:00
|
|
|
|
|
|
|
virtual bool
|
|
|
|
IsOperatingSystemPluginThread () const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-22 10:49:39 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
// For ThreadMemory and subclasses
|
|
|
|
//------------------------------------------------------------------
|
2013-04-13 04:07:46 +08:00
|
|
|
// 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;
|
2011-08-22 10:49:39 +08:00
|
|
|
lldb::ValueObjectSP m_thread_info_valobj_sp;
|
2012-08-24 13:45:15 +08:00
|
|
|
std::string m_name;
|
|
|
|
std::string m_queue;
|
2012-10-26 01:56:31 +08:00
|
|
|
lldb::addr_t m_register_data_addr;
|
2011-08-22 10:49:39 +08:00
|
|
|
private:
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
// For ThreadMemory only
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
DISALLOW_COPY_AND_ASSIGN (ThreadMemory);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // liblldb_ThreadMemory_h_
|