[Lldb-commits] [lldb] r178619 - Fix another old usage of GetCurrentThread() to get a mach port
Jason Molenda
jmolenda at apple.com
Tue Apr 2 21:18:47 PDT 2013
Author: jmolenda
Date: Tue Apr 2 23:18:47 2013
New Revision: 178619
URL: http://llvm.org/viewvc/llvm-project?rev=178619&view=rev
Log:
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.
Modified:
lldb/trunk/tools/debugserver/source/DNB.cpp
lldb/trunk/tools/debugserver/source/DNB.h
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h
lldb/trunk/tools/debugserver/source/RNBRemote.cpp
Modified: lldb/trunk/tools/debugserver/source/DNB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNB.cpp?rev=178619&r1=178618&r2=178619&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/DNB.cpp (original)
+++ lldb/trunk/tools/debugserver/source/DNB.cpp Tue Apr 2 23:18:47 2013
@@ -1773,6 +1773,18 @@ DNBProcessGetCurrentThread (nub_process_
}
//----------------------------------------------------------------------
+// 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.
//----------------------------------------------------------------------
nub_thread_t
Modified: lldb/trunk/tools/debugserver/source/DNB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNB.h?rev=178619&r1=178618&r2=178619&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/DNB.h (original)
+++ lldb/trunk/tools/debugserver/source/DNB.h Tue Apr 2 23:18:47 2013
@@ -75,6 +75,7 @@ nub_bool_t DNBProcessGetExitStatus
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;
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp?rev=178619&r1=178618&r2=178619&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp Tue Apr 2 23:18:47 2013
@@ -186,6 +186,12 @@ MachProcess::GetCurrentThread ()
}
nub_thread_t
+MachProcess::GetCurrentThreadMachPort ()
+{
+ return m_thread_list.GetMachPortNumberByThreadID(m_thread_list.CurrentThreadID());
+}
+
+nub_thread_t
MachProcess::SetCurrentThread(nub_thread_t tid)
{
return m_thread_list.SetCurrentThread(tid);
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h?rev=178619&r1=178618&r2=178619&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h Tue Apr 2 23:18:47 2013
@@ -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;
Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=178619&r1=178618&r2=178619&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Tue Apr 2 23:18:47 2013
@@ -4099,7 +4099,7 @@ RNBRemote::HandlePacket_qProcessInfo (co
#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;
More information about the lldb-commits
mailing list