本文整理汇总了C++中SymbolMap::enum_symbols方法的典型用法代码示例。如果您正苦于以下问题:C++ SymbolMap::enum_symbols方法的具体用法?C++ SymbolMap::enum_symbols怎么用?C++ SymbolMap::enum_symbols使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymbolMap
的用法示例。
在下文中一共展示了SymbolMap::enum_symbols方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ps_pglobal_lookup
/**
* Search for the symbol named name within the object named OBJ within
* the target process proc. If the symbol is found the address of the
* symbol is stored in addr.
*/
ps_err_e ps_pglobal_lookup(ps_prochandle* proc,
const char* obj,
const char* name,
psaddr_t* addr)
{
assert(addr);
*addr = 0;
try
{
SymbolEnum e;
SymbolMap* symbols = proc ? proc->symbols() : NULL;
if (!symbols)
{
return PS_ERR; // symbols not loaded
}
symbols->enum_symbols(name, &e, (SymbolTable::LKUP_DYNAMIC | SymbolTable::LKUP_ISMANGLED));
if (e.size())
{
// hack: cache the symbol table where the name was
// found -- it is very likely the other thread_db-related
// symbols are in the same table
if (!proc->symtab_)
{
ZObjectScope scope;
proc->symtab_ = e.front()->table(&scope);
}
assert(addr);
// return the first match
*addr = psaddr_t(e.front()->addr());
return PS_OK;
}
}
catch (const exception& e)
{
cerr << __func__ << ": " << e.what() << endl;
}
return PS_ERR;
}