上面的僞代碼並不表達您的意圖。
我不知道爲什麼你需要一個內核調試連接到遠程調試可執行(參考鏈接中查詢)
,如果你要調試的可執行文件運行在遠程機器可以連接使用遠程調試連接會話。
下面列舉的樣品設置調試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