summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Salem <josalem@microsoft.com>2019-02-26 10:11:11 -0800
committerGitHub <noreply@github.com>2019-02-26 10:11:11 -0800
commitd05683140358e69109d126770f8076bfe5090092 (patch)
tree3c47eb9a3651bf2dcf3e7834cd9ca90f538f0147 /src
parentee755e322dabc2fc280e2561b0fbaf6e90aedf54 (diff)
parent3d26dad131abc354aeb4388139ecfaafe6cc4c60 (diff)
downloadcoreclr-d05683140358e69109d126770f8076bfe5090092.tar.gz
coreclr-d05683140358e69109d126770f8076bfe5090092.tar.bz2
coreclr-d05683140358e69109d126770f8076bfe5090092.zip
Merge pull request #22841 from josalem/stacktrace-cache-unloading-20179-prechange
Adds collection of `Assembly` objects while walking the stack in `DebugStackTrace::GetStackFrameInternal` * new field in `StackFrameHelper` in both managed and native (plus mscorlib macro definition) * retrieved via `methodDesc->GetAssembly()->GetDomainAssembly()->GetExposedAssemblyObject()` Calls `GetSourceLineInfo` with delegate signature that *does not* consume an `Assembly`. As a result, this there will be a follow up change to call the updated version after it exists in CoreFX. #20179
Diffstat (limited to 'src')
-rw-r--r--src/System.Private.CoreLib/src/System/Diagnostics/StackFrameHelper.cs14
-rw-r--r--src/vm/debugdebugger.cpp9
-rw-r--r--src/vm/debugdebugger.h1
-rw-r--r--src/vm/mscorlib.h1
4 files changed, 22 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..8885db9252 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(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;
@@ -115,7 +117,13 @@ namespace System.Diagnostics
return;
}
- MethodInfo symbolsMethodInfo = symbolsType.GetMethod("GetSourceLineInfo", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
+ Type[] parameterTypes = new Type[]
+ {
+ typeof(string), typeof(IntPtr), typeof(int), typeof(IntPtr),
+ typeof(int), typeof(int), typeof(int),
+ typeof(string).MakeByRefType(), typeof(int).MakeByRefType(), typeof(int).MakeByRefType()
+ };
+ MethodInfo symbolsMethodInfo = symbolsType.GetMethod("GetSourceLineInfo", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, parameterTypes, null);
if (symbolsMethodInfo == null)
{
return;
diff --git a/src/vm/debugdebugger.cpp b/src/vm/debugdebugger.cpp
index 3402a8b506..d63433f4f4 100644
--- a/src/vm/debugdebugger.cpp
+++ b/src/vm/debugdebugger.cpp
@@ -402,6 +402,11 @@ FCIMPL4(void, DebugStackTrace::GetStackFramesInternal,
SetObjectReference( (OBJECTREF *)&(pStackFrameHelper->rgAssemblyPath), (OBJECTREF)assemblyPathArray,
pStackFrameHelper->GetAppDomain());
+ // Allocate memory for the array of assemblies
+ PTRARRAYREF assemblyArray = (PTRARRAYREF) AllocateObjectArray(data.cElements, g_pObjectClass);
+ 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 +517,10 @@ FCIMPL4(void, DebugStackTrace::GetStackFramesInternal,
I4 *pILI4 = (I4 *)((I4ARRAYREF)pStackFrameHelper->rgiILOffset)->GetDirectPointerToNonObjectElements();
pILI4[iNumValidFrames] = data.pElements[i].dwILOffset;
+ // Assembly
+ OBJECTREF pAssembly = pFunc->GetAssembly()->GetExposedObject();
+ pStackFrameHelper->rgAssembly->SetAt(iNumValidFrames, pAssembly);
+
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;
diff --git a/src/vm/mscorlib.h b/src/vm/mscorlib.h
index 52e4508446..c6d6b05aae 100644
--- a/src/vm/mscorlib.h
+++ b/src/vm/mscorlib.h
@@ -760,6 +760,7 @@ DEFINE_FIELD_U(rgiILOffset, StackFrameHelper, rgiILOffset)
DEFINE_FIELD_U(dynamicMethods, StackFrameHelper, dynamicMethods)
DEFINE_FIELD_U(rgMethodHandle, StackFrameHelper, rgMethodHandle)
DEFINE_FIELD_U(rgAssemblyPath, StackFrameHelper, rgAssemblyPath)
+DEFINE_FIELD_U(rgAssembly, StackFrameHelper, rgAssembly)
DEFINE_FIELD_U(rgLoadedPeAddress, StackFrameHelper, rgLoadedPeAddress)
DEFINE_FIELD_U(rgiLoadedPeSize, StackFrameHelper, rgiLoadedPeSize)
DEFINE_FIELD_U(rgInMemoryPdbAddress, StackFrameHelper, rgInMemoryPdbAddress)