Windbg USB3.0双机调试

作者: anhkgg | 来源:发表于2019-09-29 09:58 被阅读0次

    配置需求

    1. 目标主机有USB3.0 xHCI主机控制器,支持调试

    [Port1]

    Is Port User Connectable: yes

    Is Port Debug Capable: yes

    Companion Port Number: 3

    Companion Hub Symbolic Link Name: USB#ROOT_HUB30#5&32bab638&0&0#{...}

    Protocols Supported:

    USB 1.1: no

    USB 2.0: no

    USB 3.0: yes

    1. host主机支持USB3.0 xHCI主机控制器(使用UsbView查看)
    2. USB 3.0 调试线(国外购买地址)(可以用普通USB3.0 公对公线改造,剪掉红绿百三根线)

    先从淘宝买一根USB 3的A对A连线,有时也称公对公连线,很便宜。这根线需要加工一下才可以支持调试,加工的方法是选取线的某个位置,剥开外皮,然后把其中的红绿白三根线剪断,然后包上就可以了。USB 3电缆的线是有固定颜色的,如图3所示,
    其中SDP是Shielded Differential Pair的缩写,即屏蔽起来的差分信号线,是USB 3.0的数据线,UTP是Unshielded Twisted Pair的缩写,即未屏蔽的双绞线,是USB1/2使用的数据线,所谓的D+,D-。要做的加工其实就是把2.0的三根弦剪断。剥开后,很容易找到红绿白三根,胆大心细,下剪子吧:-)。

    1. 两台主机系统必须是Win8以上

    On the host computer, an xHCI (USB 3.0) host controller
    On the target computer, an xHCI (USB 3.0) host controller that supports debugging

    步骤

    在目标主机配置调试模式。

    命令:

    bcdedit /debug on
    bcdedit /dbgsettings usb targetname:TargetName
    //如果目标主机有多个xHCI主机控制器,则需要配置需要使用的,b.d.f在usbview中可以看到
    bcdedit /set "{dbgsettings}" busparams b.d.f
    //重启主机
    

    使用msconfig配置,引导,高级模式,勾选调试,选择USB模式,USB目标名:usbdbg

    host主机配置。

    第一次配置,如果host是X64,开启X64 windbg,如果是x86,选择开启x86 windbg,需要管理员权限运行。

    Ctrl+K,选择USB,填入目标主机配置的名字(usbdbg),确认,等待。

    
    Microsoft (R) Windows Debugger Version 10.0.14321.1024 AMD64
    Copyright (c) Microsoft Corporation. All rights reserved.
    
    Using USB for debugging
    Waiting to reconnect...
    USB: Write opened
    

    当将USB调试线插入host主机接口时,会自动安装相关驱动(usb2dbg等,管理员,位数等要求的原因)。

    然后出现USB: Write opened表示与目标主机连接成功。

    按下Ctrl+break,即可开始调试目标主机了

    Connected to Windows 10 16299 x64 target at (Tue Dec 12 09:47:18.535 2017 (UTC + 8:00)), ptr64 TRUE
    Kernel Debugger connection established.
    
    ************* Symbol Path validation summary **************
    Response                         Time (ms)     Location
    Deferred                                       SRV*e:\symbols* http://msdl.microsoft.com/download/symbols
    Deferred                                       SRV*e:\symbols*http://msdl.microsoft.com/download/symbols
    Symbol search path is: SRV*e:\symbols* http://msdl.microsoft.com/download/symbols;SRV*e:\symbols*http://msdl.microsoft.com/download/symbols
    Executable search path is: 
    Windows 10 Kernel Version 16299 MP (4 procs) Free x64
    Product: WinNt, suite: TerminalServer SingleUserTS
    Built by: 16299.15.amd64fre.rs3_release.170928-1534
    Machine Name:
    Kernel base = 0xfffff800`9e21d000 PsLoadedModuleList = 0xfffff800`9e57efb0
    Debug session time: Tue Dec 12 09:47:12.452 2017 (UTC + 8:00)
    System Uptime: 3 days 17:11:46.032
    WARNING: Whitespace at end of path element
    
    ************* Symbol Path validation summary **************
    Response                         Time (ms)     Location
    Deferred                                       SRV*e:\symbols* http://msdl.microsoft.com/download/symbols
    Deferred                                       SRV*e:\symbols*http://msdl.microsoft.com/download/symbols
    Break instruction exception - code 80000003 (first chance)
    *******************************************************************************
    *                                                                             *
    *   You are seeing this message because you pressed either                    *
    *       CTRL+C (if you run console kernel debugger) or,                       *
    *       CTRL+BREAK (if you run GUI kernel debugger),                          *
    *   on your debugger machine's keyboard.                                      *
    *                                                                             *
    *                   THIS IS NOT A BUG OR A SYSTEM CRASH                       *
    *                                                                             *
    * If you did not intend to break into the debugger, press the "g" key, then   *
    * press the "Enter" key now.  This message might immediately reappear.  If it *
    * does, press "g" and "Enter" again.                                          *
    *                                                                             *
    *******************************************************************************
    nt!DbgBreakPointWithStatus:
    fffff800`9e386c60 cc              int     3
    

    连接成功,设备管理中出现USB Debug Connection Device

    参考:

    1. setting-up-a-usb-3-0-debug-cable-connection
    2. USB3 Kernel Debugging with Dell PowerEdge 13G Servers
    3. http://blog.techlab-xe.net/archives/1961
    4. 使用USB3.0调试Windows 8

    相关文章

      网友评论

        本文标题:Windbg USB3.0双机调试

        本文链接:https://www.haomeiwen.com/subject/sggpuctx.html