Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Engine/ModuleInfoHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ await Task.Run(() => Parallel.ForEach(listOfCallStacks, currItem => {
using var sreader = new StringReader(line);
using var reader = XmlReader.Create(sreader, new XmlReaderSettings() { XmlResolver = null });
if (reader.Read()) {
// seems to be XML; process attributes only if all 3 are there
// seems to be XML; start reading attributes
var moduleNameAttributeVal = reader.GetAttribute("module");
if (string.IsNullOrEmpty(moduleNameAttributeVal)) moduleNameAttributeVal = reader.GetAttribute("name");
var moduleName = Path.GetFileNameWithoutExtension(moduleNameAttributeVal);
Expand All @@ -96,15 +96,17 @@ await Task.Run(() => Parallel.ForEach(listOfCallStacks, currItem => {
var pdbGuid = reader.GetAttribute("guid");
var pdbAge = reader.GetAttribute("age");
string uniqueModuleName;
// createe a map of the last mapped module names to handle cases when the frame is "truncated" and the above PDB details are not available
// Create a map of the last mapped module names to handle future cases when the frame is "truncated" and the above PDB details are not available
if (pdbGuid != null && pdbAge != null) {
// PDB GUID and age are valid
uniqueModuleName = $"{pdbGuid.Replace("-", string.Empty).ToUpper()}{pdbAge}";
if (latestMappedModuleNames.ContainsKey(moduleName)) latestMappedModuleNames[moduleName] = uniqueModuleName;
else latestMappedModuleNames.Add(moduleName, uniqueModuleName);
} else {
// This frame / line is incomplete to the extent that we don't even have the PDB GUID and / or the PDB age - return the input as-is
if (!latestMappedModuleNames.TryGetValue(moduleName, out uniqueModuleName)) {
anyTaskFailed = true;
return;
outCallstack.AppendLine(line);
continue;
}
}
lock (syms) {
Expand Down
2 changes: 1 addition & 1 deletion Tests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ private string PrepareLargeXEventInput() {
// modify the input to not have any prior PDB info - this will be an "error" case
input = "Frame = <frame id=\"02\" name=\"sqldk.dll\" address = \"0x100440609\"/>\r\n<frame id=\"03\" name=\"sqldk.dll\" address=\"0x10042249f\" />\n";
ret = await csr.ResolveCallstacksAsync(await csr.GetListofCallStacksAsync(input, false, cts), pdbPath, false, null, false, true, false, true, false, false, null, cts);
Assert.IsTrue(ret.StartsWith("Unable to determine symbol information from XML frames"));
Assert.AreEqual("<frame id=\"02\" name=\"sqldk.dll\" address = \"0x100440609\"/>\r\n<frame id=\"03\" name=\"sqldk.dll\" address=\"0x10042249f\" />", ret.Trim());
}

/// End-to-end test with XE histogram target and XML frames.
Expand Down