首页
社区
课程
招聘
[旧帖] [求助]win7 + vm双机Windebug调试 0.00雪花
发表于: 2012-8-5 18:44 1430

[旧帖] [求助]win7 + vm双机Windebug调试 0.00雪花

2012-8-5 18:44
1430
在xp下如果双机调试 如下配置就可以了。
1、在VM中使用命名管道模拟一个串口
\\.\pipe\com_1
This end is then server
the other and is an application
2、主机 增加windbg快捷方式 
  -b -k com:pipe,port=\\.\pipe\com_1,baud=115200,reconnect -y
3、被调试机 在boot.ini中增加一行
/fastdetect /debug /debugport=com1 /baudrate=115200
 五、启用windbg双机调试 


请求win7下如何配置这种调试环境或者更好的调试环境,谢谢牛人解答

[培训]《安卓高级研修班(网课)》月薪三万计划,掌握调试、分析还原ollvm、vmp的方法,定制art虚拟机自动化脱壳的方法

收藏
免费 0
支持
分享
最新回复 (3)
雪    币: 2166
活跃值: (11)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
用virtualKD,就不需要自己配置了
2012-8-6 16:43
0
雪    币: 31
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
呵呵 谢谢了!我找到了办法了

http://www.mouseos.com/win7/windbg.html

vmware 里的 guest OS 作为被调试对象,Host OS 里使用 windbg 作为调试者。

guest OS 和 Host OS 通过 serial port 以 named pipe 方式作为联线。



vmware 上装上了最新的 windows 7 x64 中文旗舰版 

bochs 也装上了同样的 windows 7 x64 中文旗舰版。


1、vmware 的设置

 打开相应 vmware 虚拟机上的 “Virtaul Machine Settings”---> “Hardware”选项中 ----> 点击 “Add” 添加一个串口设备 Seiall Port ----> “Next” ----> 在 Serial Port 里选中“Output to named pipe” ----> “next” ----> “Finish”

最后,回到 “Virtual Machine Settings”页面时,在“I/O Mode” 里选中“Yield CPU on poll” 这样 vmware 的设置就好了。



2、windbg 的使用

在桌面上建一个便捷方式,命令行是:

"C:\Program Files\Debugging Tools for Windows 64-bit\windbg.exe" -b -k com:port=\\.\pipe\com_1,baud=115200,pipe

这样在开启 vmware 中的 windows 7 后运行这个便捷方式,windbg 与 guest OS “win7” 就建立成联线方式。






二、guest OS - win7 中设定


1、在 bootmgr 中下断点

 在 vista 及后续的 windows 已经取消了 ntldr 模块管理引导,转而以 bootmgr 模块管理引导系统。

在我的 windows 7中要设定在哪个部分进行调试。

windws 7 可调试部分有 4 个:bootmgr 模块、winload 模块、WinResume 模块以及 windows 内核模块 Nt 模块

可以在上述的 4 个模块下断点进行调式



例:在 bootmgr 下断点的话,可使用以下命令进行:

(1) 以管理员身份运行“命令提示符”

(2) 在“命令提示符”窗口中,输入以下命令:

bcdedit /set {bootmgr} bootdebug on
bcdedit /set {bootmgr} debugtype serial
bcdedit /set {bootmgr} debugport 1
bcdedit /set {bootmgr} baudrate 115200
 

在提示命令成功后,这样就在 windows7 中的 bootmgr 模块建立起可调试的机制。
在运行 windows7 时到达 bootmgr 时就停止加载,vmware 中是黑屏,它正等待 serial port 的响应,
运行 windbg 后,windbg 就和 windws 7 中的 bootmgr 建立起联线了




下面是我的 windbg 在 bootmgr 模式下断点的响应信息:

Microsoft (R) Windows Debugger Version 6.11.0001.402 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.

Opened \\.\pipe\com_1
Waiting to reconnect...
BD: Boot Debugger Initialized
Connected to Windows Boot Debugger 7600 x86 compatible target at (Thu Nov 26 21:05:14.787 2009 (GMT+8)), ptr64 FALSE
Kernel Debugger connection established. (Initial Breakpoint requested)
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: Module load completed but symbols could not be loaded for bootmgr
Windows Boot Debugger Kernel Version 7600 UP Free x86 compatible
Machine Name:
Primary image base = 0x00400000 Loaded module list = 0x00491b80
System Uptime: not available
Break instruction exception - code 80000003 (first chance)
bootmgr+0x436bc:
004436bc cc int 3
 


这段信息中,看到:

★ Opened \\.\pipe\com_1

 windbg 打开了 serial port

★ Symbol search path is: *** Invalid ***

目前模式的符号不可用

★ Primary image base = 0x00400000 Loaded module list = 0x00491b80

bootmgr 被加载到基地址是 0x00400000


★ bootmgr+0x436bc:

目前处在 bootmgr 模块中




2、在 winload 模块下断点

同样在“命令提示符”中使用命令

bcdedit /enum
 

这条命令显示当前可用模块的 GUID


在我的系统上显示是:

Windows 启动管理器
------------------
标识符     {bootmgr}
device partition=\Device\HarddiskVolume1
description Windows Boot Manager
locale zh-CN
inherit {globalsettings}
debugtype Serial
debugport 1
baudrate 115200
bootdebug yes
default {current}
resumeobject {53a5f400-d7b9-11de-93c1-e9eb61f9eb4f}
displayorder {current}
toolsdisplayorder {memdiag}
timeout 30


Windows 启动加载器
------------------
标识符     {current}
device partition=C:
path \Windows\system32\winload.exe
description Windows 7
locale zh-CN
inherit {bootloadersettings}
recoverysequence {53a5f402-d7b9-11de-93c1-e9eb61f9eb4f}
osdevice partitions=C:
systemroot \Windows
resumeobject {53a5f400-d7b9-11de-93c1-e9eb61f9eb4f}
 



winload 的 GUID 为 current

所以,用以下命令:

bcdedit /set {current} bootdebug on
bcdedit /set {current} debugtype serial
bcdedit /set {current} debugport 1
bcdedit /set {current} baudrate 115200
 


这样就在 winload 模块下了断点




3、在内核模块 Nt 模块下断点

 打开 windws 7 的“控制面板”----> “管理工具” ---> “系统配置” ---> 打开“引导”页面 ---> 点击“高级选项”

 ----> 在高级启动选项里,选中“调试” ----> 点击“确定”就行了。

 这样就在 nt 模块下了断点






三、 windbg 加载符号


 在 windbg 的 "File" ---> "Symbol File path" ---> 设定为: SRV*d:\symbols*http://msdl.microsoft.com/download/symbols

 回到 windbg 命令行,使用命令 .reload 命令,可以自动加载符号




四、用 bochs 配合 windbg 调试

 bochs 做单独调试,与 windbg 无联系,但 bochs 可以在整个启动过程中设断点,这一点 windbg 做不到。

windbg 的优点是可以查看符号。bochs 中看不符号,bochs+windbg 配合使用可以观察 windows7 启动的每个流程。


参考资料:一篇文章:http://advdbg.org/blogs/advdbg_system/articles/784.aspx
2012-8-6 23:05
0
雪    币: 0
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
看的有点迷糊了。。www.xitongzhijia.cc系统之家
2012-8-7 14:41
0
游客
登录 | 注册 方可回帖
返回
//