无法使用串行电缆调试内核驱动程序

发布于 2024-08-11 04:27:45 字数 2402 浏览 3 评论 0原文

我对驱动程序很陌生。我尝试使用串行 COM 端口调试内核驱动程序,但没有成功。有人可以告诉我如何解决问题的正确方向吗?

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

错误:DavReadRegistryValues/RegQueryValueExW(4)。 W状态 = 127
错误:DavReadRegistryValues/RegQueryValueExW(5)。 W状态 = 127
错误:DavReadRegistryValues/RegQueryValueExW(6)。 WStatus = 127

此时,我按下 Ctl^D 和 kd console,我看到
阅读:超时。
读取:等待类型 7 数据包
阅读:超时。
读取:等待类型 7 数据包
阅读:超时。

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

<代码> 这是我所做的事情

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.

谢谢 国王

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

暮年 2024-08-18 04:27:45

您确定串行连接良好吗?

该电缆必须是零调制解调器电缆 - 您应该使用终端程序验证这一点(没有在目标上启用内核调试)。在目标和主机上运行程序(超级终端或其他)(请记住,就像我之前所说的那样,不得在目标上启用对该端口的内核调试,否则无法打开该端口)。

您可以在这里找到一些免费终端程序的链接(我认为自 Vista 以来 Microsoft 不再提供超级终端): http://www.lvr.com/serport.htm#software

在一台计算机上键入一些字符,并确保它们显示在另一侧。在另一台机器上执行相同操作。

如果您做不到这一点,则说明没有串行连接,您必须使用空调制解调器电缆或适配器。在你能做到这一点之前,尝试让杜兰特通过该连接工作是没有意义的。

另外,请记住,目标上的内核调试所使用的 COM 端口必须是标准 8250 系列 UART(现在通常是 16550 或更好,并且通常嵌入到主板芯片组中)。它不能是 USB 串行端口连接器(尽管这种连接器在主机端可以正常工作,因为在主机上 kd.exe 是常规 Win32 程序)。

编辑:


如果不是串行连接问题,则问题可能是您的目标不支持使用 boot.ini 进行配置。从 Vista 开始,引导参数已使用“引导配置数据库”(BCD) 来指定,该数据库由诸如 bcdedit.exe 之类的程序操作。不幸的是,使用 BCDedit 配置系统比编辑 boot.ini 这样的简单文本文件要复杂得多。

您应该阅读调试器帮助文件部分“在目标计算机上配置软件”;特别是“使用启动参数”部分。其中详细介绍了如何使用 bcdedit 在 Vista 及更高版本的系统上启用调试。

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.

瞳孔里扚悲伤 2024-08-18 04:27:45

您可以测试的另一件事是在目标上调用 kd -kl 来查看调试是否在目标上工作 - 如果它告诉您调试未启用,则说明您尚未设置启动。 ini 正确。

The other thing you can test to see if debugging is working on the target is to invoke kd -kl on the target - if it tells you debugging isn't enabled, you haven't set up boot.ini correctly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文