| Index: gdb/testsuite/gdb.python/py-typeprint.py
|
| diff --git a/gdb/testsuite/gdb.python/py-error.py b/gdb/testsuite/gdb.python/py-typeprint.py
|
| similarity index 59%
|
| copy from gdb/testsuite/gdb.python/py-error.py
|
| copy to gdb/testsuite/gdb.python/py-typeprint.py
|
| index 815284919304a1818e9171624dbf42d724369dba..9afb005eef022715b5ff3dda150e175934273836 100644
|
| --- a/gdb/testsuite/gdb.python/py-error.py
|
| +++ b/gdb/testsuite/gdb.python/py-typeprint.py
|
| @@ -1,4 +1,4 @@
|
| -# Copyright (C) 2010-2012 Free Software Foundation, Inc.
|
| +# Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
|
|
| # This program is free software; you can redistribute it and/or modify
|
| # it under the terms of the GNU General Public License as published by
|
| @@ -15,11 +15,21 @@
|
|
|
| import gdb
|
|
|
| -class ClassName(gdb.Command):
|
| - 'a'
|
| +class Recognizer(object):
|
| def __init__(self):
|
| - gdb.Command.__init__ (self, "ClassName", gdb.COMMAND_DATA, prefix=True)
|
| - def invoke(self, args, from_tty):
|
| - print
|
| + self.enabled = True
|
|
|
| -ClassName()
|
| + def recognize(self, type_obj):
|
| + if type_obj.tag == 'basic_string':
|
| + return 'string'
|
| + return None
|
| +
|
| +class StringTypePrinter(object):
|
| + def __init__(self):
|
| + self.name = 'string'
|
| + self.enabled = True
|
| +
|
| + def instantiate(self):
|
| + return Recognizer()
|
| +
|
| +gdb.type_printers.append(StringTypePrinter())
|
|
|