无法使用串行电缆调试内核驱动程序 [英] Unable to debug the kernel driver using Serial cable

查看:233
本文介绍了无法使用串行电缆调试内核驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新手.我尝试使用串行COM端口调试内核驱动程序,但未成功.有人可以告诉我如何解决该问题的正确方向吗?

我在kd控制台上看到以下消息.

错误:DavReadRegistryValues/RegQueryValueExW(4). WStatus = 127
错误:DavReadRegistryValues/RegQueryValueExW(5). WStatus = 127
错误:DavReadRegistryValues/RegQueryValueExW(6). WStatus = 127

这时,我按下了Ctl ^ D和kd控制台,我看到了
阅读:超时.
阅读:等待7型数据包
阅读:超时.
阅读:等待7型数据包
阅读:超时.

WinDbg解决了该问题.我将波特率更改为115200,并在目标系统完全启动之前插入了中断(Ctr ^ Break).我现在可以调试代码.如果在目标系统完全启动后插入中断,则无法调试.我不知道确切的原因,但对目前的情况感到满意.

Here are the things I have done

Thanks King

解决方案

Are you sure you have a good serial connection?

The cable must be a null modem cable - you should verify this using a terminal program (without kernel debugging enabled on the target). Run the program (HyperTerminal or whatever) on both the target and the host machines (remember, like I said before kernel debugging over that port must not be enabled on the target or the port can't be opened).

You can find some links to free terminal programs (I don't think Microsoft provides HyperTerminal anymore since Vista) here: http://www.lvr.com/serport.htm#software

Type some characters on one machine, and make sure they show up on the other side. Do the same on the other machine.

If you can't do this, then there's no serial connection and you'll have to get a null modem cable or adapter. There's no point in trying to get KD to work over that connection until you can do this.

Also, remember that the COM port used by kernel debugging on the target must be a standard 8250 family UART (usually a 16550 or better nowadays, and usually baked into the motherboard chipset). It can't be a USB serial port connector (although that kind will work fine on the host side, since on the host kd.exe is a regular Win32 program).

Edit:


If it's not a serial connection problem, the problem might be that your target doesn't support configuration using boot.ini.从Vista开始,已使用启动配置数据库"(BCD)指定了启动参数,该程序由bcdedit.exe之类的程序处理.不幸的是,使用BCDedit配置系统比仅编辑一个简单的文本文件(如boot.ini)要复杂得多.

您应该阅读调试器帮助文件部分在目标计算机上配置软件";特别是使用引导参数"部分.有关如何使用bcdedit在Vista和更高版本的系统上启用调试的详细信息.

I am new to driver stuff. I have tried to debug the kernel driver using serial COM port without success. Could someone show me proper direction how to fix the problem?

I am seeing the following messages on kd console.

ERROR: DavReadRegistryValues/RegQueryValueExW(4). WStatus = 127
ERROR: DavReadRegistryValues/RegQueryValueExW(5). WStatus = 127
ERROR: DavReadRegistryValues/RegQueryValueExW(6). WStatus = 127

At this time, I pressed Ctl^D and kd console and I am seeing
READ: Timeout.
READ: Wait for type 7 packet
READ: Timeout.
READ: Wait for type 7 packet
READ: Timeout.

EDIT: The problem is fixed with WinDbg. I changed the baud rate to 115200 and inserted break (Ctr ^ Break) before Target system completely boots up. I am able to debug the code now. If I insert break after the target system completely boots up then I am unable to debug. I don't know exact reason for it but Happy with current situation.

Here are the things I have done

1) Prepared Target system for debug mode by editing the boot.ini file. Added     "/debugport=com1 /baudrate=57600"  to boot.ini

2) On Host system, started kd.exe and seeing the following output

C:\Program Files\Debugging Tools for Windows>kd.exe -k com:port=1,baud=57600
Microsoft (R) Windows Debugger  Version 6.6.0007.5
Copyright (c) Microsoft Corporation. All rights reserved.
Opened \\.\com1
Waiting to reconnect...

3) Rebooted Target system, system boots slowly than normal boot and I am seeing some     messages <<below>> on Host system console

4) At this time, If I press Ctl-C on KD console then Target system freezes (hangs)         and proceeds if I enter "g" at kd prompt.  This means that Target system     is going to debug mode

5) However After some time I am seeing the following message on the host machine console

ERROR: DavReadRegistryValues/RegQueryValueExW(4). WStatus = 127  
ERROR: DavReadRegistryValues/RegQueryValueExW(5). WStatus = 127  
ERROR: DavReadRegistryValues/RegQueryValueExW(6). WStatus = 127  

After the above message there are no messages appearing on kd console.

I searched internet for "ERROR: DavReadRegistryValues/RegQueryValueExW(6). WStatus =     127" but didn't get proper reason for it.

I pressed Ctl^D and kd console and I am seeing 
READ: Timeout.  
READ: Wait for type 7 packet  
READ: Timeout.  
READ: Wait for type 7 packet  
READ: Timeout.  

I have tried above steps with following options ..but no luck

I disabled firewall & antivirus software on both Host and Target systems. 
I unplugged and re-plugged serial cable connection between each trail
I have logged-in with Domain account local account with Admin rights 


Can someone show some light on how to proceed? Both systems are running on XP 32bit     SP3 OS.

Thanks King

解决方案

Are you sure you have a good serial connection?

The cable must be a null modem cable - you should verify this using a terminal program (without kernel debugging enabled on the target). Run the program (HyperTerminal or whatever) on both the target and the host machines (remember, like I said before kernel debugging over that port must not be enabled on the target or the port can't be opened).

You can find some links to free terminal programs (I don't think Microsoft provides HyperTerminal anymore since Vista) here: http://www.lvr.com/serport.htm#software

Type some characters on one machine, and make sure they show up on the other side. Do the same on the other machine.

If you can't do this, then there's no serial connection and you'll have to get a null modem cable or adapter. There's no point in trying to get KD to work over that connection until you can do this.

Also, remember that the COM port used by kernel debugging on the target must be a standard 8250 family UART (usually a 16550 or better nowadays, and usually baked into the motherboard chipset). It can't be a USB serial port connector (although that kind will work fine on the host side, since on the host kd.exe is a regular Win32 program).

Edit:


If it's not a serial connection problem, the problem might be that your target doesn't support configuration using boot.ini. Since Vista, boot parameters have been specified using the "Boot Configuration Database" (BCD) which is manipulated with a program like bcdedit.exe. Unfortunately, configuring a system using BCDedit is much more complicated than just editing a simple text file like boot.ini.

You should read the debugger helpfile section "Configuring Software on the Target Computer"; in particular the "Using Boot Parameters" part. there are details there on how bcdedit can be used to enable debugging on Vista and later systems.

这篇关于无法使用串行电缆调试内核驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆