windbg远程调试时,有两种方式,一种为remote session,另一种为remote stub,具体详情请google。
我下面说说我在使用remote stub方式时遇到的一些困惑。
按照教程,我在target machine启动了stub进程
dbgsrv -t tcp:port=5000
然后我在remote machine上启动了windbg,单击菜单File->Connect to remote stub...., 弹出对话框中点击Browse,又弹出一个子对话框,在此对话框中输入target machine的计算机名或IP地址,执行Refresh,出现一下提示:
然后我又开始了Google旅程,很不幸,没查到原因。我就此以为远程调试不可用了呢。谁知又Google到了如下文章
http://blog.strafenet.com/2011/04/04/using-dbgsrv-the-process-server/
里面有一段:
The connection string should match what you’ve started dbgsrv with. For instance, if dbgsrv is running on my computer named “timtst”, I would connect to “tcp:port=31337,server=timtst”. After accepting the connection string in this dialog, there will be no indication of failure or success until you actually try to use it。
于是我也不再点击Browse按钮,直接填写connection string "tcp:port=5000, server=192.168.1.104" 后,点击OK按钮。然后执行File->Attach to a process。进程对话框里枚举的的确是target machine的进程列表, 附加进程之后,可以远程调试进程。
至此,虽有不解(为啥会拒绝访问呢[见图]),但是总是可以远程调试了。
另外,也可以直接执行命令行打开远程调试,命令如下
windbg.exe -premote tcp:port=5000,server=192.168.1.104 -p 1016