Changeset 52457 in vbox for trunk/src/VBox/Runtime/r3
- Timestamp:
- Aug 22, 2014 9:05:42 AM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 95670
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/thread-win.cpp
r48935 r52457 58 58 *******************************************************************************/ 59 59 static unsigned __stdcall rtThreadNativeMain(void *pvArgs); 60 static void rtThreadWinTellDebuggerThreadName(uint32_t idThread, const char *pszName); 60 61 61 62 … … 107 108 if (!TlsSetValue(g_dwSelfTLS, pThread)) 108 109 return VERR_FAILED_TO_SET_SELF_TLS; 110 if (IsDebuggerPresent()) 111 rtThreadWinTellDebuggerThreadName(GetCurrentThreadId(), pThread->szName); 109 112 return VINF_SUCCESS; 113 } 114 115 116 DECLHIDDEN(void) rtThreadNativeInformDebugger(PRTTHREADINT pThread) 117 { 118 rtThreadWinTellDebuggerThreadName((uint32_t)(uintptr_t)pThread->Core.Key, pThread->szName); 119 } 120 121 122 /** 123 * Communicates the thread name to the debugger, if we're begin debugged that 124 * is. 125 * 126 * See http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx for debugger 127 * interface details. 128 * 129 * @param idThread The thread ID. UINT32_MAX for current thread. 130 * @param pszName The name. 131 */ 132 static void rtThreadWinTellDebuggerThreadName(uint32_t idThread, const char *pszName) 133 { 134 struct 135 { 136 uint32_t uType; 137 const char *pszName; 138 uint32_t idThread; 139 uint32_t fFlags; 140 } Pkg = { 0x1000, pszName, idThread, 0 }; 141 __try 142 { 143 RaiseException(0x406d1388, 0, sizeof(Pkg)/sizeof(ULONG_PTR), (ULONG_PTR *)&Pkg); 144 } 145 __except(EXCEPTION_CONTINUE_EXECUTION) 146 { 147 148 } 110 149 } 111 150 … … 208 247 if (!TlsSetValue(g_dwSelfTLS, pThread)) 209 248 AssertReleaseMsgFailed(("failed to set self TLS. lasterr=%d thread '%s'\n", GetLastError(), pThread->szName)); 249 if (IsDebuggerPresent()) 250 rtThreadWinTellDebuggerThreadName(dwThreadId, &pThread->szName[0]); 210 251 211 252 int rc = rtThreadMain(pThread, dwThreadId, &pThread->szName[0]);
Note:
See TracChangeset
for help on using the changeset viewer.