.childdbg 1 只允许调试第一个孩子而不是孙子
在您的示例中,2.002 是孙子
调试它然后回到孩子你需要在每一代发出 .childdbg 1
childdbg:\>dir /b
childdbg.cpp
childdbg:\>type childdbg.cpp
#include <stdio.h>
#include <windows.h>
int main (void)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
if( !CreateProcess( NULL, "childdbg.exe", NULL, NULL,
FALSE,0,NULL,NULL,&si, &pi ) )
{
printf( "CreateProcess failed (%d).\n", GetLastError() );
return 0;
}
WaitForSingleObject( pi.hProcess, INFINITE );
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
return 0;
}
childdbg:\>cl /Zi /nologo childdbg.cpp
childdbg.cpp
childdbg:\>dir /b *.exe
childdbg.exe
do not run the exe it will spawn zillion childs
use debugger and when done subvert flow to skip child creation
childdbg:\>cdb childdbg.exe
0:000> .childdbg 1
Processes created by the current process will be debugged
0:000> g
1:001> .childdbg 1
Processes created by the current process will be debugged
1:001> g
2:002> .childdbg 1
Processes created by the current process will be debugged
2:002> g
3:003> .childdbg 1
Processes created by the current process will be debugged
3:003> g
4:004> lsf childdbg.cpp
childdbg.cpp
4:004> bp childdbg!main
*** WARNING: Unable to verify checksum for childdbg.exe
4:004> g
Breakpoint 0 hit
childdbg!main:
00401010 55 push ebp
4:004> ls 10
10: if( !CreateProcess( NULL, "childdbg.exe", NULL, NULL,
FALSE,0,NULL,NULL,&si,&pi ) )
11: {
12: printf( "CreateProcess failed (%d).\n", GetLastError() );
13: return 0;
14: }
15: WaitForSingleObject( pi.hProcess, INFINITE );
16: CloseHandle( pi.hProcess );
17: CloseHandle( pi.hThread );
18: return 0;
19: }
4:004> r eip = `:18`
WARNING: Line information loading disabled
4:004> .lines
Line number information will be loaded
4:004> r eip = `:18`
4:004> r
childdbg!main+0x8a:
0040109a 33c0 xor eax,eax
4:004> g
4:004> g
3:003> g
2:002> g
1:001> g
0:000> g
^ No runnable debuggees error in 'g'
0:000> q
quit:
childdbg:\>