本文整理汇总了C++中Tracer::attach方法的典型用法代码示例。如果您正苦于以下问题:C++ Tracer::attach方法的具体用法?C++ Tracer::attach怎么用?C++ Tracer::attach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tracer
的用法示例。
在下文中一共展示了Tracer::attach方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main (int argc, char **argv)
{
unsigned int cit;
int option;
char filename[MAX_PATH];
char command_line[MAX_PATH]; // win2k max = MAX_PATH, otherwise could be 32k.
map <DWORD,t_Debugger_memory*>::const_iterator it;
// init target char buf.
memset(target, 0, sizeof(target));
// Set the debugger's log level. (disable logging)
dbg.log.set(LOG_SHUTUP);
dbg.SetGlobalLoglevel(LOG_SHUTUP);
//
// do the command line argument thing.
//
for (int i = 1; i < argc; i++)
{
//
// attach to a pid.
//
if (stricmp(argv[i], "-a") == 0 && i + 1 < argc)
{
if (!dbg.attach(atoi(argv[i+1])))
{
printf("[ERROR] No process with the ID %u\n", atoi(argv[i+1]));
return 1;
}
// update the target name.
strncpy(target, argv[i+1], sizeof(target) - 1);
i++;
}
//
// load a file. (no arguments)
//
else if (stricmp(argv[i], "-l") == 0 && i + 1 < argc)
{
if (!dbg.load(argv[i+1]))
{
printf("[ERROR] Could not load %s\n", argv[i+1]);
return 1;
}
// update the target name.
strncpy(target, argv[i+1], sizeof(target) - 1);
// cut off the target name at the first dot.
//char *dot = strchr(target, '.');
//*dot = 0;
i++;
}
//
// load a file with arguments.
//
else if (stricmp(argv[i], "-la") == 0 && i + 1 < argc)
{
_snprintf(command_line, sizeof(command_line), "%s %s", argv[i+1], argv[i+2]);
if (!dbg.load(argv[i+1], command_line))
{
printf("[ERROR] Could not load %s %s\n", argv[i+1], argv[i+2]);
return 1;
}
// update the target name.
_snprintf(target, sizeof(target), command_line);
i += 2;
}
//
// select a breakpoint list.
//
else if (stricmp(argv[i], "-b") == 0 && i + 1 < argc)
{
breakpoint_list = argv[i+1];
// we open the file now with a global file handle and set the breakpoints after all
// the modules have been loaded and parsed in the initial breakpoint handler.
if ((bpl = fopen(breakpoint_list, "r+")) == NULL)
{
printf("\n[ERROR] Failed opening breakpoing list: %s\n", breakpoint_list);
return 1;
}
i++;
}
//.........这里部分代码省略.........