Skip to content

Commit 8a3ac13

Browse files
committed
fix stacktrace resolution on system frames
1 parent 5bd0a10 commit 8a3ac13

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

src/TraceEvent/TraceLog.cs

+23-13
Original file line numberDiff line numberDiff line change
@@ -286,16 +286,30 @@ private void SetupInitialRundownCallbacks(EventPipeEventSource rawEvents)
286286

287287
clrRundownParser.MethodDCStopVerbose += delegate (MethodLoadUnloadVerboseTraceData data)
288288
{
289-
if (data.IsJitted)
289+
// TODO we need this also for non-jitted methods, otherwise we won't resolve some frames, for example:
290+
// "System.Private.CoreLib.il" - "System.Threading.Tasks.Task.Wait()"
291+
// Is it OK to use InsertJITTEDMethod & FindJITTEDMethodFromAddress or do we need something else?
292+
// if (data.IsJitted)
293+
// {
294+
TraceProcess process = processes.GetOrCreateProcess(data.ProcessID, data.TimeStampQPC);
295+
process.InsertJITTEDMethod(data.MethodStartAddress, data.MethodSize, delegate ()
290296
{
291-
TraceProcess process = processes.GetOrCreateProcess(data.ProcessID, data.TimeStampQPC);
292-
process.InsertJITTEDMethod(data.MethodStartAddress, data.MethodSize, delegate ()
293-
{
294-
TraceManagedModule module = process.LoadedModules.GetOrCreateManagedModule(data.ModuleID, data.TimeStampQPC);
295-
MethodIndex methodIndex = CodeAddresses.Methods.NewMethod(TraceLog.GetFullName(data), module.ModuleFile.ModuleFileIndex, data.MethodToken);
296-
return new TraceProcess.MethodLookupInfo(data.MethodStartAddress, data.MethodSize, methodIndex);
297-
});
298-
}
297+
TraceManagedModule module = process.LoadedModules.GetOrCreateManagedModule(data.ModuleID, data.TimeStampQPC);
298+
MethodIndex methodIndex = CodeAddresses.Methods.NewMethod(GetFullName(data), module.ModuleFile.ModuleFileIndex, data.MethodToken);
299+
return new TraceProcess.MethodLookupInfo(data.MethodStartAddress, data.MethodSize, methodIndex);
300+
});
301+
// }
302+
// if (data.IsJitted)
303+
// {
304+
// ILMapIndex ilMap = UnloadILMapForMethod(methodIndex, data);
305+
// }
306+
// // Set the info
307+
// info.SetMethodIndex(this, methodIndex);
308+
// if (ilMap != ILMapIndex.Invalid)
309+
// {
310+
// info.SetILMapIndex(this, ilMap);
311+
// }
312+
// info.SetOptimizationTier(data.OptimizationTier);
299313
};
300314
}
301315

@@ -9195,10 +9209,6 @@ internal void AddILMapping(MethodILToNativeMapTraceData data)
91959209
var ilMap = new ILToNativeMap();
91969210
ilMap.Next = ILMapIndex.Invalid;
91979211
var process = log.Processes.GetOrCreateProcess(data.ProcessID, data.TimeStampQPC);
9198-
if (process == null)
9199-
{
9200-
return;
9201-
}
92029212

92039213
ilMap.ProcessIndex = process.ProcessIndex;
92049214
ILToNativeMapTuple tuple;

0 commit comments

Comments
 (0)