How can I use windbg tracking to debug ASL/ACPI?
When studying ACPI last year, I used windbg to analyze ACPI methods. At that time, when I configured windbg, I referred to the articles of several predecessors. Today I also transferred one of them for backup. Original address: http://blog.csdn.net/EFIBIOS/archive/2007/03/12/1526763.aspx
In modern computers, both hardware and firmware (BiOS) must comply with ACPI specifications so that the operating system can control the automatic configuration and power management of all modules. Using windbg to debug ACPI Code usually requires two computers, one being the target machine (debuggee) and the other being the host (debugger ). The following describes how to create a debugging environment on two machines.
1. Configure the connection mode for debugging debuggee
Windbg supports three different Connection Methods: COM, 1394, and USB. You can see some articles on the Internet about using USB for connection. You need to purchase special USB debugging cables, which are expensive, this article will not be discussed. Generally, a laptop does not have a COM port, so it has to use 1394 or com to convert to USB, but here I just want to discuss how to use COM port to connect.
Start to the operating system, use the bootcfg command or directly use the text editor to modify the boot. ini file and specify the port and parameters used for debugging. To use the COM port for debugging, add the/debug parameter to the startup parameters and specify the/debugport and/baudrate sub-parameters as the startup items. The first startup item in the boot. ini file below is to configure the COM port. The/debugport sub-parameter specifies which comport of debuggee is used, and/baudrate indicates the connection speed (the default value is 19200 bits per second ).
[Boot loader]
Timeout = 30
Default = multi (0) disk (0) RDISK (0) Partition (1)/Windows
[Operating systems]
Multi (0) disk (0) RDISK (0) Partition (1)/Windows = "debugging with cable"/fastdetect/debug/debugport = COM1/baudrate = 57600
Multi (0) disk (0) RDISK (0) Partition (1)/Windows = "Microsoft Windows XP Professional"/fastdetect
The following example uses the bootcfg command to set the first startup Item to use port COM1 with a baud rate of 115200. The/debug switch of bootcfg is enabled, the/port switch and/baud parameter indicate the port and speed, and the/ID switch indicates that the first startup Item is modified.
Bootcfg/debug on/port COM1/baud 115200/Id 1
2. Create an AML debugging environment
The AML debugger is included in the ACPI. sys of the checked (Debug) version. to fully use the AML debugger, the driver must be installed on the target machine. Although the free version of ACPI. sys supports part of AMLI debugger extension commands, it does not contain AMLI debugger.
If you have installed Windows checked on your target machine, the system runs the checked version of ACPI. sys. If the free version of Windows is installed, you can choose to reinstall a full version of checked or install only the checked version of ACPI. sys. (It must be the next method for convenience. j) I will explain in another article how to install the checked version of ACPI. sys in free windows.
3. Download and install windbg
Windbg is available for free on the Microsoft website at http://www.microsoft.com/whdc/devtools/debugging/default.mspx. the current version is 6.6.7.5. There is nothing special about installing it. If you have installed it on another machine, it can be copied directly to your current machine. I have seen some posts saying that it is best not to have spaces on the installation path, but there may be problems, but I have never encountered it.
4. Host-side symbol (Symbol) file path Configuration
First, what is a symbol file? The symbol file contains a lot of data required for debugging DLL and exe files, but they are useless when the program is running. In general, symbol file is a file that contains the debugging information of related binary files (exe, DLL). It uses. PDB as the extension. For example, if Windows XP has a gdi32.dll, Microsoft will generate a gdi32.pdb file when compiling the DLL. If programmers have this PDB file, they can use it for debugging, tracking the gdi32.dll! Generally, the symbol file contains the following content:
A. Global Variables)
B. Local Variables)
C. function names and their endpoints (function names and the addresses of their entry points)
D. FPO data (frame pointer omission), frame pointer is a method used to call a stack) find the row number (source-line numbers) of the source code of the data structure of the function to be called)
This file is closely related to the compiled version of the binary file. For example, if you modify the DLL output function and then compile the DLL, the original PDB file will become obsolete, you cannot perform debugging any more. At this time, you need to compile the generated PDB file after modification. Therefore, the symbol file used by the host must be consistent with the OS version installed on the target machine.
The symbol file is crucial for windbg. If the correct symbol file cannot be found, the debugging function cannot be used. You can download the Windows symbol file from the Microsoft website for free at http://www.microsoft.com/whdc/devtools/debugging/symbolpkg.mspx. But I do not recommend that you do this, because both the checked version and the free version of symbol have nearly 200 m, the download process is quite painful. Fortunately, Microsoft provides the symbol server so that windbg can find the required module on it. The specific configuration method is: file-> symbol file path... In the pop-up symbol file dialog box, enter SRV * C:/Symbols * symbol.
5. Start online debugging.
A. Start the target machine. When the menu is started, move the arrow key and end the countdown so that it can be parked in this place.
B. Open windbg, file-> kernel Debug on the host and select the connection method. If the COM port is used, in the dialog box, enter the COM port used by the host and the selected baud rate. The baud rate must be the same as that set on the target machine.
Click OK and you will be able to use it! Run the AMLI debugger command to start the AMLI debugger. If there is no movement, this will be successful. Start debugging your ACPI code