From 1c73911d420db52e6d52cd68bd1020bfddb6d608 Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Fri, 22 Feb 2013 07:27:08 +0000 Subject: 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. llvm-svn: 175870 --- lldb/tools/debugserver/source/MacOSX/MachThreadList.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lldb/tools/debugserver/source/MacOSX/MachThreadList.h') diff --git a/lldb/tools/debugserver/source/MacOSX/MachThreadList.h b/lldb/tools/debugserver/source/MacOSX/MachThreadList.h index 52f9e749562..c568110ab34 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachThreadList.h +++ b/lldb/tools/debugserver/source/MacOSX/MachThreadList.h @@ -35,9 +35,9 @@ public: uint32_t ProcessDidStop (MachProcess *process); bool NotifyException (MachException::Data& exc); bool ShouldStop (bool &step_more); - const char * GetName (thread_t tid); - nub_state_t GetState (thread_t tid); - nub_thread_t SetCurrentThread (thread_t tid); + const char * GetName (nub_thread_t tid); + nub_state_t GetState (nub_thread_t tid); + nub_thread_t SetCurrentThread (nub_thread_t tid); bool GetThreadStoppedReason (nub_thread_t tid, struct DNBThreadStopInfo *stop_info) const; void DumpThreadStoppedReason (nub_thread_t tid) const; bool GetIdentifierInfo (nub_thread_t tid, thread_identifier_info_data_t *ident_info); @@ -56,6 +56,9 @@ public: MachThreadSP GetThreadByID (nub_thread_t tid) const; + MachThreadSP GetThreadByMachPortNumber (thread_t mach_port_number) const; + nub_thread_t GetThreadIDByMachPortNumber (thread_t mach_port_number) const; + protected: typedef std::vector collection; typedef collection::iterator iterator; -- cgit v1.2.3