Chromium Browser Development Series fifth: Debugging with WinDBG

Source: Internet
Author: User

WinDbg believes that the people of Windows development know that some people use a slip of the son, there is a crash, directly with this tool analysis, it is located. Very useful. Once a colleague, do SDK development, will be various commands. After coming to Beijing, also went to Microsoft interview (but at that time to do outsourcing, earn a lot), asked questions including will not use WinDbg positioning problems. There were a few simple commands at the time, and at last there was no face.

use WinDbg to debug programs under Windows, as long as there are symbol files, the problem is fixed in minutes. The following is mainly about using WinDbg debug chromium. Some are from the official internet to turn over, if you do not understand, you can directly add our public number: Programmer Interactive Alliance (coder_online) to interact.

WinDbg is a powerful free tool that is more powerful than the VisualStudio debugger and is able to see information such as the current memory stack, but is also more difficult to use than that (like GDB under Linux). You can go to the Microsoft Official website to download the latest version of the installation, the official website has two versions: 32-bit and 64-bit. We use 32-bit to debug chromium.

Initialize

1. Set the symbol path

Open WinDbg, File menu, Symbol file path (shortcut key Ctrl+s)

here is the assumption C:\code\symbols This is your symbol file storage location (this can be set freely, but must ensure that there is enough space, find an empty disk character has a 10G or so, create a new folder, forget about it later), set the symbol path as follows:

Srv*c:\code\symbols*http://msdl.microsoft.com/download/symbols; Srv*c:\code\symbols*https://chromium-browser-symsrv.commondatastorage.googleapis.com


2. You can choose to display some windows in the view window


3. use some of the features under the file to load the process or executable file you want to debug


4. Set the source path

if you want to directly locate the source location, you can set the source code path: file---source path, preferably local code, directly specify the Chromium network address is not very realistic:


The more important thing to debug chromium with WinDbg is that it can debug child processes. An easy way to do this is to select the following option when you open the window using "Open executable":

You can also debug a running process with attach and use detach to dismiss the debugging process.


#重要说明

(1) The WinDbg command is divided into standard commands, meta-commands and extended commands.

standard commands provide the most basic debugging functionality and are case-insensitive. such as: BP g DT DV K, etc.

the META command provides functionality not provided by standard commands and is built into the debug engine to begin with. such as. Sympath. Reload, etc.

extension commands are used to extend the debugging capabilities of a particular aspect, and are implemented in a dynamically loaded extension module, beginning with the. such as!analyze, etc.

(2) Enter the debugging state, the direct return can repeat the previous command, press the UP and DOWN ARROW keys to browse and select previously entered commands

(3) Magic Tab key to complete command completion; ESC clears the text in the current command input box

(4) use; As a delimiter, you can enter multiple commands on the same line

(5) "0:047" in the red box. "0 is the process number for the current debug session; 047 is the thread number of the debug session"

(6) When *busy* is displayed at the command prompt, even if the command input box can enter a command, the command entered will not be executed immediately, waiting for WinDbg to be idle.

you can use CTRL + BREAK to terminate a command that has not been completed for a long time.

If you want to know more about WinDbg knowledge, you can go to the official website to learn. Also recommended a study of the book "Software Debugging."


If you have any ideas or questions, please follow our public number, timely communication, there are a variety of Daniel to help you solve the problem.

Welcome to the public platform: the Programmer Interaction Alliance (Coder_online), a developer's home, to tell his story .

Welcome to join our QQ Group: Programmer Interaction Alliance (254241126)

Chromium Browser Development Series fifth: Debugging with WinDBG

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.