Fix another old usage of GetCurrentThread() to get a mach port

number in RNBRemote::HandlePacket_qProcessInfo -- add a new
GetCurrentThreadMachPort() so callers who need to make a mach
thred_get_state() call at the RNBRemote level will have a way to
get the port number.

llvm-svn: 178619
This commit is contained in:
Jason Molenda 2013-04-03 04:18:47 +00:00
parent b00fc87608
commit d5318c0c35
5 changed files with 21 additions and 1 deletions

View File

@ -1772,6 +1772,18 @@ DNBProcessGetCurrentThread (nub_process_t pid)
return 0;
}
//----------------------------------------------------------------------
// Get the mach port number of the current thread.
//----------------------------------------------------------------------
nub_thread_t
DNBProcessGetCurrentThreadMachPort (nub_process_t pid)
{
MachProcessSP procSP;
if (GetProcessSP (pid, procSP))
return procSP->GetCurrentThreadMachPort();
return 0;
}
//----------------------------------------------------------------------
// Change the current thread.
//----------------------------------------------------------------------

View File

@ -75,6 +75,7 @@ nub_bool_t DNBProcessGetExitStatus (nub_process_t pid, int
nub_bool_t DNBProcessSetExitStatus (nub_process_t pid, int status) DNB_EXPORT;
nub_size_t DNBProcessGetNumThreads (nub_process_t pid) DNB_EXPORT;
nub_thread_t DNBProcessGetCurrentThread (nub_process_t pid) DNB_EXPORT;
nub_thread_t DNBProcessGetCurrentThreadMachPort (nub_process_t pid) DNB_EXPORT;
nub_thread_t DNBProcessSetCurrentThread (nub_process_t pid, nub_thread_t tid) DNB_EXPORT;
nub_thread_t DNBProcessGetThreadAtIndex (nub_process_t pid, nub_size_t thread_idx) DNB_EXPORT;
nub_bool_t DNBProcessSyncThreadState (nub_process_t pid, nub_thread_t tid) DNB_EXPORT;

View File

@ -185,6 +185,12 @@ MachProcess::GetCurrentThread ()
return m_thread_list.CurrentThreadID();
}
nub_thread_t
MachProcess::GetCurrentThreadMachPort ()
{
return m_thread_list.GetMachPortNumberByThreadID(m_thread_list.CurrentThreadID());
}
nub_thread_t
MachProcess::SetCurrentThread(nub_thread_t tid)
{

View File

@ -176,6 +176,7 @@ public:
nub_size_t GetNumThreads () const;
nub_thread_t GetThreadAtIndex (nub_size_t thread_idx) const;
nub_thread_t GetCurrentThread ();
nub_thread_t GetCurrentThreadMachPort ();
nub_thread_t SetCurrentThread (nub_thread_t tid);
MachThreadList & GetThreadList() { return m_thread_list; }
bool GetThreadStoppedReason(nub_thread_t tid, struct DNBThreadStopInfo *stop_info) const;

View File

@ -4099,7 +4099,7 @@ RNBRemote::HandlePacket_qProcessInfo (const char *p)
#endif
#if (defined (__x86_64__) || defined (__i386__)) && defined (x86_THREAD_STATE)
nub_thread_t thread = DNBProcessGetCurrentThread (pid);
nub_thread_t thread = DNBProcessGetCurrentThreadMachPort (pid);
kern_return_t kr;
x86_thread_state_t gp_regs;
mach_msg_type_number_t gp_count = x86_THREAD_STATE_COUNT;