summaryrefslogtreecommitdiff
path: root/chromium/tools/gdb/viewg.gdb
blob: c664f607ae96b852ec3fdc7c166ce8305f0ddf02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Creates a SVG graph of the view hierarchy, when stopped in a
# method of an object that inherits from views::View. Requires
# graphviz.
#
# For more info see
# chromium/src/+/HEAD/docs/graphical_debugging_aid_chromium_views.md
#
# To make this command available, add the following to your ~/.gdbinit:
# source {Path to SRC Root}/tools/gdbviewg.gdb
#
# Usage: type `viewg` at the GDB prompt, given the conditions above.


define viewg
  if $argc != 0
    echo Usage: viewg
  else
    set pagination off
    set print elements 0
    set logging off
    set logging file ~/state.dot
    set logging overwrite on
    set logging redirect on
    set logging on
    printf "%s\n", views::PrintViewGraph(this).c_str()
    set logging off
    shell dot -Tsvg -o ~/state.svg ~/state.dot
    set pagination on
  end
end