From c4a3dbaf1132105586586617a59d0e7566eefd41 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 6 Jun 2022 09:54:45 -0600 Subject: Expose current 'print' settings to Python PR python/17291 asks for access to the current print options. While I think this need is largely satisfied by the existence of Value.format_string, it seemed to me that a bit more could be done. First, while Value.format_string uses the user's settings, it does not react to temporary settings such as "print/x". This patch changes this. Second, there is no good way to examine the current settings (in particular the temporary ones in effect for just a single "print"). This patch adds this as well. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=17291 --- gdb/python/py-value.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdb/python/py-value.c') diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c index 12e9562..93cb9b9 100644 --- a/gdb/python/py-value.c +++ b/gdb/python/py-value.c @@ -673,7 +673,7 @@ valpy_format_string (PyObject *self, PyObject *args, PyObject *kw) } struct value_print_options opts; - get_user_print_options (&opts); + gdbpy_get_print_options (&opts); opts.deref_ref = 0; /* We need objects for booleans as the "p" flag for bools is new in @@ -1163,7 +1163,7 @@ valpy_str (PyObject *self) { struct value_print_options opts; - get_user_print_options (&opts); + gdbpy_get_print_options (&opts); opts.deref_ref = 0; string_file stb; -- cgit v1.1