Add FilePath to the gdb pretty printers.
Review URL: http://codereview.chromium.org/6621017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76956 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
@@ -26,12 +26,24 @@ class GURLPrinter(webkit.StringPrinter):
|
|||||||
def to_string(self):
|
def to_string(self):
|
||||||
return self.val['spec_']
|
return self.val['spec_']
|
||||||
|
|
||||||
|
class FilePathPrinter(object):
|
||||||
|
def __init__(self, val):
|
||||||
|
self.val = val
|
||||||
|
|
||||||
|
def to_string(self):
|
||||||
|
return self.val['path_']['_M_dataplus']['_M_p']
|
||||||
|
|
||||||
|
|
||||||
def lookup_function(val):
|
def lookup_function(val):
|
||||||
typ = str(val.type)
|
type_to_printer = {
|
||||||
if typ == 'string16':
|
'string16': String16Printer,
|
||||||
return String16Printer(val)
|
'GURL': GURLPrinter,
|
||||||
elif typ == 'GURL':
|
'FilePath': FilePathPrinter,
|
||||||
return GURLPrinter(val)
|
}
|
||||||
|
|
||||||
|
printer = type_to_printer.get(str(val.type), None)
|
||||||
|
if printer:
|
||||||
|
return printer(val)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
gdb.pretty_printers.append(lookup_function)
|
gdb.pretty_printers.append(lookup_function)
|
||||||
|
Reference in New Issue
Block a user