mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-04-17 22:00:41 +00:00

<rdar://problem/13723772> Modified the lldb_private::Thread to work much better with the OperatingSystem plug-ins. Operating system plug-ins can now return have a "core" key/value pair in each thread dictionary for the OperatingSystemPython plug-ins which allows the core threads to be contained with memory threads. It also allows these memory threads to be stepped, resumed, and controlled just as if they were the actual backing threads themselves. A few things are introduced: - lldb_private::Thread now has a GetProtocolID() method which returns the thread protocol ID for a given thread. The protocol ID (Thread::GetProtocolID()) is usually the same as the thread id (Thread::GetID()), but it can differ when a memory thread has its own id, but is backed by an actual API thread. - Cleaned up the Thread::WillResume() code to do the mandatory parts in Thread::ShouldResume(), and let the thread subclasses override the Thread::WillResume() which is now just a notification. - Cleaned up ClearStackFrames() implementations so that fewer thread subclasses needed to override them - Changed the POSIXThread class a bit since it overrode Thread::WillResume(). It is doing the wrong thing by calling "Thread::SetResumeState()" on its own, this shouldn't be done by thread subclasses, but the current code might rely on it so I left it in with a TODO comment with an explanation. llvm-svn: 180886
108 lines
2.5 KiB
C++
108 lines
2.5 KiB
C++
//===-- ThreadGDBRemote.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_ThreadGDBRemote_h_
|
|
#define liblldb_ThreadGDBRemote_h_
|
|
|
|
#include <string>
|
|
|
|
#include "lldb/Target/Process.h"
|
|
#include "lldb/Target/Thread.h"
|
|
|
|
class StringExtractor;
|
|
class ProcessGDBRemote;
|
|
|
|
class ThreadGDBRemote : public lldb_private::Thread
|
|
{
|
|
public:
|
|
ThreadGDBRemote (lldb_private::Process &process, lldb::tid_t tid);
|
|
|
|
virtual
|
|
~ThreadGDBRemote ();
|
|
|
|
virtual void
|
|
WillResume (lldb::StateType resume_state);
|
|
|
|
virtual void
|
|
RefreshStateAfterStop();
|
|
|
|
virtual const char *
|
|
GetName ();
|
|
|
|
virtual const char *
|
|
GetQueueName ();
|
|
|
|
virtual lldb::RegisterContextSP
|
|
GetRegisterContext ();
|
|
|
|
virtual lldb::RegisterContextSP
|
|
CreateRegisterContextForFrame (lldb_private::StackFrame *frame);
|
|
|
|
void
|
|
Dump (lldb_private::Log *log, uint32_t index);
|
|
|
|
static bool
|
|
ThreadIDIsValid (lldb::tid_t thread);
|
|
|
|
bool
|
|
ShouldStop (bool &step_more);
|
|
|
|
const char *
|
|
GetBasicInfoAsString ();
|
|
|
|
void
|
|
SetName (const char *name)
|
|
{
|
|
if (name && name[0])
|
|
m_thread_name.assign (name);
|
|
else
|
|
m_thread_name.clear();
|
|
}
|
|
|
|
lldb::addr_t
|
|
GetThreadDispatchQAddr ()
|
|
{
|
|
return m_thread_dispatch_qaddr;
|
|
}
|
|
|
|
void
|
|
SetThreadDispatchQAddr (lldb::addr_t thread_dispatch_qaddr)
|
|
{
|
|
m_thread_dispatch_qaddr = thread_dispatch_qaddr;
|
|
}
|
|
|
|
protected:
|
|
|
|
friend class ProcessGDBRemote;
|
|
|
|
bool
|
|
PrivateSetRegisterValue (uint32_t reg,
|
|
StringExtractor &response);
|
|
|
|
//------------------------------------------------------------------
|
|
// Member variables.
|
|
//------------------------------------------------------------------
|
|
std::string m_thread_name;
|
|
std::string m_dispatch_queue_name;
|
|
lldb::addr_t m_thread_dispatch_qaddr;
|
|
//------------------------------------------------------------------
|
|
// Member variables.
|
|
//------------------------------------------------------------------
|
|
|
|
void
|
|
SetStopInfoFromPacket (StringExtractor &stop_packet, uint32_t stop_id);
|
|
|
|
virtual lldb::StopInfoSP
|
|
GetPrivateStopReason ();
|
|
|
|
|
|
};
|
|
|
|
#endif // liblldb_ThreadGDBRemote_h_
|