| Index: gdb/testsuite/gdb.python/py-frame-args.py
|
| diff --git a/gdb/testsuite/gdb.python/py-objfile-script-gdb.py.in b/gdb/testsuite/gdb.python/py-frame-args.py
|
| similarity index 75%
|
| copy from gdb/testsuite/gdb.python/py-objfile-script-gdb.py.in
|
| copy to gdb/testsuite/gdb.python/py-frame-args.py
|
| index 4de67923226d341d091b2b9d412f6ffd6c03db73..65c9ad72aef778027446620a257a6ce1690fc4da 100644
|
| --- a/gdb/testsuite/gdb.python/py-objfile-script-gdb.py.in
|
| +++ b/gdb/testsuite/gdb.python/py-frame-args.py
|
| @@ -1,4 +1,4 @@
|
| -# Copyright (C) 2011-2012 Free Software Foundation, Inc.
|
| +# Copyright (C) 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
|
| @@ -13,16 +13,28 @@
|
| # You should have received a copy of the GNU General Public License
|
| # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
| -# This file is part of the GDB testsuite.
|
| -
|
| import re
|
| +import gdb
|
| +
|
| +class pp_s (object):
|
| + def __init__(self, val):
|
| + self.val = val
|
| +
|
| + def to_string(self):
|
| + m = self.val["m"]
|
| + return "m=<" + str(self.val["m"]) + ">"
|
|
|
| -class pp_ss:
|
| +class pp_ss (object):
|
| def __init__(self, val):
|
| self.val = val
|
|
|
| def to_string(self):
|
| - return "a=<" + str(self.val["a"]) + "> b=<" + str(self.val["b"]) + ">"
|
| + return "super struct"
|
| +
|
| + def children (self):
|
| + yield 'a', self.val['a']
|
| + yield 'b', self.val['b']
|
| +
|
|
|
| def lookup_function (val):
|
| "Look-up and return a pretty-printer that can print val."
|
| @@ -39,7 +51,6 @@ def lookup_function (val):
|
|
|
| # Get the type name.
|
| typename = type.tag
|
| -
|
| if typename == None:
|
| return None
|
|
|
| @@ -51,13 +62,14 @@ def lookup_function (val):
|
| return pretty_printers_dict[function] (val)
|
|
|
| # Cannot find a pretty printer. Return None.
|
| -
|
| return None
|
|
|
| +
|
| def register_pretty_printers ():
|
| - pretty_printers_dict[re.compile ('^ss$')] = pp_ss
|
| + pretty_printers_dict[re.compile ('^s$')] = pp_s
|
| + pretty_printers_dict[re.compile ('^ss$')] = pp_ss
|
|
|
| pretty_printers_dict = {}
|
|
|
| register_pretty_printers ()
|
| -gdb.current_progspace().pretty_printers.append (lookup_function)
|
| +gdb.pretty_printers.append (lookup_function)
|
|
|