public CallStackItem GetSymbolNameFromAddress(UInt32 address) { CallStackItem result = new CallStackItem(); if (AddressIsInRange(address)) { IDiaSymbol diaSymbol; session.findSymbolByVA(address, SymTagEnum.SymTagFunction, out diaSymbol); result.Description = diaSymbol.name + "()"; IDiaEnumLineNumbers lineNumbers; session.findLinesByVA(address, 4, out lineNumbers); IDiaLineNumber lineNum; uint celt; lineNumbers.Next(1, out lineNum, out celt); if (celt == 1) { string baseFilename = lineNum.sourceFile.fileName.Substring(lineNum.sourceFile.fileName.LastIndexOf('\\') + 1); result.Source = baseFilename; result.Line = (int)lineNum.lineNumber; } } else { result.Description = "<address out of range>"; } return(result); }
public string GetSymbolNameFromAddress(UInt32 address) { if (AddressIsInRange(address)) { IDiaSymbol diaSymbol; m_session.findSymbolByVA(address, SymTagEnum.SymTagFunction, out diaSymbol); IDiaEnumLineNumbers lineNumbers; m_session.findLinesByVA(address, 4, out lineNumbers); IDiaLineNumber lineNum; uint celt; lineNumbers.Next(1, out lineNum, out celt); if (celt == 1) { string baseFilename = lineNum.sourceFile.fileName.Substring(lineNum.sourceFile.fileName.LastIndexOf('\\') + 1); return(diaSymbol.name + " (" + baseFilename + ":" + lineNum.lineNumber + ")"); } else { return(diaSymbol.name); } } else { return("<address out of range>"); } }