summaryrefslogtreecommitdiffstats
path: root/tools/gdb/gdb_chrome.py
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 19:04:11 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 19:04:11 +0000
commit024bcff4e6d0927c19e4589153202b2f183c1875 (patch)
tree5e8d5029bcf01e599228de2c60a2fc46ea854ec2 /tools/gdb/gdb_chrome.py
parent01ed196b68335e6e3e90abc2aed6df3d4b71132b (diff)
downloadchromium_src-024bcff4e6d0927c19e4589153202b2f183c1875.zip
chromium_src-024bcff4e6d0927c19e4589153202b2f183c1875.tar.gz
chromium_src-024bcff4e6d0927c19e4589153202b2f183c1875.tar.bz2
gdb: print GURLs as strings
This makes a struct with a GURL in it display as a single line in gdb, e.g.: $1 = { x_ = 123, url_ = "file:///foo/bar" } As always, you can print the full GURL with all of the components using the "p/r" command: (gdb) p/r obj->url_ $1 = { (parsed field offsets dump out here for 20 lines) } Review URL: http://codereview.chromium.org/6627015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76942 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/gdb/gdb_chrome.py')
-rw-r--r--tools/gdb/gdb_chrome.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/gdb/gdb_chrome.py b/tools/gdb/gdb_chrome.py
index e548d08..b193122 100644
--- a/tools/gdb/gdb_chrome.py
+++ b/tools/gdb/gdb_chrome.py
@@ -22,10 +22,16 @@ class String16Printer(webkit.StringPrinter):
def to_string(self):
return webkit.ustring_to_string(self.val['_M_dataplus']['_M_p'])
+class GURLPrinter(webkit.StringPrinter):
+ def to_string(self):
+ return self.val['spec_']
def lookup_function(val):
- if str(val.type) == 'string16':
+ typ = str(val.type)
+ if typ == 'string16':
return String16Printer(val)
+ elif typ == 'GURL':
+ return GURLPrinter(val)
return None
gdb.pretty_printers.append(lookup_function)