internal StackFrame CreateStackFrame(StackFrameVersionOne v1StackFrame) { StackFrame stackFrame = null; if (v1StackFrame != null) { stackFrame = new StackFrame { Address = new Address { BaseAddress = v1StackFrame.Address, Offset = v1StackFrame.Offset }, Module = v1StackFrame.Module, Parameters = v1StackFrame.Parameters, Properties = v1StackFrame.Properties, ThreadId = v1StackFrame.ThreadId }; } stackFrame.Location = CreateLocation(v1StackFrame.FullyQualifiedLogicalName, v1StackFrame.LogicalLocationKey, v1StackFrame.Message, v1StackFrame.Uri, v1StackFrame.UriBaseId, v1StackFrame.Column, v1StackFrame.Line); return(stackFrame); }
public override StackFrameVersionOne VisitStackFrameVersionOne(StackFrameVersionOne node) { if (!string.IsNullOrEmpty(node.LogicalLocationKey) && !string.IsNullOrEmpty(node.FullyQualifiedLogicalName) && !node.FullyQualifiedLogicalName.Equals(node.LogicalLocationKey)) { LogicalLocationKeyToFullyQualifiedNameMap[node.LogicalLocationKey] = node.FullyQualifiedLogicalName; } // v1 stack frame does not reference a decorated name return(base.VisitStackFrameVersionOne(node)); }
internal StackFrameVersionOne CreateStackFrameVersionOne(StackFrame v2StackFrame) { StackFrameVersionOne stackFrame = null; if (v2StackFrame != null) { stackFrame = new StackFrameVersionOne { // https://github.com/Microsoft/sarif-sdk/issues/1469 // TODO: Ensure stackFrame.address and offset properties are being transformed correctly during v1 -> v2 conversion and vice-versa // Address = v2StackFrame.Location?.PhysicalLocation?.Address?.AbsoluteAddress ?? 0, Module = v2StackFrame.Module, // Offset = v2StackFrame.Location?.PhysicalLocation?.Address?.OffsetFromParent ?? 0, Parameters = v2StackFrame.Parameters, Properties = v2StackFrame.Properties, ThreadId = v2StackFrame.ThreadId }; Location location = v2StackFrame.Location; if (location != null) { string fqln = location.LogicalLocation?.FullyQualifiedName; if (_currentV2Run.LogicalLocations != null && location.LogicalLocation != null && !string.IsNullOrWhiteSpace(_currentV2Run.LogicalLocations[location.LogicalLocation.Index].FullyQualifiedName)) { stackFrame.FullyQualifiedLogicalName = _currentV2Run.LogicalLocations[location.LogicalLocation.Index].FullyQualifiedName; stackFrame.LogicalLocationKey = fqln != _currentV2Run.LogicalLocations[location.LogicalLocation.Index].FullyQualifiedName ? fqln : null; } else { stackFrame.FullyQualifiedLogicalName = fqln; } stackFrame.Message = location.Message?.Text; PhysicalLocation physicalLocation = location.PhysicalLocation; if (physicalLocation != null) { stackFrame.Column = physicalLocation.Region?.StartColumn ?? 0; stackFrame.Line = physicalLocation.Region?.StartLine ?? 0; stackFrame.Uri = physicalLocation.ArtifactLocation?.Uri; stackFrame.UriBaseId = physicalLocation.ArtifactLocation?.UriBaseId; } } } return(stackFrame); }
internal StackFrameVersionOne CreateStackFrame(StackFrame v2StackFrame) { StackFrameVersionOne stackFrame = null; if (v2StackFrame != null) { stackFrame = new StackFrameVersionOne { Address = v2StackFrame.Address, Module = v2StackFrame.Module, Offset = v2StackFrame.Offset, Parameters = v2StackFrame.Parameters, Properties = v2StackFrame.Properties, ThreadId = v2StackFrame.ThreadId }; Location location = v2StackFrame.Location; if (location != null) { string fqln = location.FullyQualifiedLogicalName; if (_currentV2Run.LogicalLocations != null && _currentV2Run.LogicalLocations.ContainsKey(fqln) && !string.IsNullOrWhiteSpace(_currentV2Run.LogicalLocations[fqln].FullyQualifiedName)) { stackFrame.FullyQualifiedLogicalName = _currentV2Run.LogicalLocations[fqln].FullyQualifiedName; stackFrame.LogicalLocationKey = fqln; } else { stackFrame.FullyQualifiedLogicalName = fqln; } stackFrame.Message = location.Message?.Text; PhysicalLocation physicalLocation = location.PhysicalLocation; if (physicalLocation != null) { stackFrame.Column = physicalLocation.Region?.StartColumn ?? 0; stackFrame.Line = physicalLocation.Region?.StartLine ?? 0; stackFrame.Uri = physicalLocation.FileLocation?.Uri; stackFrame.UriBaseId = physicalLocation.FileLocation?.UriBaseId; } } } return(stackFrame); }