Skip to content

Commit 2539add

Browse files
committed
fix test script
1 parent 74a0b01 commit 2539add

3 files changed

Lines changed: 17 additions & 16 deletions

File tree

src/SOS/Strike/strike.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4408,10 +4408,9 @@ HRESULT PrintThreadsFromThreadStore(BOOL bMiniDump, BOOL bPrintLiveThreadsOnly)
44084408
}
44094409

44104410
BOOL bSwitchedOutFiber = Thread.osThreadId == SWITCHED_OUT_FIBER_OSID;
4411+
ULONG id = 0;
44114412
if (!IsKernelDebugger())
44124413
{
4413-
ULONG id = 0;
4414-
44154414
if (bSwitchedOutFiber)
44164415
{
44174416
table.WriteColumn(0, "<<<< ");
@@ -4457,10 +4456,17 @@ HRESULT PrintThreadsFromThreadStore(BOOL bMiniDump, BOOL bPrintLiveThreadsOnly)
44574456
#ifndef FEATURE_PAL
44584457
DWORD_PTR OleTlsDataAddr;
44594458
ULONG64 teb = 0;
4460-
IDebuggerServices* debuggerServices = GetDebuggerServices();
4461-
if (IsWindowsTarget() && !bSwitchedOutFiber
4462-
&& debuggerServices != nullptr
4463-
&& SUCCEEDED(debuggerServices->GetThreadTeb(Thread.osThreadId, &teb)) && teb != 0
4459+
if (IsWindowsTarget() && !bSwitchedOutFiber && id != 0)
4460+
{
4461+
ULONG curId;
4462+
if (SUCCEEDED(g_ExtSystem->GetCurrentThreadId(&curId)) &&
4463+
SUCCEEDED(g_ExtSystem->SetCurrentThreadId(id)))
4464+
{
4465+
g_ExtSystem->GetCurrentThreadTeb(&teb);
4466+
g_ExtSystem->SetCurrentThreadId(curId);
4467+
}
4468+
}
4469+
if (teb != 0
44644470
&& SafeReadMemory(TO_TADDR(teb + offsetof(TEB, ReservedForOle)),
44654471
&OleTlsDataAddr,
44664472
sizeof(OleTlsDataAddr), NULL) && OleTlsDataAddr != 0)

src/tests/SOS.UnitTests/Debuggees/ThreadApartment/ThreadApartment.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,8 @@ private static void Main()
3636
s_staReady.Wait();
3737
s_mtaReady.Wait();
3838

39-
// If a debugger is attached, break into it. Otherwise just wait.
40-
if (Debugger.IsAttached)
41-
{
42-
Debugger.Break();
43-
}
44-
else
45-
{
46-
Console.WriteLine("Ready for dump capture");
47-
Thread.Sleep(Timeout.Infinite);
48-
}
39+
Debugger.Break();
40+
41+
throw new Exception("ThreadApartment test complete");
4942
}
5043
}

src/tests/SOS.UnitTests/Scripts/ThreadApartment.script

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# This test is Windows-only since apartment state is a Windows COM concept.
44
#
55

6+
CONTINUE
7+
68
LOADSOS
79

810
# Verify that clrthreads shows the apartment state column with STA and MTA values.

0 commit comments

Comments
 (0)