The simple debugger
2004-07-12 16:03 atempcode 阅读(582) 评论(0) 编辑 收藏 举报
This is the p-code of a simple debugger on Windows.
1. the debugger create a process with the dwCreationFlags set to DEBUG_ONLY_THIS_PROCESS.
2. After the target started, the debugger enter into a loop. It receives debugging message by WaitForDebugEvents, after handles the events, it calls ContinueDebugEvent to go on.
1. the debugger create a process with the dwCreationFlags set to DEBUG_ONLY_THIS_PROCESS.
2. After the target started, the debugger enter into a loop. It receives debugging message by WaitForDebugEvents, after handles the events, it calls ContinueDebugEvent to go on.
void main(void)
{
CreateProcess(, DEBUG_ONLY_THIS_PROCESS, );
while (1 == WaitForDebugEvent())
{
if (EXIT_PROCESS)
{
break;
}
ContinueDebugEvent();
}
}
{
CreateProcess(, DEBUG_ONLY_THIS_PROCESS, );
while (1 == WaitForDebugEvent())
{
if (EXIT_PROCESS)
{
break;
}
ContinueDebugEvent();
}
}