OLD | NEW |
---|---|
1 # Introduction | 1 # Graphical Debugging Aid for Chromium Views |
2 | 2 |
3 A simple debugging tool exists to help visualize the views tree during debugging . It consists of 4 components: | 3 ## Introduction |
4 | 4 |
5 1. The function `View::PrintViewGraph()` (already in the file **view.cc** if y ou've sync'd recently), | 5 A simple debugging tool exists to help visualize the views tree during |
6 1. a gdb script file **viewg.gdb** (see below), | 6 debugging. It consists of 4 components: |
7 1. the graphViz package (http://www.graphviz.org/ - downloadable for Linux, Wi ndows and Mac), and | |
8 1. an SVG viewer (_e.g._ Chrome). | |
9 | 7 |
10 # Details | 8 1. The function `View::PrintViewGraph()` (already in the file **view.cc** if |
9 you've sync'd recently), | |
10 1. a gdb script file **viewg.gdb** (see below), | |
11 1. the graphViz package (http://www.graphviz.org/ - downloadable for Linux, | |
12 Windows and Mac), and | |
13 1. an SVG viewer (_e.g._ Chrome). | |
14 | |
15 ## Details | |
11 | 16 |
12 To use the tool, | 17 To use the tool, |
13 | 18 |
14 1. Make sure you have 'dot' installed (part of graphViz), | 19 1. Make sure you have 'dot' installed (part of graphViz), |
15 1. define `TOUCH_DEBUG` and compile chrome with Views enabled, | 20 1. define `TOUCH_DEBUG` and compile chrome with Views enabled, |
16 1. run gdb on your build and | 21 1. run gdb on your build and |
17 1. source **viewg.gdb** (this can be done automatically in **.gdbinit**), | 22 1. source **viewg.gdb** (this can be done automatically in **.gdbinit**), |
18 1. stop at any breakpoint inside class `View` (or any derived class), and | 23 1. stop at any breakpoint inside class `View` (or any derived class), and |
19 1. type `viewg` at the gdb prompt. | 24 1. type `viewg` at the gdb prompt. |
20 | 25 |
21 This will cause the current view, and any descendants, to be described in a grap h which is stored as **~/state.svg** (Windows users may need to modify the scrip t slightly to run under CygWin). If **state.svg** is kept open in a browser wind ow and refreshed each time `viewg` is run, then it provides a graphical represen tation of the state of the views hierarchy that is always up to date. | 26 This will cause the current view, and any descendants, to be described in a |
27 graph which is stored as **~/state.svg** (Windows users may need to modify the | |
nodir
2015/08/29 00:53:49
replace ** with ` here and below
Bons
2015/08/29 15:29:27
Done.
| |
28 script slightly to run under CygWin). If **state.svg** is kept open in a browser | |
29 window and refreshed each time `viewg` is run, then it provides a graphical | |
30 representation of the state of the views hierarchy that is always up to date. | |
22 | 31 |
23 It is easy to modify the gdb script to generate PDF in case viewing with evince (or other PDF viewer) is preferred. | 32 It is easy to modify the gdb script to generate PDF in case viewing with evince |
33 (or other PDF viewer) is preferred. | |
24 | 34 |
25 If you don't use gdb, you may be able to adapt the script to work with your favo rite debugger. The gdb script invokes | 35 If you don't use gdb, you may be able to adapt the script to work with your |
26 ``` | 36 favorite debugger. The gdb script invokes |
27 this->PrintViewGraph(true) | |
28 ``` | |
29 on the current object, returning `std::string`, whose contents must then be save d to a file in order to be processed by dot. | |
30 | 37 |
31 # viewg.gdb | 38 this->PrintViewGraph(true) |
39 | |
40 on the current object, returning `std::string`, whose contents must then be | |
41 saved to a file in order to be processed by dot. | |
42 | |
43 ## viewg.gdb | |
32 | 44 |
33 ``` | 45 ``` |
34 define viewg | 46 define viewg |
35 if $argc != 0 | 47 if $argc != 0 |
36 echo Usage: viewg | 48 echo Usage: viewg |
37 else | 49 else |
38 set pagination off | 50 set pagination off |
39 set print elements 0 | 51 set print elements 0 |
40 set logging off | 52 set logging off |
41 set logging file ~/state.dot | 53 set logging file ~/state.dot |
42 set logging overwrite on | 54 set logging overwrite on |
43 set logging redirect on | 55 set logging redirect on |
44 set logging on | 56 set logging on |
45 printf "%s\n", this->PrintViewGraph(true).c_str() | 57 printf "%s\n", this->PrintViewGraph(true).c_str() |
46 set logging off | 58 set logging off |
47 shell dot -Tsvg -o ~/state.svg ~/state.dot | 59 shell dot -Tsvg -o ~/state.svg ~/state.dot |
48 set pagination on | 60 set pagination on |
49 end | 61 end |
50 end | 62 end |
51 ``` | 63 ``` |
OLD | NEW |