本文整理汇总了C++中BPatch_function::getModuleName方法的典型用法代码示例。如果您正苦于以下问题:C++ BPatch_function::getModuleName方法的具体用法?C++ BPatch_function::getModuleName怎么用?C++ BPatch_function::getModuleName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BPatch_function
的用法示例。
在下文中一共展示了BPatch_function::getModuleName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShowFunctions
static void ShowFunctions (BPatch_image *appImage)
{
BPatch_Vector<BPatch_function *> *vfunctions = appImage->getProcedures (false);
cout << PACKAGE_NAME << ": " << vfunctions->size() << " functions found in binary " << endl;
unsigned i = 0;
while (i < vfunctions->size())
{
char name[1024];
BPatch_function *f = (*vfunctions)[i];
f->getName (name, 1024);
if (VerboseLevel)
{
char mname[1024], tname[1024], modname[1024];
f->getMangledName (mname, 1024);
f->getTypedName (tname, 1024);
f->getModuleName (modname, 1024);
cout << " * " << i+1 << " of " << vfunctions->size() << ", Name: " << name << endl
<< " Mangled Name: " << mname << endl
<< " Typed Name : " << tname << endl
<< " Module name : " << modname << endl
<< " Base address: " << f->getBaseAddr() << endl
<< " Instrumentable? " << (f->isInstrumentable()?"yes":"no") << endl
<< " In shared library? " << (f->isSharedLib()?"yes":"no") << endl
<< " Number of BB: " << getBasicBlocksSize(f) << endl;
if (f->isSharedLib())
{
char sharedlibname[1024];
BPatch_module *mod = f->getModule();
mod->getFullName (sharedlibname, 1024);
cout << " Full library name: " << sharedlibname << endl;
}
cout << endl;
}
else
{
cout << name << endl;
}
i++;
}
}
示例2: ShowFunctions
static void ShowFunctions (BPatch_image *appImage)
{
BPatch_Vector<BPatch_function *> *vfunctions = appImage->getProcedures (false);
cout << PACKAGE_NAME << ": " << vfunctions->size() << " functions found in binary " << endl;
unsigned i = 0;
while (i < vfunctions->size())
{
char name[1024];
BPatch_function *f = (*vfunctions)[i];
f->getName (name, 1024);
char mname[1024], tname[1024], modname[1024];
f->getMangledName (mname, 1024);
f->getTypedName (tname, 1024);
f->getModuleName (modname, 1024);
cout << " * " << i+1 << " of " << vfunctions->size() << ", Name: " << name << endl
<< " Mangled Name: " << mname << endl
<< " Typed Name : " << tname << endl
<< " Module name : " << modname << endl
<< " Base address: " << f->getBaseAddr() << endl
<< " Instrumentable? " << (f->isInstrumentable()?"yes":"no") << endl
<< " In shared library? " << (f->isSharedLib()?"yes":"no") << endl;
if (f->isSharedLib())
{
//Old Dyninst API < 9.x
//char sharedlibname[1024];
//mod->getFullName (sharedlibname, 1024);
BPatch_module *mod = f->getModule();
string sharedlibname;
sharedlibname = mod->getObject()->name();
cout << " Full library name: " << sharedlibname << endl;
}
cout << endl;
i++;
}
}
示例3: GenerateSymFile
static void GenerateSymFile (set<string> &ParFunc, set<string> &UserFunc, BPatch_image *appImage, BPatch_addressSpace *appProces)
{
ofstream symfile;
string symname = string(::XML_GetFinalDirectory())+string("/")+string(::XML_GetTracePrefix())+".sym";
symfile.open (symname.c_str());
if (!symfile.good())
{
cerr << "Cannot create the symbolic file" << symname << endl;
return;
}
for (set<string>::iterator iter = ParFunc.begin();
iter != ParFunc.end(); iter++)
{
BPatch_function *f = getRoutine ((*iter).c_str(), appImage);
if (f != NULL)
{
BPatch_Vector< BPatch_statement > lines;
appProces->getSourceLines ((unsigned long) f->getBaseAddr(), lines);
if (lines.size() > 0)
{
symfile << "P " << hex << f->getBaseAddr() << dec << " \"" << *iter
<< "\" \"" << lines[0].fileName() << "\" " << lines[0].lineNumber()
<< endl;
}
else
{
/* this happens if the application was not compiled with -g */
char modname[1024];
f->getModuleName (modname, 1024);
symfile << "P " << hex << f->getBaseAddr() << dec << " \"" << *iter
<< "\" \"" << modname << "\" 0" << endl;
}
}
}
for (set<string>::iterator iter = UserFunc.begin();
iter != UserFunc.end(); iter++)
{
BPatch_function *f = getRoutine ((*iter).c_str(), appImage);
if (f != NULL)
{
BPatch_Vector< BPatch_statement > lines;
appProces->getSourceLines ((unsigned long) f->getBaseAddr(), lines);
if (lines.size() > 0)
{
symfile << "U " << hex << f->getBaseAddr() << dec << " \"" << *iter
<< "\" \"" << lines[0].fileName() << "\" " << lines[0].lineNumber()
<< endl;
}
else
{
/* this happens if the application was not compiled with -g */
char modname[1024];
f->getModuleName (modname, 1024);
symfile << "U " << hex << f->getBaseAddr() << dec << " \"" << *iter
<< "\" \"" << modname << "\" 0" << endl;
}
}
}
map<string, unsigned>::iterator BB_symbols_iter = BB_symbols->begin();
map<string, unsigned>::iterator BB_symbols_end = BB_symbols->end();
while(BB_symbols_iter != BB_symbols_end){
symfile << "b " << BB_symbols_iter->second << " \"" << BB_symbols_iter->first << "\"\n";
BB_symbols_iter++;
}
symfile.close();
}