Content
While there are many tools and techniques available to debug blink, this article focuses on debugging blink in addition to layout testing feature.
1 Introduction
2 Linux
2.1 Getting Started
2.2 Start Debugger
3 Useful Tools
3.1 Debugging functions
3.2 Blink GDB Python Library
4 print back Trace
4.1 Printing symbols with assert
4.2 Use Chromium ' s StackTrace
4.3 using BackTrace () to print symbols
There are two main ways to enter Blink: by debugging the chromium binary file itself or Content_shell. Blink debugging in most cases, the latter is the recommended option because it greatly reduces the size and complexity. This means that we need build Content_shell, which, by comparison, should be simpler and make it an easier way to build our goals.
Take the Content_shell itself as an argument, followed by the HTML file to run blink, to execute the Content_shell. In addition, the simplest type of debugging is: one of the things you might want to do is look at the basic page structure after the page is loaded (in this blink's internal structure is called the layout tree, not to be confused with the DOM tree or the frame tree:). You can do this with a simple command-line option:
Content_shell--dump Rendering Tree test.html
Start the debugger
Debugging Content_shell on Linux is usually done with GDB, assuming you're using Content_shell, you might want to run in single-process mode, unless, of course, you're dealing with threading issues. Running in single-process mode will greatly simplify setup and speed up the debugging process. This is simple, as long as you start Content_shell with the--single process flag.
A common?? The GDB command is:
GDB--args Content_shell--single-process test.html
If you are unable to use--single-, you can use the--renderer-Startup-dialog box instead. Just content_shell with normal shipping?? Line flag, you start with it and--renderer-, the dialog renderer is paused and allows you to attach a debugger before continuing.
General useful Debugging Tools
Debugging features
You can use the GDB command to print the display of them. Here are some of the debugging features of Blink:
Showtreeforthis () node and layoutobjects output DOM tree
Showlayouttreeforthis () layoutobjects Output layout tree
The block flow associated with the Showlinetreeforthis () layoutobjects and inlineboxes outputs an inner box tree, marking all matching inline boxes associated with this.
Showdebugdata () displayitemlists the list of displayed items for the output and associated debug data
Assuming a local variable child is a layoutobject, the following will print the layout tree:
(GDB) Print child> showlayertreeforthis ()
Blink GDB Python Library
When using gdb that supports Python, there are also practical features that make some blink types easier and more convenient to output, such as Layoutunit and Layoutsize classes that print beautifully. We can find it in Third_party/webkit/tools/gdb/webkit.py.
Read the original
This article is original, reproduced please indicate the source, offenders must investigate
Focus on the public platform: the Programmer Interaction Alliance (coder_online), you can get the first original technical articles, and (Java/c/c++/android/windows/linux) technology Daniel Friends, online communication programming experience, get programming basics, Solve programming problems. Programmer Interactive Alliance, Developer's own home.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
How to debug blink?