上面的伪代码并不表达您的意图。
我不知道为什么你需要一个内核调试连接到远程调试可执行(参考链接中查询)
,如果你要调试的可执行文件运行在远程机器可以连接使用远程调试连接会话。
下面列举的样品设置调试CALC.EXE在远程机器使用远程调试会话
主机-----------------物理机器XP SP3 32位运行
目标---------------虚拟机XP SP3 32位
网络--------------环回适配器
C:\>net view | grep -i xp & echo kd wont connect target not booted with /DEBUG
\\XPSP3VM
kd wont connect target not booted with /DEBUG
C:\>kd -k com:pipe,port=\\.\pipe\debugPipe,resets=0,reconnect
Opened \\.\pipe\debugPipe
Waiting to reconnect...
^B <---------force exit
"lets run windbg -server npipe:pipe=\\.\pipe\debugPipe -v calc.exe
in the target machine and connect to it with cdb -server:xxxx from host
C:\>cdb -remote npipe:server=xpsp3vm,pipe=\\.\pipe\debugPipe
Connected to server with 'npipe:server=xpsp3vm,pipe=\\.\pipe\debugPipe'
CommandLine: calc.exe (mapped shared folder in host)
Symbol search path is: srv*z:\*http://msdl.microsoft.com/download/symbols
7c90120e cc int 3
\Admin (npipe \\.\pipe\debugPipe) connected at Wed Jul 22 11:49:41 2015
0:000> .echo "yay we are remote debucking now"
yay we are remote debucking now
0:000> lm m calc*
start end module name
01000000 0101f000 calc (deferred)
.clients
\Admin (npipe \\.\pipe\debugPipe), last active Wed Jul 22 11:54:19 2015
HostMachine\HostUser, last active Wed Jul 22 11:44:06 2015
0:000> kb
ChildEBP RetAddr Args to Child
0007fb1c 7c9402ed 7ffde000 7ffdf000 00000000 ntdll!DbgBreakPoint
0007fc94 7c91fad7 0007fd30 7c900000 0007fce0 ntdll!LdrpInitializeProcess+0x1014
0007fd1c 7c90e457 0007fd30 7c900000 00000000 ntdll!_LdrpInitialize+0x183
00000000 00000000 00000000 00000000 00000000 ntdll!KiUserApcDispatcher+0x7
0:000> .echo "only echo is echoed all other aw are dumped here"
only echo is echoed all other aw are dumped here
添加一个屏幕截图,以防被乱写的声音
我想知道你为这个问题的自动化付出了多少努力。你多久调试一次?为什么要为此编写某种用户界面?这对我来说似乎是一个XY问题。你正在努力实现某些目标,并且似乎是这样做的错误方式。但是我们不能说,因为我们不了解整个用例。例如。为什么不从磁盘读取伪随机值呢?或者用硬编码的随机数发生器替换随机数发生器对象? –
@Thomas,现在我排除了这种情况,并决定禁用导致超时的设备。你可以参考讨论[这里](http://stackoverflow.com/questions/31378816/data-input-to-debugger-before-hitting-the-breakpoint/31386173?noredirect=1#comment51034791_31386173)。 – Panch