| 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 |
| 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 webkit | 25 import webkit |
| 25 | 26 |
| 26 # When debugging this module, set the below variable to True, and then use | 27 # When debugging this module, set the below variable to True, and then use |
| 27 # (gdb) python del sys.modules['gdb_chrome'] | 28 # (gdb) python del sys.modules['gdb_chrome'] |
| 28 # (gdb) python import gdb_chrome | 29 # (gdb) python import gdb_chrome |
| 29 # to reload. | 30 # to reload. |
| 30 _DEBUGGING = False | 31 _DEBUGGING = False |
| 31 | 32 |
| 32 | 33 |
| 33 pp_set = gdb.printing.RegexpCollectionPrettyPrinter("chromium") | 34 pp_set = gdb.printing.RegexpCollectionPrettyPrinter("chromium") |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 yield ('sudden_termination_allowed_', | 288 yield ('sudden_termination_allowed_', |
| 288 self.val['sudden_termination_allowed_']) | 289 self.val['sudden_termination_allowed_']) |
| 289 yield ('ignore_input_events_', self.val['ignore_input_events_']) | 290 yield ('ignore_input_events_', self.val['ignore_input_events_']) |
| 290 yield ('is_guest_', self.val['is_guest_']) | 291 yield ('is_guest_', self.val['is_guest_']) |
| 291 pp_set.add_printer('content::RenderProcessHostImpl', | 292 pp_set.add_printer('content::RenderProcessHostImpl', |
| 292 '^content::RenderProcessHostImpl$', | 293 '^content::RenderProcessHostImpl$', |
| 293 RenderProcessHostImplPrinter) | 294 RenderProcessHostImplPrinter) |
| 294 | 295 |
| 295 | 296 |
| 296 gdb.printing.register_pretty_printer(gdb, pp_set, replace=_DEBUGGING) | 297 gdb.printing.register_pretty_printer(gdb, pp_set, replace=_DEBUGGING) |
| OLD | NEW |