Skip to content

Commit 0b71a96

Browse files
fischman-bcnycompnerd
authored andcommitted
Ignore Visual C++ internal exception for reporting thread-names
1 parent e0d1bab commit 0b71a96

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

Headers/DebugServer2/Host/Windows/ExtraWrappers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#define DS2_EXCEPTION_UNCAUGHT_COM 0x800706BA
2020
#define DS2_EXCEPTION_UNCAUGHT_USER 0xE06D7363
2121
#define DS2_EXCEPTION_UNCAUGHT_WINRT 0x40080201
22+
#define DS2_EXCEPTION_VC_THREAD_NAME_SET 0x406D1388
2223

2324
#if !defined(HAVE_WaitForDebugEventEx)
2425
#define WaitForDebugEventEx WaitForDebugEvent

Sources/Target/Windows/Thread.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,14 @@ void Thread::updateState(DEBUG_EVENT const &de) {
125125
PRI_PTR_CAST(de.u.Exception.ExceptionRecord.ExceptionAddress));
126126

127127
switch (de.u.Exception.ExceptionRecord.ExceptionCode) {
128+
case DS2_EXCEPTION_VC_THREAD_NAME_SET:
129+
// This is a special exception code that is used by the Microsoft C++
130+
// runtime to notify the debugger that a thread has started or exited.
131+
// We don't care about this, so we just ignore it. Some context at
132+
// https://github.com/go-delve/delve/issues/1383.
133+
_stopInfo.clear();
134+
_process->resume();
135+
break;
128136
case STATUS_BREAKPOINT:
129137
case STATUS_SINGLE_STEP: {
130138
_stopInfo.event = StopInfo::kEventStop;

Sources/Utils/Windows/Stringify.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ char const *Stringify::ExceptionCode(DWORD code) {
120120
return "0xE06D7363 (uncaught user exception)";
121121
case DS2_EXCEPTION_UNCAUGHT_WINRT:
122122
return "0x40080201 (uncaught WinRT exception)";
123+
case DS2_EXCEPTION_VC_THREAD_NAME_SET:
124+
return "0x406D1388 (VC thread name set)";
123125
DO_DEFAULT("unknown exception code", code)
124126
}
125127
}

0 commit comments

Comments
 (0)