本文整理汇总了C++中Symbols::GetSymbolLineInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ Symbols::GetSymbolLineInfo方法的具体用法?C++ Symbols::GetSymbolLineInfo怎么用?C++ Symbols::GetSymbolLineInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symbols
的用法示例。
在下文中一共展示了Symbols::GetSymbolLineInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SymEnumCallback
BOOL CALLBACK Symbols::SymEnumCallback(PSYMBOL_INFO pSymInfo, ULONG ulSymbolSize, PVOID pUserContext)
{
UserContext *pContext = (UserContext *)pUserContext;
Symbols *pThisPtr = (Symbols *)pContext->pThis;
DWORD_PTR dwAddress = (DWORD_PTR)pSymInfo->Address;
DWORD_PTR dwModBase = (DWORD_PTR)pSymInfo->ModBase;
//fprintf(stderr, "Symbol found at %p. Name: %.*s. Base address of module: %p\n",
// dwAddress, pSymInfo->NameLen, pSymInfo->Name, dwModBase);
bool bSuccess = false;
SymbolInfo symbolInfo;
symbolInfo.dwAddress = dwAddress;
symbolInfo.strName = std::move(std::vector<char>(pSymInfo->Name, pSymInfo->Name + strlen(pSymInfo->Name)));
symbolInfo.strName.emplace_back(0);
IMAGEHLP_LINE64 lineInfo = pThisPtr->GetSymbolLineInfo(dwAddress, symbolInfo.dwDisplacement, bSuccess);
if (bSuccess)
{
symbolInfo.dwLineNumber = lineInfo.LineNumber;
symbolInfo.strSourceFile = std::move(std::vector<char>(lineInfo.FileName, lineInfo.FileName + strlen(lineInfo.FileName)));
symbolInfo.strSourceFile.emplace_back(0);
}
ModuleSymbolInfo moduleSymbol;
moduleSymbol.dwModuleBaseAddress = dwModBase;
moduleSymbol.strName = std::move(std::vector<char>(pContext->pName, pContext->pName + strlen(pContext->pName)));
moduleSymbol.strName.emplace_back(0);
moduleSymbol.symbolInfo = std::move(symbolInfo);
pThisPtr->m_mapSymbols.insert(std::make_pair(dwModBase, std::move(moduleSymbol)));
return TRUE;
}