1 # Copyright (C) 2018-2022 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 class cons_pp(object):
22 def __init__(self, val):
26 if int(self._val) == 0:
28 elif int(self._val["type"]) == 0:
31 return "%d" % self._val["atom"]["ival"]
34 if int(self._val) == 0:
36 elif int(self._val["type"]) == 0:
37 return [("atom", self._val["atom"])]
40 ("car", self._val["slots"][0]),
41 ("cdr", self._val["slots"][1]),
45 def cons_pp_lookup(val):
46 if str(val.type) == "struct cons *":
52 del gdb.pretty_printers[1:]
53 gdb.pretty_printers.append(cons_pp_lookup)