From cd998ae421bb8fb68f170de8f016940084cf19e6 Mon Sep 17 00:00:00 2001 From: John Chen Date: Mon, 18 Apr 2016 16:38:39 -0700 Subject: Fix nidump to avoid crashing while working with Ready to Run images [tfs-changeset: 1597064] --- src/debug/daccess/nidump.cpp | 2 +- src/vm/nativeformatreader.h | 6 +++--- src/vm/readytoruninfo.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/debug/daccess/nidump.cpp b/src/debug/daccess/nidump.cpp index 9b4fe1c176..29c326debe 100644 --- a/src/debug/daccess/nidump.cpp +++ b/src/debug/daccess/nidump.cpp @@ -9324,7 +9324,7 @@ void NativeImageDumper::DumpReadyToRun() IMAGE_DATA_DIRECTORY * pEntryPointsDir = FindReadyToRunSection(READYTORUN_SECTION_METHODDEF_ENTRYPOINTS); if (pEntryPointsDir != NULL) - m_methodDefEntryPoints = NativeFormat::NativeArray(&m_nativeReader, pEntryPointsDir->VirtualAddress); + m_methodDefEntryPoints = NativeFormat::NativeArray((TADDR)&m_nativeReader, pEntryPointsDir->VirtualAddress); DisplayStartCategory("NativeInfo", NATIVE_INFO); diff --git a/src/vm/nativeformatreader.h b/src/vm/nativeformatreader.h index a410884626..fc5391ca05 100644 --- a/src/vm/nativeformatreader.h +++ b/src/vm/nativeformatreader.h @@ -240,9 +240,9 @@ namespace NativeFormat { } - NativeParser(NativeReader * pReader, uint offset) + NativeParser(PTR_NativeReader pReader, uint offset) { - _pReader = dac_cast(pReader); + _pReader = pReader; _offset = offset; } @@ -313,7 +313,7 @@ namespace NativeFormat { } - NativeArray(NativeReader * pReader, uint offset) + NativeArray(PTR_NativeReader pReader, uint offset) : _pReader(pReader) { uint val; diff --git a/src/vm/readytoruninfo.cpp b/src/vm/readytoruninfo.cpp index 158a23370f..56dc506b1b 100644 --- a/src/vm/readytoruninfo.cpp +++ b/src/vm/readytoruninfo.cpp @@ -342,7 +342,7 @@ PTR_BYTE ReadyToRunInfo::GetDebugInfo(PTR_RUNTIME_FUNCTION pRuntimeFunction) SIZE_T methodIndex = pRuntimeFunction - m_pRuntimeFunctions; _ASSERTE(methodIndex < m_nRuntimeFunctions); - NativeArray debugInfoIndex(&m_nativeReader, pDebugInfoDir->VirtualAddress); + NativeArray debugInfoIndex(dac_cast(PTR_HOST_INT_TO_TADDR(&m_nativeReader)), pDebugInfoDir->VirtualAddress); uint offset; if (!debugInfoIndex.TryGetAt((DWORD)methodIndex, &offset)) -- cgit v1.2.3