Skip to content

Commit 5d1981e

Browse files
authored
Fix DAC getting alloc context for thread (#103610)
1 parent b8ef822 commit 5d1981e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/coreclr/debug/daccess/request.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ ClrDataAccess::GetThreadAllocData(CLRDATA_ADDRESS addr, struct DacpAllocData *da
720720

721721
Thread* thread = PTR_Thread(TO_TADDR(addr));
722722

723-
gc_alloc_context* pAllocContext = thread->GetAllocContext();
723+
PTR_gc_alloc_context pAllocContext = thread->GetAllocContext();
724724

725725
if (pAllocContext != NULL)
726726
{
@@ -827,7 +827,7 @@ HRESULT ClrDataAccess::GetThreadDataImpl(CLRDATA_ADDRESS threadAddr, struct Dacp
827827
threadData->state = thread->m_State;
828828
threadData->preemptiveGCDisabled = thread->m_fPreemptiveGCDisabled;
829829

830-
gc_alloc_context* allocContext = thread->GetAllocContext();
830+
PTR_gc_alloc_context allocContext = thread->GetAllocContext();
831831
if (allocContext)
832832
{
833833
threadData->allocContextPtr = TO_CDADDR(allocContext->alloc_ptr);

src/coreclr/vm/threads.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,8 @@ class TailCallTls
448448
const PortableTailCallFrame* GetFrame() { return m_frame; }
449449
};
450450

451+
typedef DPTR(struct gc_alloc_context) PTR_gc_alloc_context;
452+
451453
// #ThreadClass
452454
//
453455
// A code:Thread contains all the per-thread information needed by the runtime. We can get this
@@ -947,12 +949,12 @@ class Thread
947949

948950
// We store a pointer to this thread's alloc context here for easier introspection
949951
// from other threads and diagnostic tools
950-
gc_alloc_context* m_alloc_context;
952+
PTR_gc_alloc_context m_alloc_context;
951953

952954
public:
953-
inline void InitAllocContext() { LIMITED_METHOD_CONTRACT; m_alloc_context = &t_thread_alloc_context; }
955+
inline void InitAllocContext() { LIMITED_METHOD_CONTRACT; m_alloc_context = PTR_gc_alloc_context(&t_thread_alloc_context); }
954956

955-
inline gc_alloc_context *GetAllocContext() { LIMITED_METHOD_CONTRACT; return m_alloc_context; }
957+
inline PTR_gc_alloc_context GetAllocContext() { LIMITED_METHOD_CONTRACT; return m_alloc_context; }
956958

957959
// This is the type handle of the first object in the alloc context at the time
958960
// we fire the AllocationTick event. It's only for tooling purpose.

0 commit comments

Comments
 (0)