Windows windbg先连接,然后卡在“开启”位置;调试对象未连接。”;内核调试期间的消息

Windows windbg先连接,然后卡在“开启”位置;调试对象未连接。”;内核调试期间的消息,windows,debugging,kernel,windbg,Windows,Debugging,Kernel,Windbg,我正在尝试进行Windows内核调试,因此为此我设置了两台计算机: 主机-调试器-运行windbg调试器的计算机 目标-被调试对象-正在调试的计算机 主机和目标都运行32位Windows 7,并且都安装了Windows驱动程序工具包8.0。我执行了以下步骤: 在目标上,我已使用以下命令启用内核调试: bcdedit /copy {current} /d "Windows 7 wih debug" bcdedit /debug {02b760e4-eafc-11e4-8847-ac1155aec8

我正在尝试进行Windows内核调试,因此为此我设置了两台计算机:

  • 主机-调试器-运行windbg调试器的计算机
  • 目标-被调试对象-正在调试的计算机
  • 主机和目标都运行32位Windows 7,并且都安装了Windows驱动程序工具包8.0。我执行了以下步骤:

    在目标上,我已使用以下命令启用内核调试:

    bcdedit /copy {current} /d "Windows 7 wih debug"
    bcdedit /debug {02b760e4-eafc-11e4-8847-ac1155aec81a} on
    bcdedit /dbgsettings serial debugport:1 baudrate:115200
    bcdedit /set {bootmgr} displaybootmenu yes
    bcdedit /timeout 10
    
    .reload
    !ustr srv!SrvComputerName 
    
    然后,我启动了主机并执行了以下步骤:

  • 启动windbg
  • 文件->内核调试->COM
  • 波特率:115200,端口:COM1,管道:未选中,重新连接: 未选中,重置:0
  • 在此之后,主机上的“我的windbg命令”窗口如下所示:

    Microsoft (R) Windows Debugger Version 6.2.9200.20512 X86
    Copyright (c) Microsoft Corporation. All rights reserved.
    
    Opened \\.\COM1
    Waiting to reconnect...
    
    Microsoft (R) Windows Debugger Version 6.2.9200.20512 X86
    Copyright (c) Microsoft Corporation. All rights reserved.
    
    Opened \\.\COM1
    Waiting to reconnect...
    Connected to Windows 7 7601 x86 compatible target at (Tue May  5 08:23:33.992 2015 (UTC - 7:00)), ptr64 FALSE
    Kernel Debugger connection established.
    Symbol search path is: SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols
    Executable search path is: 
    Windows 7 Kernel Version 7601 MP (1 procs) Free x86 compatible
    Built by: 7601.17514.x86fre.win7sp1_rtm.101119-1850
    Machine Name:
    Kernel base = 0x82611000 PsLoadedModuleList = 0x8275b850
    System Uptime: not available
    
    然后我重新启动了目标并从启动菜单中选择“Windows7带调试”

    在此之后,主机上的“我的windbg命令”窗口如下所示:

    Microsoft (R) Windows Debugger Version 6.2.9200.20512 X86
    Copyright (c) Microsoft Corporation. All rights reserved.
    
    Opened \\.\COM1
    Waiting to reconnect...
    
    Microsoft (R) Windows Debugger Version 6.2.9200.20512 X86
    Copyright (c) Microsoft Corporation. All rights reserved.
    
    Opened \\.\COM1
    Waiting to reconnect...
    Connected to Windows 7 7601 x86 compatible target at (Tue May  5 08:23:33.992 2015 (UTC - 7:00)), ptr64 FALSE
    Kernel Debugger connection established.
    Symbol search path is: SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols
    Executable search path is: 
    Windows 7 Kernel Version 7601 MP (1 procs) Free x86 compatible
    Built by: 7601.17514.x86fre.win7sp1_rtm.101119-1850
    Machine Name:
    Kernel base = 0x82611000 PsLoadedModuleList = 0x8275b850
    System Uptime: not available
    
    但是,我得到的不是通常键入命令的提示:
    调试对象未连接。
    目标系统照常启动,我能够使用它

    我注意到的几件事:

  • 之后,设备管理器中的目标计算机上缺少COM1端口 以上步骤
  • 关闭主机上的windb并尝试重新启动目标后,它会被“关机”消息卡住,因此我必须强制关闭电源
  • 将目标引导到“旧”内核后,在设备管理器中可以使用启用调试的串行端口
  • 在将目标引导到启用调试的“新”内核(并且没有主机侦听)后,设备管理器中的串行端口不可用
  • 我做错了什么

    PS:这两台机器都是XEN上的虚拟客户机。 PPS:连接100%正常工作,在内核上测试,未启用调试,并且使用putty

    编辑:

    标题改变了

    根据本文,COM1缺失是正常的:

    通过检查设备管理器,我能够确认VM中运行的操作系统的配置存在问题。bcdedit设置被配置为使用COM1,这将使COM1在操作系统中不可用,设备管理器中存在COM1。由于某些原因,调试器在引导时未按配置捕获COM1

    我还检查了上述文章中描述的设置,但它们似乎也可以:

    C:\>bcdedit
    
    Windows Boot Manager
    --------------------
    identifier              {bootmgr}
    device                  partition=\Device\HarddiskVolume1
    description             Windows Boot Manager
    locale                  en-US
    inherit                 {globalsettings}
    default                 {default}
    resumeobject            {02b760e0-eafc-11e4-8847-ac1155aec81a}
    displayorder            {default}
                            {current}
    toolsdisplayorder       {memdiag}
    timeout                 10
    displaybootmenu         Yes
    
    Windows Boot Loader
    -------------------
    identifier              {default}
    device                  partition=C:
    path                    \Windows\system32\winload.exe
    description             Windows 7
    locale                  en-US
    inherit                 {bootloadersettings}
    recoverysequence        {02b760e2-eafc-11e4-8847-ac1155aec81a}
    recoveryenabled         Yes
    osdevice                partition=C:
    systemroot              \Windows
    resumeobject            {02b760e0-eafc-11e4-8847-ac1155aec81a}
    nx                      OptIn
    
    Windows Boot Loader
    -------------------
    identifier              {current}
    device                  partition=C:
    path                    \Windows\system32\winload.exe
    description             Windows 7 wih debug
    locale                  en-US
    inherit                 {bootloadersettings}
    recoverysequence        {02b760e2-eafc-11e4-8847-ac1155aec81a}
    recoveryenabled         Yes
    osdevice                partition=C:
    systemroot              \Windows
    resumeobject            {02b760e0-eafc-11e4-8847-ac1155aec81a}
    nx                      OptIn
    debug                   Yes
    
    EDIT2

    根据SO的回答,我尝试发出
    kd-kl
    命令。我想它应该只针对目标发布,但要确保我已经尝试了这两种机器。您可以看到关于符号有一个错误,但我认为调试也应该在没有符号的情况下进行

    主持人:

    目标:

    c:\Program Files\Windows Kits\8.0\Debuggers\x86>kd -kl
    
    Microsoft (R) Windows Debugger Version 6.2.9200.20512 X86
    Copyright (c) Microsoft Corporation. All rights reserved.
    
    Connected to Windows 7 7601 x86 compatible target at (Tue May  5 12:13:02.806 20
    15 (UTC - 7:00)), ptr64 FALSE
    Symbol search path is: *** Invalid ***
    ****************************************************************************
    * Symbol loading may be unreliable without a symbol search path.           *
    * Use .symfix to have the debugger choose a symbol path.                   *
    * After setting your symbol path, use .reload to refresh symbol locations. *
    ****************************************************************************
    Executable search path is:
    *********************************************************************
    * Symbols can not be loaded because symbol path is not initialized. *
    *                                                                   *
    * The Symbol Path can be set by:                                    *
    *   using the _NT_SYMBOL_PATH environment variable.                 *
    *   using the -y <symbol_path> argument when starting the debugger. *
    *   using .sympath and .sympath+                                    *
    *********************************************************************
    *** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntkr
    pamp.exe -
    Windows 7 Kernel Version 7601 (Service Pack 1) MP (1 procs) Free x86 compatible
    Product: WinNt, suite: TerminalServer SingleUserTS
    Built by: 7601.17514.x86fre.win7sp1_rtm.101119-1850
    Machine Name:
    Kernel base = 0x82653000 PsLoadedModuleList = 0x8279d850
    Debug session time: Tue May  5 12:13:02.822 2015 (UTC - 7:00)
    System Uptime: 0 days 2:48:38.649
    lkd>
    
    c:\Program Files\Windows Kits\8.0\Debuggers\x86>kd-kl
    Microsoft(R)Windows调试器版本6.2.9200.20512 X86
    版权所有(c)微软公司。版权所有。
    已连接到Windows 7 7601 x86兼容目标(星期二5月5日12:13:02.806 20
    15(UTC-7:00),ptr64错误
    符号搜索路径为:**无效***
    ****************************************************************************
    *如果没有符号搜索路径,符号加载可能不可靠*
    *使用.symfix让调试器选择符号路径*
    *设置符号路径后,使用.reload刷新符号位置*
    ****************************************************************************
    可执行搜索路径为:
    *********************************************************************
    *无法加载符号,因为符号路径未初始化*
    *                                                                   *
    *符号路径可通过以下方式设置:*
    *使用\u NT\u SYMBOL\u PATH环境变量*
    *启动调试器时使用-y参数*
    *使用.sympath和.sympath+*
    *********************************************************************
    ***错误:找不到符号文件。默认为导出ntkr的符号
    pamp.exe-
    Windows 7内核版本7601(Service Pack 1)MP(1进程)免费x86兼容
    产品:WinNt,套件:TerminalServer SingleUsers
    构建人:7601.17514.x86fre.win7sp1_rtm.101119-1850
    计算机名称:
    内核基=0x82653000 PsLoadedModuleList=0x8279d850
    调试会话时间:2015年5月5日星期二12:13:02.822(UTC-7:00)
    系统正常运行时间:0天2:48:38.649
    lkd>
    

    还有一些关于设置打印机共享等的建议。这些建议值得尝试吗?

    您可以尝试创建一个新的调试条目并查找差异。

    看起来调试器已连接到目标。(1) 忽略WinDbg状态消息。查看是否连接到目标的最佳方法是尝试几个命令。(2) 当我调试虚拟机时,我正在使用的串行端口也会丢失,但看起来你已经找到了(做得好)

    为了发出命令,您需要进入内核。单击“调试->中断”,然后尝试以下命令:

    bcdedit /copy {current} /d "Windows 7 wih debug"
    bcdedit /debug {02b760e4-eafc-11e4-8847-ac1155aec81a} on
    bcdedit /dbgsettings serial debugport:1 baudrate:115200
    bcdedit /set {bootmgr} displaybootmenu yes
    bcdedit /timeout 10
    
    .reload
    !ustr srv!SrvComputerName 
    
    这将为您提供目标系统计算机名


    如果您想了解更多关于内核调试的信息,我会在YouTube上查看。至于文学,我不能推荐任何书籍,因为我找到的大部分信息都是在线的。不过,我建议您退房。调试愉快。

    到底是什么问题?看起来您已将调试器连接到目标。(1) 忽略WinDbg状态消息。查看是否连接到目标的最佳方法是尝试几个命令。(2) 当我调试虚拟机时,我正在使用的串行端口也会丢失,但看起来你已经找到了(很好)。我应该在哪里键入命令?在windbg的命令窗口中,我得到“Debuggee not connected.”命令应该输入的地方是灰色的。我是这方面的新手,所以可能我做错了什么,但当我打开本地exe进行调试时,我