summaryrefslogtreecommitdiffstats
path: root/lldb/tools/debugserver/source/MacOSX/MachThread.h
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2013-02-22 07:27:08 +0000
committerJason Molenda <jmolenda@apple.com>2013-02-22 07:27:08 +0000
commit1c73911d420db52e6d52cd68bd1020bfddb6d608 (patch)
treee3b026d7558cda086f5d1243e6cf9f4cb9b17b0e /lldb/tools/debugserver/source/MacOSX/MachThread.h
parent1fcd7fd633a44ab3ec944a5102afea74fcc8a23e (diff)
downloadbcm5719-llvm-1c73911d420db52e6d52cd68bd1020bfddb6d608.tar.gz
bcm5719-llvm-1c73911d420db52e6d52cd68bd1020bfddb6d608.zip
Change debugserver from using the mach port number (in debugserver's
own port namepsace) as the thread identifier to using the system-wide globally unique thread id as the thread identifier number. MachThread.cpp keeps both the unique id and the mach port number for each thread. All layers outside MachThread class use the unique id with three exceptions: (1) Mach exceptions come in with the port number (thread_port) which needs to be translated, (2) any calls to low-level thread_get_state/thread_set_state/thread_suspend etc need to use the mach port number, (3) MachThreadList::UpdateThreadList which creates the MachThread objects gets the unique id and passes it to the MachThread ctor as an argument. In general, any time nub_thread_t is used, it is now referring to a unique thread id. Any time a thread_t is used, it is now referring to a mach port number. There was some interchangability of these types previously. nub_thread_t has also been changed to a 64-bit type which necessitated some printf specification string changes. I haven't been able to test these changes extensively yet but want to checkpoint the work. The scenarios I've been testing are all working correctly so while there may be some corner cases I haven't hit yet, I think it is substantially correct. <rdar://problem/12931414> llvm-svn: 175870
Diffstat (limited to 'lldb/tools/debugserver/source/MacOSX/MachThread.h')
-rw-r--r--lldb/tools/debugserver/source/MacOSX/MachThread.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/lldb/tools/debugserver/source/MacOSX/MachThread.h b/lldb/tools/debugserver/source/MacOSX/MachThread.h
index 90bd05f2dc7..ba4acd1a6d2 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachThread.h
+++ b/lldb/tools/debugserver/source/MacOSX/MachThread.h
@@ -36,7 +36,7 @@ class MachThread
{
public:
- MachThread (MachProcess *process, thread_t thread = 0);
+ MachThread (MachProcess *process, uint64_t unique_thread_id = 0, thread_t mach_port_number = 0);
~MachThread ();
MachProcess * Process() { return m_process; }
@@ -44,11 +44,13 @@ public:
Process() const { return m_process; }
nub_process_t ProcessID() const;
void Dump(uint32_t index);
- thread_t ThreadID() const { return m_tid; }
+ uint64_t ThreadID() const { return m_unique_id; }
+ thread_t MachPortNumber() const { return m_mach_port_number; }
thread_t InferiorThreadID() const;
uint32_t SequenceID() const { return m_seq_id; }
- static bool ThreadIDIsValid(thread_t thread);
+ static bool ThreadIDIsValid(uint64_t thread); // The 64-bit system-wide unique thread identifier
+ static bool MachPortNumberIsValid(thread_t thread); // The mach port # for this thread in debugserver namespace
void Resume(bool others_stopped);
void Suspend();
bool SetSuspendCountBeforeResume(bool others_stopped);
@@ -106,6 +108,8 @@ public:
return m_arch_ap.get();
}
+ static uint64_t GetGloballyUniqueThreadIDForMachPortID (thread_t mach_port_id);
+
protected:
static bool GetBasicInfo(thread_t threadID, struct thread_basic_info *basic_info);
@@ -116,7 +120,8 @@ protected:
// GetDispatchQueueName();
//
MachProcess * m_process; // The process that owns this thread
- thread_t m_tid; // The thread port for this thread
+ uint64_t m_unique_id; // The globally unique ID for this thread (nub_thread_t)
+ thread_t m_mach_port_number; // The mach port # for this thread in debugserver namesp.
uint32_t m_seq_id; // A Sequential ID that increments with each new thread
nub_state_t m_state; // The state of our process
PThreadMutex m_state_mutex; // Multithreaded protection for m_state
OpenPOWER on IntegriCloud