Unable to Debug Kernel Driver Using Serial Cable

I am new to working with drivers. I tried to debug the kernel driver using the serial COM port with no success. Can anyone show me the right direction how to fix the problem?

I see the following messages on the 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 the Ctl ^ D and kd buttons and I can see how to READ: Timeout.
READ: Wait for packet type 7
READ: Timeout.
READ: Wait for packet type 7
READ: Timeout.

EDIT: Problem fixed with WinDbg. I changed the baud rate to 115200 and inserted a break (Ctr ^ Break) before the target's system was fully loaded. I can debug the code now. If I insert a break after the target system is fully booted, I cannot debug. I don't know the exact reason, but I'm happy with the 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

0


source to share


2 answers


Do you have a good serial connection?

The cable must be a null modem cable - you must test this with a terminal program (without enabling kernel debugging on the target). Run the program (HyperTerminal or whatever) on the target and host computers (remember as I said before, before kernel debugging on that port must not be enabled on the target or the port cannot be open).

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

Enter multiple characters on one machine and make sure they appear on the other side. Do the same on another machine.

If you cannot do this, then there is no serial connection and you will have to get a null modem cable or adapter. There is no point in trying to get KD to work on this connection until you can.



Also, remember that the COM port used when debugging the kernel on a target must be the standard 8250 UART family (typically currently 16550 or better and typically used in the motherboard chipset). It cannot be a USB serial connector (although this kind will work well on the host side, since kd.exe is a normal Win32 program on the host).

Edit:


If this is not a serial connection problem, the problem might be that your target does not support configuration with boot.ini

. Starting with Vista, the boot parameters were specified using the "Boot Configuration Database" (BCD), which is controlled by a program like bcdedit.exe

. Unfortunately, setting up a system using BCDedit is much more difficult than just editing a simple text file such as boot.ini

.

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

+2


source


Another thing you can check to see if debugging works on the target is to call kd -kl on the target - if it tells you that debugging is not enabled, you haven't configured boot.ini correctly.



0


source







All Articles