Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """GDB support for Chrome types. | 5 """GDB support for Chrome types. |
| 6 | 6 |
| 7 Add this to your gdb by amending your ~/.gdbinit as follows: | 7 Add this to your gdb by amending your ~/.gdbinit as follows: |
| 8 python | 8 python |
| 9 import sys | 9 import sys |
| 10 sys.path.insert(0, "/path/to/tools/gdb/") | 10 sys.path.insert(0, "/path/to/tools/gdb/") |
| 11 import gdb_chrome | 11 import gdb_chrome |
| 12 end | 12 end |
| 13 | 13 |
| 14 This module relies on the WebKit gdb module already existing in | 14 This module relies on the WebKit gdb module already existing in |
|
Jeffrey Yasskin
2014/07/28 19:39:39
Please remove this instruction now that you've fix
| |
| 15 your Python path. | 15 your Python path. |
| 16 | 16 |
| 17 Use | 17 Use |
| 18 (gdb) p /r any_variable | 18 (gdb) p /r any_variable |
| 19 to print |any_variable| without using any printers. | 19 to print |any_variable| without using any printers. |
| 20 """ | 20 """ |
| 21 | 21 |
| 22 import datetime | 22 import datetime |
| 23 import gdb | 23 import gdb |
| 24 import gdb.printing | 24 import gdb.printing |
| 25 import os | |
| 26 import sys | |
| 27 | |
| 28 sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), | |
|
Jeffrey Yasskin
2014/07/28 19:39:39
It's a bit safer to remove the element of sys.path
| |
| 29 '..', '..', 'third_party', 'WebKit', 'Tools', 'gdb')) | |
| 25 import webkit | 30 import webkit |
| 26 | 31 |
| 27 # When debugging this module, set the below variable to True, and then use | 32 # When debugging this module, set the below variable to True, and then use |
| 28 # (gdb) python del sys.modules['gdb_chrome'] | 33 # (gdb) python del sys.modules['gdb_chrome'] |
| 29 # (gdb) python import gdb_chrome | 34 # (gdb) python import gdb_chrome |
| 30 # to reload. | 35 # to reload. |
| 31 _DEBUGGING = False | 36 _DEBUGGING = False |
| 32 | 37 |
| 33 | 38 |
| 34 pp_set = gdb.printing.RegexpCollectionPrettyPrinter("chromium") | 39 pp_set = gdb.printing.RegexpCollectionPrettyPrinter("chromium") |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 yield ('sudden_termination_allowed_', | 324 yield ('sudden_termination_allowed_', |
| 320 self.val['sudden_termination_allowed_']) | 325 self.val['sudden_termination_allowed_']) |
| 321 yield ('ignore_input_events_', self.val['ignore_input_events_']) | 326 yield ('ignore_input_events_', self.val['ignore_input_events_']) |
| 322 yield ('is_guest_', self.val['is_guest_']) | 327 yield ('is_guest_', self.val['is_guest_']) |
| 323 pp_set.add_printer('content::RenderProcessHostImpl', | 328 pp_set.add_printer('content::RenderProcessHostImpl', |
| 324 '^content::RenderProcessHostImpl$', | 329 '^content::RenderProcessHostImpl$', |
| 325 RenderProcessHostImplPrinter) | 330 RenderProcessHostImplPrinter) |
| 326 | 331 |
| 327 | 332 |
| 328 gdb.printing.register_pretty_printer(gdb, pp_set, replace=_DEBUGGING) | 333 gdb.printing.register_pretty_printer(gdb, pp_set, replace=_DEBUGGING) |
| OLD | NEW |