diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-03 00:39:19 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-03 00:39:19 +0000 |
commit | ddaadcf7182fd1228d6fa218341277ea0fcd4bde (patch) | |
tree | 96389db55b48376b34727155c04e7cf9196a2f39 /tools/gdb | |
parent | 7cceebac61d267d113791de09d79ac11f4fa95f3 (diff) | |
download | chromium_src-ddaadcf7182fd1228d6fa218341277ea0fcd4bde.zip chromium_src-ddaadcf7182fd1228d6fa218341277ea0fcd4bde.tar.gz chromium_src-ddaadcf7182fd1228d6fa218341277ea0fcd4bde.tar.bz2 |
gdb: check in a gdb module for printing string16
This just reuses the string-printing code from the WebKit module.
Review URL: http://codereview.chromium.org/6596118
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76680 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/gdb')
-rw-r--r-- | tools/gdb/gdb_chrome.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/gdb/gdb_chrome.py b/tools/gdb/gdb_chrome.py new file mode 100644 index 0000000..e548d08 --- /dev/null +++ b/tools/gdb/gdb_chrome.py @@ -0,0 +1,31 @@ +#!/usr/bin/python +# Copyright (c) 2011 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. + +"""GDB support for Chrome types. + +Add this to your gdb by amending your ~/.gdbinit as follows: + python + import sys + sys.path.insert(0, "/path/to/tools/gdb/") + import gdb_chrome + +This module relies on the WebKit gdb module already existing in +your Python path. +""" + +import gdb +import webkit + +class String16Printer(webkit.StringPrinter): + def to_string(self): + return webkit.ustring_to_string(self.val['_M_dataplus']['_M_p']) + + +def lookup_function(val): + if str(val.type) == 'string16': + return String16Printer(val) + return None + +gdb.pretty_printers.append(lookup_function) |