summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Salem <josalem@microsoft.com>2019-02-19 15:20:06 -0800
committerJohn Salem <josalem@microsoft.com>2019-02-19 16:28:37 -0800
commit614876ade8dc6cb966932036c9a5adeba1769e0d (patch)
treee03e15c58fbb217da1ad9a45a2215b7d50d22a94
parent89e78f42ba11beaa81635a75cf593a3713dba176 (diff)
downloadcoreclr-614876ade8dc6cb966932036c9a5adeba1769e0d.tar.gz
coreclr-614876ade8dc6cb966932036c9a5adeba1769e0d.tar.bz2
coreclr-614876ade8dc6cb966932036c9a5adeba1769e0d.zip
Add array of managed assembly objects to StackFrameHelper class:
* allows for more robust caching of source info (in CoreFX) in light of unloadability * allows dynamic and regular assemblies to use the same key for source info caching (in CoreFX) #20179
-rw-r--r--src/System.Private.CoreLib/src/System/Diagnostics/StackFrameHelper.cs8
-rw-r--r--src/vm/debugdebugger.cpp10
-rw-r--r--src/vm/debugdebugger.h1
3 files changed, 16 insertions, 3 deletions
diff --git a/src/System.Private.CoreLib/src/System/Diagnostics/StackFrameHelper.cs b/src/System.Private.CoreLib/src/System/Diagnostics/StackFrameHelper.cs
index e8d7ef5400..c86a90f5e3 100644
--- a/src/System.Private.CoreLib/src/System/Diagnostics/StackFrameHelper.cs
+++ b/src/System.Private.CoreLib/src/System/Diagnostics/StackFrameHelper.cs
@@ -34,6 +34,7 @@ namespace System.Diagnostics
private IntPtr[] rgMethodHandle;
private string[] rgAssemblyPath;
+ private Assembly[] rgAssembly;
private IntPtr[] rgLoadedPeAddress;
private int[] rgiLoadedPeSize;
private IntPtr[] rgInMemoryPdbAddress;
@@ -47,8 +48,8 @@ namespace System.Diagnostics
private int iFrameCount;
#pragma warning restore 414
- private delegate void GetSourceLineInfoDelegate(string assemblyPath, IntPtr loadedPeAddress, int loadedPeSize,
- IntPtr inMemoryPdbAddress, int inMemoryPdbSize, int methodToken, int ilOffset,
+ private delegate void GetSourceLineInfoDelegate(Assembly assembly, string assemblyPath, IntPtr loadedPeAddress,
+ int loadedPeSize, IntPtr inMemoryPdbAddress, int inMemoryPdbSize, int methodToken, int ilOffset,
out string sourceFile, out int sourceLine, out int sourceColumn);
private static GetSourceLineInfoDelegate s_getSourceLineInfo = null;
@@ -64,6 +65,7 @@ namespace System.Diagnostics
rgiOffset = null;
rgiILOffset = null;
rgAssemblyPath = null;
+ rgAssembly = null;
rgLoadedPeAddress = null;
rgiLoadedPeSize = null;
rgInMemoryPdbAddress = null;
@@ -138,7 +140,7 @@ namespace System.Diagnostics
// ENC or the source/line info was already retrieved, the method token is 0.
if (rgiMethodToken[index] != 0)
{
- s_getSourceLineInfo(rgAssemblyPath[index], rgLoadedPeAddress[index], rgiLoadedPeSize[index],
+ s_getSourceLineInfo(rgAssembly[index], rgAssemblyPath[index], rgLoadedPeAddress[index], rgiLoadedPeSize[index],
rgInMemoryPdbAddress[index], rgiInMemoryPdbSize[index], rgiMethodToken[index],
rgiILOffset[index], out rgFilename[index], out rgiLineNumber[index], out rgiColumnNumber[index]);
}
diff --git a/src/vm/debugdebugger.cpp b/src/vm/debugdebugger.cpp
index 3402a8b506..a8393403eb 100644
--- a/src/vm/debugdebugger.cpp
+++ b/src/vm/debugdebugger.cpp
@@ -402,6 +402,12 @@ FCIMPL4(void, DebugStackTrace::GetStackFramesInternal,
SetObjectReference( (OBJECTREF *)&(pStackFrameHelper->rgAssemblyPath), (OBJECTREF)assemblyPathArray,
pStackFrameHelper->GetAppDomain());
+ // Allocate memory for the array of assemblies
+ MethodTable * pAssemblyMT = MscorlibBinder::GetClass(CLASS__ASSEMBLY);
+ PTRARRAYREF assemblyArray = (PTRARRAYREF) AllocateObjectArray(data.cElements, pAssemblyMT);
+ SetObjectReference( (OBJECTREF *)&(pStackFrameHelper->rgAssembly), (OBJECTREF)assemblyArray,
+ pStackFrameHelper->GetAppDomain());
+
// Allocate memory for the LoadedPeAddress
BASEARRAYREF loadedPeAddressArray = (BASEARRAYREF) AllocatePrimitiveArray(ELEMENT_TYPE_I, data.cElements);
SetObjectReference( (OBJECTREF *)&(pStackFrameHelper->rgLoadedPeAddress), (OBJECTREF)loadedPeAddressArray,
@@ -512,6 +518,10 @@ FCIMPL4(void, DebugStackTrace::GetStackFramesInternal,
I4 *pILI4 = (I4 *)((I4ARRAYREF)pStackFrameHelper->rgiILOffset)->GetDirectPointerToNonObjectElements();
pILI4[iNumValidFrames] = data.pElements[i].dwILOffset;
+ // Assembly
+ OBJECTREF *pAssemblyArray = pStackFrameHelper->rgAssembly->GetDataPtr();
+ pAssemblyArray[iNumValidFrames] = pFunc->GetAssembly()->GetDomainAssembly()->GetExposedAssemblyObject();
+
if (data.fDoWeHaveAnyFramesFromForeignStackTrace)
{
// Set the BOOL indicating if the frame represents the last frame from a foreign exception stack trace.
diff --git a/src/vm/debugdebugger.h b/src/vm/debugdebugger.h
index 35758e185b..e608ebdf7e 100644
--- a/src/vm/debugdebugger.h
+++ b/src/vm/debugdebugger.h
@@ -48,6 +48,7 @@ public:
PTRARRAYREF dynamicMethods;
BASEARRAYREF rgMethodHandle;
PTRARRAYREF rgAssemblyPath;
+ PTRARRAYREF rgAssembly;
BASEARRAYREF rgLoadedPeAddress;
I4ARRAYREF rgiLoadedPeSize;
BASEARRAYREF rgInMemoryPdbAddress;