private SourceFileLocation ToSourceFileLocation(NativeSourceFileLocation nativeSymbol) { IDiaEnumLineNumbers lineNumbers = GetLineNumbers(nativeSymbol.AddressSection, nativeSymbol.AddressOffset, nativeSymbol.Length); if (lineNumbers.count <= 0) { _logger.LogWarning("Failed to locate line number for " + nativeSymbol); return(new SourceFileLocation(_binary, "", 0)); } SourceFileLocation result = null; foreach (IDiaLineNumber lineNumber in lineNumbers) { if (result == null) { result = new SourceFileLocation( nativeSymbol.Symbol, lineNumber.sourceFile.fileName, lineNumber.lineNumber); // do not break to make sure all lineNumbers are enumerated - not sure if this is necessary } } return(result); }
private SourceFileLocation ToSourceFileLocation(NativeSourceFileLocation nativeSymbol) { IDiaEnumLineNumbers lineNumbers = GetLineNumbers(nativeSymbol.AddressSection, nativeSymbol.AddressOffset, nativeSymbol.Length); if (lineNumbers.count > 0) { SourceFileLocation result = null; foreach (IDiaLineNumber lineNumber in lineNumbers) { if (result == null) { result = new SourceFileLocation( nativeSymbol.Symbol, lineNumber.sourceFile.fileName, lineNumber.lineNumber); } } return(result); } else { ErrorMessages.Add("Failed to locate line number for " + nativeSymbol); return(new SourceFileLocation(Binary, "", 0)); } }
private SourceFileLocation ToSourceFileLocation(NativeSourceFileLocation nativeSymbol) { IDiaEnumLineNumbers lineNumbers = GetLineNumbers(nativeSymbol.AddressSection, nativeSymbol.AddressOffset, nativeSymbol.Length); if (lineNumbers.count <= 0) { _logger.LogWarning("Failed to locate line number for " + nativeSymbol); return new SourceFileLocation(_binary, "", 0); } SourceFileLocation result = null; foreach (IDiaLineNumber lineNumber in lineNumbers) { if (result == null) { result = new SourceFileLocation( nativeSymbol.Symbol, lineNumber.sourceFile.fileName, lineNumber.lineNumber); // do not break to make sure all lineNumbers are enumerated - not sure if this is necessary } } return result; }