From 72be9d6be7de305b34ac298f1466167b9aba9bc2 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 7 Jun 2022 07:05:02 -0600 Subject: Add 'summary' mode to Value.format_string This adds a 'summary' mode to Value.format_string and to gdb.print_options. For the former, it lets Python code format values using this mode. For the latter, it lets a printer potentially detect if it is being called in a backtrace with 'set print frame-arguments' set to 'scalars'. I considered adding a new mode here to let a pretty-printer see whether it was being called in a 'backtrace' context at all, but I'm not sure if this is really desirable. --- gdb/testsuite/gdb.python/py-format-string.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gdb/testsuite/gdb.python/py-format-string.py') diff --git a/gdb/testsuite/gdb.python/py-format-string.py b/gdb/testsuite/gdb.python/py-format-string.py index aa7b104..b7e8346 100644 --- a/gdb/testsuite/gdb.python/py-format-string.py +++ b/gdb/testsuite/gdb.python/py-format-string.py @@ -28,6 +28,8 @@ class PointPrinter(object): def to_string(self): global saved_options saved_options = gdb.print_options() + if saved_options["summary"]: + return "No Data" return "Pretty Point (%s, %s)" % (self.val["x"], self.val["y"]) -- cgit v1.1