zoukankan      html  css  js  c++  java
  • [remote debug]WinDBG 技巧: 如何用WinDBG远程调试程序

    在某些情况下我们需要进行远程调试(比如该程序运行需要时候全屏,或者程序在客户的机器上crash崩溃), 这时候可以使用WinDBG的远程调试功能。

    WinDBG的远程调试由服务端和客户端组成,和visual studio类似。 被调试的机器是服务端(server), 我们做调试的机器是客户端(client)。 两台机器都需要安装WinDBG。

    第一步, 建立WinDBG server 端。

    使用 -server 参数可以使WinDBG 以服务器方式启动。 WinDBG可以用多种连接协议让客户端连接,比如命名管道(named pipe), 安全管道(secure pipe), TCP 协议(socket), SSL 协议, 串口/并口(COM port) 等等。

    命名管道

    WinDBG.exe -server npipe:pipe=PipeName[,hidden][,password=Password][,IcfEnable] [-noio] [Options] 

    TCP 协议

    WinDBG.exe -server tcp:port=Socket[,hidden][,password=Password][,ipversion=6][,IcfEnable] [-noio] [Options]
    WinDBG.exe -server tcp:port=Socket,clicon=Client[,password=Password][,ipversion=6] [-noio] [Options] 

    串口/并口
    WinDBG.exe -server com:port=COMPort,baud=BaudRate,channel=COMChannel[,hidden],password=Password] [-noio] [Options] 

    安全管道

    WinDBG.exe -server spipe:proto=Protocol,certuser=Cert|machuser=Cert},pipe=PipeName[,hidden],password=Password] [-noio] [Options] 

    SSL 协议

    WinDBG.exe -server ssl:proto=Protocol,certuser=Cert|machuser=Cert},port=Socket[,hidden],password=Password] [-noio] [Options]
    WinDBG.exe -server ssl:proto=Protocol,certuser=Cert|machuser=Cert},port=Socket,clicon=Client[,password=Password] [-noio] [Options]

    示例:

    WinDBG.exe -server npipe:pipe=DbgPipe winmine.exe (使用命名管道DbgPipe 建立调试服务,调试winmine.exe 程序)

    WinDBG.exe -server tcp:port=1025 -p 122 (使用TCP协议,在端口1025建立调试服务, 调试机器上进程号为122的程序, 或者说Attach 到122进程进行调试)

    第二步, 用WinDBG client 端连接服务端

    使用 -remote 参数可以使WinDBG 以客户端方式启动去连接服务端, 可以指定不同的连接方式:

    命名管道

    WinDBG.exe -remote npipe:server=Server,pipe=PipeName[,password=Password]

    TCP 协议

    WinDBG.exe -remote tcp:server=Server,port=Socket[,password=Password][,ipversion=6]
    WinDBG.exe -remote tcp:clicon=Server,port=Socket[,password=Password][,ipversion=6]

    串口/并口

    WinDBG.exe -remote com:port=COMPort,baud=BaudRate,channel=COMChannel[,password=Password]

    安全管道

    WinDBG.exe -remote spipe:proto=Protocol,{certuser=Cert|machuser=Cert},server=Server,pipe=PipeName[,password=Password]

    SSL 协议

    WinDBG.exe -remote ssl:proto=Protocol,{certuser=Cert|machuser=Cert},server=Server,port=Socket[,password=Password]
    WinDBG.exe -remote ssl:proto=Protocol,{certuser=Cert|machuser=Cert},clicon=Server,port=Socket[,password=Password]

    示例 (假设被调试的机器名字是dbgPC):


    WinDBG.exe-remote npipe:server=dbgPC,pipe=DbgPipe (使用命名管道DbgPipe 建立连接被调试机器dbgPC)


    WinDBG.exe-remote tcp:server=dbgPC,port=1025 (使用TC协议, 连接被调试机器dbgPC的端口1025)

    关于Windows 远程调试更多详细的内容,请参考MSDN http://msdn.microsoft.com/en-us/library/cc266457.aspx


    转载自:windbg技巧:如何用windbg远程调试程序

  • 相关阅读:
    火狐下,td 的 bug;
    在centos6.3用yum安装redis
    Linux系统下修改环境变量PATH路径的三种方法
    网络文件常常提到类似"./run.sh"的数据,这个命令的意义是什么?
    DataGridView的自定义列排序
    【Linux】linux常用基本命令
    用户名 不在 sudoers文件中,此事将被报告。(转)
    将XML文件中的内容转换为Json对象
    C# 加载xml文档文件及加载xml字符串
    增加不存在的列
  • 原文地址:https://www.cnblogs.com/taoxu0903/p/1925942.html
Copyright © 2011-2022 走看看