本文整理汇总了C++中Tracer::ReBuildMemoryMap方法的典型用法代码示例。如果您正苦于以下问题:C++ Tracer::ReBuildMemoryMap方法的具体用法?C++ Tracer::ReBuildMemoryMap怎么用?C++ Tracer::ReBuildMemoryMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tracer
的用法示例。
在下文中一共展示了Tracer::ReBuildMemoryMap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ps_base_address
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// ps_base_address()
//
// search through all loaded modules for a string match and return it's base address.
//
bool ps_base_address (char *module, DWORD *address, DWORD *size)
{
map <DWORD,t_Debugger_memory*>::const_iterator it;
dbg.ReBuildMemoryMap();
// determine the base address of the executable section for the loaded module.
for (it = dbg.MemoryMap.begin(); it != dbg.MemoryMap.end(); ++it)
{
// match the module name.
if (stricmp(it->second->Name.c_str(), module) != 0)
continue;
// ensure we found the correct section.
if ((it->second->basics.Protect & PAGE_EXECUTE) ||
(it->second->basics.Protect & PAGE_EXECUTE_READ) ||
(it->second->basics.Protect & PAGE_EXECUTE_READWRITE) ||
(it->second->basics.Protect & PAGE_EXECUTE_WRITECOPY))
{
// module executable section found.
*address = it->second->address;
*size = it->second->basics.RegionSize;
return true;
}
}
return false;
}
示例2: main
//.........这里部分代码省略.........
}
break;
// detach from debuggee.
case 'd':
if (!dbg.pDebugActiveProcessStop || !dbg.pDebugSetProcessKillOnExit)
{
printf("\ndetaching is not possible on the current os ... request ignored.\n");
break;
}
main_terminate = true;
printf("\nclosing any open recorder and detaching ...\n");
if (recorder_mode != NOT_RECORDING)
{
fclose(recorder);
if (reg_enum_flag)
fclose(recorder_regs);
}
dbg.detach();
break;
// display available options.
case 'h':
ps_commands();
break;
// display memory map for executable sections of each module.
case 'm':
dbg.ReBuildMemoryMap();
printf("\n---------- MODULE LIST ----------\n");
for (it = dbg.MemoryMap.begin(); it != dbg.MemoryMap.end(); ++it)
{
// determine the correct section)
if ((it->second->basics.Protect & PAGE_EXECUTE) ||
(it->second->basics.Protect & PAGE_EXECUTE_READ) ||
(it->second->basics.Protect & PAGE_EXECUTE_READWRITE) ||
(it->second->basics.Protect & PAGE_EXECUTE_WRITECOPY))
{
// module executable section found.
printf("module %08x %s\n", it->second->address, it->second->Name.c_str());
}
}
printf("\nstalking:\n");
for (node *cursor = bp_modules; cursor != NULL; cursor = cursor->next)
printf("%08x - %08x [%08x] %s\n", cursor->base, cursor->base + cursor->size, cursor->size, cursor->name);
printf("---------- MODULE LIST ----------\n\n");
break;
// quit program.
case 'q':
main_terminate = true;
printf("\nclosing any open recorder and quiting ...\n");
if (recorder_mode != NOT_RECORDING)
{