From a11d29b4d38663421fb5d6914cb1a7b2e6bc92f8 Mon Sep 17 00:00:00 2001 From: Sangwook Kim Date: Tue, 18 Feb 2020 15:48:15 +0900 Subject: [Tizen] Add FEATURE_LARGEADDRESS_SUPPORT Many diagnostic tools are unaware of 32-bit applications which have large address spaces (> 2GB). Such tools include the TraceEvent library (required by PerfView and dotnet-trace), and Visual Studio. They assume the address range 0x80000000 through 0xFFFFFFFF as the system space and thus often fail to read symbols from event traces generated by CoreCLR. This workaround is to support such scenarios by simply discarding MSBs of 32-bit instruction pointer values in the trace output. Only a minimal set of values required for symbol resolution are affected by this change. Beware that you will have to manually restore the original values when you inspect them in lldb or etc. --- src/vm/CMakeLists.txt | 4 ++++ src/vm/eventpipeblock.cpp | 6 ++++++ src/vm/eventtrace.cpp | 3 +++ 3 files changed, 13 insertions(+) diff --git a/src/vm/CMakeLists.txt b/src/vm/CMakeLists.txt index c90c955003..10f8d340aa 100644 --- a/src/vm/CMakeLists.txt +++ b/src/vm/CMakeLists.txt @@ -38,6 +38,10 @@ if(FEATURE_JIT_PITCHING) add_definitions(-DFEATURE_JIT_PITCHING) endif(FEATURE_JIT_PITCHING) +if(FEATURE_EVENT_TRACE AND NOT _TARGET_64BIT_) + add_definitions(-DFEATURE_LARGEADDRESS_SUPPORT) +endif() + set(VM_SOURCES_DAC_AND_WKS_COMMON appdomain.cpp array.cpp diff --git a/src/vm/eventpipeblock.cpp b/src/vm/eventpipeblock.cpp index fb9d6c721e..d510ec8adf 100644 --- a/src/vm/eventpipeblock.cpp +++ b/src/vm/eventpipeblock.cpp @@ -457,6 +457,12 @@ bool EventPipeStackBlock::WriteStack(DWORD stackId, StackContents* pStack) if (stackSize > 0) { memcpy(m_pWritePointer, pStack->GetPointer(), stackSize); +#ifdef FEATURE_LARGEADDRESS_SUPPORT + for (int i = 0; i < stackSize / sizeof(UINT_PTR); i++) + { + ((UINT_PTR*)m_pWritePointer)[i] &= INT_MAX; + } +#endif // FEATURE_LARGEADDRESS_SUPPORT m_pWritePointer += stackSize; } diff --git a/src/vm/eventtrace.cpp b/src/vm/eventtrace.cpp index 36235d605b..6ef769dc94 100644 --- a/src/vm/eventtrace.cpp +++ b/src/vm/eventtrace.cpp @@ -6426,6 +6426,9 @@ VOID ETW::MethodLog::SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptio codeInfo.GetMethodRegionInfo(&methodRegionInfo); ullMethodStartAddress = (ULONGLONG)methodRegionInfo.hotStartAddress; +#ifdef FEATURE_LARGEADDRESS_SUPPORT + ullMethodStartAddress &= INT_MAX; +#endif ulMethodSize = (ULONG)methodRegionInfo.hotSize; ullModuleID = (ULONGLONG)(TADDR) pModule; -- cgit v1.2.3