From 024bcff4e6d0927c19e4589153202b2f183c1875 Mon Sep 17 00:00:00 2001 From: "evan@chromium.org" Date: Fri, 4 Mar 2011 19:04:11 +0000 Subject: 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 --- tools/gdb/gdb_chrome.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) -- cgit v1.1