* [PATCH 0/9] Some cleanups and C++-ification of value_print_options
@ 2026-07-04 22:05 Tom Tromey
2026-07-04 22:05 ` [PATCH 1/9] Return value_print_options from get_formatted_print_options Tom Tromey
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: Tom Tromey @ 2026-07-04 22:05 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
It seemed to me that it would be cleaner for some value_print_options
"accessors" to simply return the objects instead. This series makes
this change, and then proceeds to do some other cleanups, primarily
converting most pointer to references.
Regression tested on x86-64 Fedora 40.
Signed-off-by: Tom Tromey <tom@tromey.com>
---
Tom Tromey (9):
Return value_print_options from get_formatted_print_options
Return value_print_options from get_no_prettyformat_print_options
Convert get_user_print_options
Return a const reference from gdbpy_get_print_options
Return value_print_options from varobj_formatted_print_options
Use 'const' with some value_print_options
Don't use 'struct' keyword with value_print_options
Use std::forward in fortran_array_walker
Use references for value_print_options
gdb/ada-lang.c | 11 ++-
gdb/ada-lang.h | 4 +-
gdb/ada-valprint.c | 86 +++++++++---------
gdb/ada-varobj.c | 15 ++--
gdb/auxv.c | 6 +-
gdb/break-catch-exec.c | 4 +-
gdb/break-catch-fork.c | 3 +-
gdb/break-catch-load.c | 3 +-
gdb/break-catch-sig.c | 4 +-
gdb/break-catch-syscall.c | 3 +-
gdb/break-catch-throw.c | 3 +-
gdb/breakpoint.c | 20 ++---
gdb/c-lang.c | 2 +-
gdb/c-lang.h | 6 +-
gdb/c-valprint.c | 58 ++++++------
gdb/c-varobj.c | 6 +-
gdb/char-print.c | 14 +--
gdb/char-print.h | 4 +-
gdb/cli/cli-cmds.c | 5 +-
gdb/compile/compile.c | 9 +-
gdb/cp-valprint.c | 50 +++++------
gdb/d-lang.c | 2 +-
gdb/d-lang.h | 2 +-
gdb/d-valprint.c | 4 +-
gdb/dwarf2/read.c | 7 +-
gdb/eval.c | 3 +-
gdb/extension-priv.h | 2 +-
gdb/extension.c | 2 +-
gdb/extension.h | 2 +-
gdb/f-array-walker.h | 4 +-
gdb/f-lang.c | 2 +-
gdb/f-lang.h | 6 +-
gdb/f-valprint.c | 48 +++++-----
gdb/gdbtypes.h | 2 +-
gdb/gnu-v3-abi.c | 13 ++-
gdb/go-lang.h | 2 +-
gdb/go-valprint.c | 8 +-
gdb/guile/guile-internal.h | 4 +-
gdb/guile/scm-lazy-string.c | 2 +-
gdb/guile/scm-pretty-print.c | 34 +++----
gdb/guile/scm-value.c | 10 +--
gdb/infcmd.c | 21 ++---
gdb/language.c | 12 +--
gdb/language.h | 8 +-
gdb/linux-thread-db.c | 6 +-
gdb/m2-lang.c | 2 +-
gdb/m2-lang.h | 4 +-
gdb/m2-valprint.c | 28 +++---
gdb/mi/mi-cmd-stack.c | 6 +-
gdb/mi/mi-main.c | 28 +++---
gdb/mips-tdep.c | 17 ++--
gdb/p-lang.c | 2 +-
gdb/p-lang.h | 6 +-
gdb/p-valprint.c | 68 +++++++-------
gdb/printcmd.c | 106 +++++++++++-----------
gdb/python/py-framefilter.c | 28 +++---
gdb/python/py-lazy-string.c | 5 +-
gdb/python/py-prettyprint.c | 53 ++++++-----
gdb/python/py-unwind.c | 5 +-
gdb/python/py-value.c | 11 +--
gdb/python/py-varobj.c | 10 +--
gdb/python/python-internal.h | 10 +--
gdb/record-full.c | 7 +-
gdb/riscv-tdep.c | 14 ++-
gdb/rust-lang.c | 44 ++++-----
gdb/rust-lang.h | 12 +--
gdb/skip.c | 3 -
gdb/stack.c | 13 ++-
gdb/tracepoint.c | 6 +-
gdb/typeprint.c | 3 +-
gdb/valprint.c | 206 +++++++++++++++++++++----------------------
gdb/valprint.h | 51 ++++++-----
gdb/value.c | 15 ++--
gdb/value.h | 8 +-
gdb/varobj.c | 33 ++++---
gdb/varobj.h | 4 +-
76 files changed, 617 insertions(+), 713 deletions(-)
---
base-commit: 58b8db1ca4e6021161511cb24b18a48fcf8e5546
change-id: 20260703-print-opts-cleanup-94dec9b5557e
Best regards,
--
Tom Tromey <tom@tromey.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/9] Return value_print_options from get_formatted_print_options
2026-07-04 22:05 [PATCH 0/9] Some cleanups and C++-ification of value_print_options Tom Tromey
@ 2026-07-04 22:05 ` Tom Tromey
2026-07-04 22:05 ` [PATCH 2/9] Return value_print_options from get_no_prettyformat_print_options Tom Tromey
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Tom Tromey @ 2026-07-04 22:05 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
This changes get_formatted_print_options to return the
value_print_options object.
---
gdb/dwarf2/read.c | 5 ++---
gdb/infcmd.c | 4 +---
gdb/mi/mi-main.c | 7 +++----
gdb/mips-tdep.c | 11 +++--------
gdb/printcmd.c | 10 +++-------
gdb/riscv-tdep.c | 3 +--
gdb/valprint.c | 14 +++++++-------
gdb/valprint.h | 7 +++----
gdb/varobj.c | 2 +-
9 files changed, 24 insertions(+), 39 deletions(-)
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 114c608fde3..6f34f187d47 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -5119,8 +5119,6 @@ dwarf2_compute_name (const char *name,
cu->language_defn->printchar (value, type, &buf);
else
{
- struct value_print_options opts;
-
if (baton != NULL)
v = dwarf2_evaluate_loc_desc (type, NULL,
baton->expr (),
@@ -5137,7 +5135,8 @@ dwarf2_compute_name (const char *name,
/* Specify decimal so that we do not depend on
the radix. */
- get_formatted_print_options (&opts, 'd');
+ value_print_options opts
+ = get_formatted_print_options ('d');
opts.raw = true;
value_print (v, &buf, &opts);
release_value (v);
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index bd5dbb02f48..eb7b4efa2a0 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2439,10 +2439,8 @@ default_print_one_register_info (struct ui_file *file,
}
else
{
- struct value_print_options opts;
-
/* Print the register in hex. */
- get_formatted_print_options (&opts, 'x');
+ value_print_options opts = get_formatted_print_options ('x');
opts.deref_ref = true;
common_val_print (val, &format_stream, 0, &opts, current_language);
/* If not a vector register, print it also according to its
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 73c64b82186..200d29309ba 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -1059,7 +1059,6 @@ output_register (const frame_info_ptr &frame, int regnum, int format,
struct ui_out *uiout = current_uiout;
value *val
= value_of_register (regnum, get_next_frame_sentinel_okay (frame));
- struct value_print_options opts;
if (skip_unavailable && !val->entirely_available ())
return;
@@ -1075,7 +1074,7 @@ output_register (const frame_info_ptr &frame, int regnum, int format,
string_file stb;
- get_formatted_print_options (&opts, format);
+ value_print_options opts = get_formatted_print_options (format);
opts.deref_ref = true;
common_val_print (val, &stb, 0, &opts, current_language);
uiout->field_stream ("value", stb);
@@ -1315,7 +1314,6 @@ mi_cmd_data_read_memory (const char *command, const char *const *argv,
{
int col;
int col_byte;
- struct value_print_options print_opts;
ui_out_emit_tuple tuple_emitter (uiout, NULL);
uiout->field_core_addr ("addr", gdbarch, addr + row_byte);
@@ -1323,7 +1321,8 @@ mi_cmd_data_read_memory (const char *command, const char *const *argv,
row_byte); */
{
ui_out_emit_list list_data_emitter (uiout, "data");
- get_formatted_print_options (&print_opts, word_format);
+ value_print_options print_opts
+ = get_formatted_print_options (word_format);
for (col = 0, col_byte = row_byte;
col < nr_cols;
col++, col_byte += word_size)
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index fe0482fe5bf..6532884f69b 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -6340,15 +6340,13 @@ mips_print_fp_register (struct ui_file *file, const frame_info_ptr &frame,
if (register_size (gdbarch, regnum) == 4 || mips2_fp_compat (frame))
{
- struct value_print_options opts;
-
/* 4-byte registers: Print hex and floating. Also print even
numbered registers as doubles. */
mips_read_fp_register_single (frame, regnum, raw_buffer);
flt_str = target_float_to_string (raw_buffer.data (), flt_type,
"%-17.9g");
- get_formatted_print_options (&opts, 'x');
+ value_print_options opts = get_formatted_print_options ('x');
print_scalar_formatted (raw_buffer.data (),
builtin_type (gdbarch)->builtin_uint32,
&opts, 'w', file);
@@ -6366,8 +6364,6 @@ mips_print_fp_register (struct ui_file *file, const frame_info_ptr &frame,
}
else
{
- struct value_print_options opts;
-
/* Eight byte registers: print each one as hex, float and double. */
mips_read_fp_register_single (frame, regnum, raw_buffer);
flt_str = target_float_to_string (raw_buffer.data (), flt_type,
@@ -6377,7 +6373,7 @@ mips_print_fp_register (struct ui_file *file, const frame_info_ptr &frame,
dbl_str = target_float_to_string (raw_buffer.data (), dbl_type,
"%-24.17g");
- get_formatted_print_options (&opts, 'x');
+ value_print_options opts = get_formatted_print_options ('x');
print_scalar_formatted (raw_buffer.data (),
builtin_type (gdbarch)->builtin_uint64,
&opts, 'g', file);
@@ -6392,7 +6388,6 @@ mips_print_register (struct ui_file *file, const frame_info_ptr &frame,
int regnum)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
- struct value_print_options opts;
struct value *val;
if (mips_float_register_p (gdbarch, regnum))
@@ -6414,7 +6409,7 @@ mips_print_register (struct ui_file *file, const frame_info_ptr &frame,
else
gdb_printf (file, ": ");
- get_formatted_print_options (&opts, 'x');
+ value_print_options opts = get_formatted_print_options ('x');
value_print_scalar_formatted (val, &opts, 0, file);
}
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index a337a6b7db9..4c964915a8b 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1101,8 +1101,7 @@ do_examine_next_address (struct format_data fmt)
if (format == 's' || format == 'i')
maxelts = 1;
- value_print_options opts;
- get_formatted_print_options (&opts, format);
+ value_print_options opts = get_formatted_print_options (format);
bool need_to_update_next_address = false;
CORE_ADDR addr_rewound = 0;
@@ -1458,7 +1457,6 @@ output_command (const char *exp, int from_tty)
char format = 0;
struct value *val;
struct format_data fmt;
- struct value_print_options opts;
fmt.size = 0;
fmt.raw = 0;
@@ -1477,7 +1475,7 @@ output_command (const char *exp, int from_tty)
annotate_value_begin (val->type ());
- get_formatted_print_options (&opts, format);
+ value_print_options opts = get_formatted_print_options (format);
opts.raw = fmt.raw;
/* This setting allows large arrays to be printed by limiting the
@@ -2192,8 +2190,6 @@ do_one_display (struct display *d)
}
else
{
- struct value_print_options opts;
-
annotate_display_format ();
if (d->format.format)
@@ -2208,7 +2204,7 @@ do_one_display (struct display *d)
annotate_display_expression ();
- get_formatted_print_options (&opts, d->format.format);
+ value_print_options opts = get_formatted_print_options (d->format.format);
opts.raw = d->format.raw;
try
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 1751d78a5f3..a21796db1f9 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -1199,11 +1199,10 @@ riscv_print_one_register_info (struct gdbarch *gdbarch,
}
else
{
- struct value_print_options opts;
riscv_gdbarch_tdep *tdep = gdbarch_tdep<riscv_gdbarch_tdep> (gdbarch);
/* Print the register in hex. */
- get_formatted_print_options (&opts, 'x');
+ value_print_options opts = get_formatted_print_options ('x');
opts.deref_ref = true;
common_val_print (val, file, 0, &opts, current_language);
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 50a4663ca3b..cf2bc8e135c 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -113,14 +113,14 @@ get_no_prettyformat_print_options (struct value_print_options *opts)
opts->prettyformat = Val_no_prettyformat;
}
-/* Initialize *OPTS to be a copy of the user print options, but using
- FORMAT as the formatting option. */
-void
-get_formatted_print_options (struct value_print_options *opts,
- char format)
+/* See valprint.h. */
+
+value_print_options
+get_formatted_print_options (char format)
{
- *opts = user_print_options;
- opts->format = format;
+ value_print_options opts = user_print_options;
+ opts.format = format;
+ return opts;
}
/* Implement 'show print elements'. */
diff --git a/gdb/valprint.h b/gdb/valprint.h
index 15d0be2ac7a..775ff333646 100644
--- a/gdb/valprint.h
+++ b/gdb/valprint.h
@@ -151,10 +151,9 @@ extern void get_user_print_options (struct value_print_options *opts);
pretty-formatting disabled. */
extern void get_no_prettyformat_print_options (struct value_print_options *);
-/* Initialize *OPTS to be a copy of the user print options, but using
- FORMAT as the formatting option. */
-extern void get_formatted_print_options (struct value_print_options *opts,
- char format);
+/* Return a copy of the user print options, but using FORMAT as the
+ formatting option. */
+extern value_print_options get_formatted_print_options (char format);
extern void maybe_print_array_index (struct type *index_type, LONGEST index,
struct ui_file *stream,
diff --git a/gdb/varobj.c b/gdb/varobj.c
index a55c2c6dd2b..a5caee56707 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -2106,7 +2106,7 @@ void
varobj_formatted_print_options (struct value_print_options *opts,
enum varobj_display_formats format)
{
- get_formatted_print_options (opts, format_code[(int) format]);
+ *opts = get_formatted_print_options (format_code[(int) format]);
opts->deref_ref = false;
opts->raw = !pretty_printing;
}
--
2.49.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/9] Return value_print_options from get_no_prettyformat_print_options
2026-07-04 22:05 [PATCH 0/9] Some cleanups and C++-ification of value_print_options Tom Tromey
2026-07-04 22:05 ` [PATCH 1/9] Return value_print_options from get_formatted_print_options Tom Tromey
@ 2026-07-04 22:05 ` Tom Tromey
2026-07-04 22:05 ` [PATCH 3/9] Convert get_user_print_options Tom Tromey
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Tom Tromey @ 2026-07-04 22:05 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
This changes get_no_prettyformat_print_options to return the
value_print_options object.
---
gdb/cli/cli-cmds.c | 3 +--
gdb/cp-valprint.c | 3 +--
gdb/mi/mi-cmd-stack.c | 4 +---
gdb/mi/mi-main.c | 8 ++------
gdb/stack.c | 4 ++--
gdb/valprint.c | 13 +++++++------
gdb/valprint.h | 6 +++---
7 files changed, 17 insertions(+), 24 deletions(-)
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index f5c85dfc352..3aa5f0038a9 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -2702,8 +2702,7 @@ shell_internal_fn (struct gdbarch *gdbarch,
if (!language->is_string_type_p (type))
error (_("Argument must be a string."));
- value_print_options opts;
- get_no_prettyformat_print_options (&opts);
+ value_print_options opts = get_no_prettyformat_print_options ();
string_file stream;
value_print (val, &stream, &opts);
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 349a0d6bf9e..0558cad87c0 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -779,8 +779,7 @@ test_print_fields (gdbarch *arch)
gdbarch_byte_order (arch), 0xe9);
string_file out;
- struct value_print_options opts;
- get_no_prettyformat_print_options (&opts);
+ value_print_options opts = get_no_prettyformat_print_options ();
cp_print_value_fields(val, &out, 0, &opts, NULL, 0);
SELF_CHECK (out.string () == "{A = false, B = 5, C = true}");
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 280a08d121e..ce58ab15e7f 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -543,9 +543,7 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
{
try
{
- struct value_print_options opts;
-
- get_no_prettyformat_print_options (&opts);
+ value_print_options opts = get_no_prettyformat_print_options ();
opts.deref_ref = true;
if (arg->sym->is_argument ())
opts.raw = fp_opts.print_raw_frame_arguments;
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 200d29309ba..b1c42ddfd24 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -2491,9 +2491,7 @@ print_variable_or_computed (const char *expression, enum print_values values)
uiout->field_stream ("type", stb);
if (mi_simple_type_p (val->type ()))
{
- struct value_print_options opts;
-
- get_no_prettyformat_print_options (&opts);
+ value_print_options opts = get_no_prettyformat_print_options ();
opts.deref_ref = true;
common_val_print (val, &stb, 0, &opts, current_language);
uiout->field_stream ("value", stb);
@@ -2501,9 +2499,7 @@ print_variable_or_computed (const char *expression, enum print_values values)
break;
case PRINT_ALL_VALUES:
{
- struct value_print_options opts;
-
- get_no_prettyformat_print_options (&opts);
+ value_print_options opts = get_no_prettyformat_print_options ();
opts.deref_ref = true;
common_val_print (val, &stb, 0, &opts, current_language);
uiout->field_stream ("value", stb);
diff --git a/gdb/stack.c b/gdb/stack.c
index e084976eabf..5d725803c1e 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -455,7 +455,6 @@ print_frame_arg (const frame_print_options &fp_opts,
try
{
const struct language_defn *language;
- struct value_print_options vp_opts;
/* Avoid value_print because it will deref ref parameters. We
just want to print their addresses. Print ??? for args whose
@@ -472,7 +471,8 @@ print_frame_arg (const frame_print_options &fp_opts,
else
language = current_language;
- get_no_prettyformat_print_options (&vp_opts);
+ value_print_options vp_opts
+ = get_no_prettyformat_print_options ();
vp_opts.deref_ref = true;
vp_opts.raw = fp_opts.print_raw_frame_arguments;
diff --git a/gdb/valprint.c b/gdb/valprint.c
index cf2bc8e135c..0c385f6ad52 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -104,13 +104,14 @@ get_user_print_options (struct value_print_options *opts)
*opts = user_print_options;
}
-/* Initialize *OPTS to be a copy of the user print options, but with
- pretty-formatting disabled. */
-void
-get_no_prettyformat_print_options (struct value_print_options *opts)
+/* See valprint.h. */
+
+value_print_options
+get_no_prettyformat_print_options ()
{
- *opts = user_print_options;
- opts->prettyformat = Val_no_prettyformat;
+ value_print_options opts = user_print_options;
+ opts.prettyformat = Val_no_prettyformat;
+ return opts;
}
/* See valprint.h. */
diff --git a/gdb/valprint.h b/gdb/valprint.h
index 775ff333646..b38af46f344 100644
--- a/gdb/valprint.h
+++ b/gdb/valprint.h
@@ -147,9 +147,9 @@ extern struct value_print_options user_print_options;
/* Initialize *OPTS to be a copy of the user print options. */
extern void get_user_print_options (struct value_print_options *opts);
-/* Initialize *OPTS to be a copy of the user print options, but with
- pretty-formatting disabled. */
-extern void get_no_prettyformat_print_options (struct value_print_options *);
+/* Return a copy of the user print options, but with pretty-formatting
+ disabled. */
+extern value_print_options get_no_prettyformat_print_options ();
/* Return a copy of the user print options, but using FORMAT as the
formatting option. */
--
2.49.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/9] Convert get_user_print_options
2026-07-04 22:05 [PATCH 0/9] Some cleanups and C++-ification of value_print_options Tom Tromey
2026-07-04 22:05 ` [PATCH 1/9] Return value_print_options from get_formatted_print_options Tom Tromey
2026-07-04 22:05 ` [PATCH 2/9] Return value_print_options from get_no_prettyformat_print_options Tom Tromey
@ 2026-07-04 22:05 ` Tom Tromey
2026-07-04 22:05 ` [PATCH 4/9] Return a const reference from gdbpy_get_print_options Tom Tromey
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Tom Tromey @ 2026-07-04 22:05 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
This changes get_user_print_options to return a const reference to the
global user print options. This is maybe slightly more efficient in
some cases, though probably not anywhere that matters.
---
gdb/ada-lang.c | 3 +--
gdb/auxv.c | 4 +---
gdb/break-catch-exec.c | 4 +---
gdb/break-catch-fork.c | 3 +--
gdb/break-catch-load.c | 3 +--
gdb/break-catch-sig.c | 4 +---
gdb/break-catch-syscall.c | 3 +--
gdb/break-catch-throw.c | 3 +--
gdb/breakpoint.c | 18 +++++-------------
gdb/c-varobj.c | 6 ++----
gdb/compile/compile.c | 3 +--
gdb/eval.c | 3 +--
gdb/f-valprint.c | 4 +---
gdb/gnu-v3-abi.c | 9 +++------
gdb/guile/scm-value.c | 6 ++----
gdb/infcmd.c | 9 +++------
gdb/linux-thread-db.c | 4 +---
gdb/mi/mi-main.c | 3 +--
gdb/printcmd.c | 8 +++-----
gdb/python/py-framefilter.c | 14 ++++----------
gdb/python/py-lazy-string.c | 3 +--
gdb/python/py-prettyprint.c | 2 +-
gdb/python/py-unwind.c | 3 +--
gdb/record-full.c | 3 +--
gdb/riscv-tdep.c | 5 ++---
gdb/skip.c | 3 ---
gdb/stack.c | 7 ++-----
gdb/tracepoint.c | 4 +---
gdb/typeprint.c | 3 +--
gdb/valprint.c | 7 -------
gdb/valprint.h | 10 ++++++++--
gdb/value.c | 11 +++--------
gdb/varobj.c | 4 +---
33 files changed, 57 insertions(+), 122 deletions(-)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 35ebd924021..74a35332bee 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12410,9 +12410,8 @@ bool
ada_catchpoint::print_one (const bp_location **last_loc) const
{
struct ui_out *uiout = current_uiout;
- struct value_print_options opts;
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
if (opts.addressprint)
uiout->field_skip ("addr");
diff --git a/gdb/auxv.c b/gdb/auxv.c
index 1a58fd8c844..206406f8175 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -442,9 +442,7 @@ fprint_auxv_entry (struct ui_file *file, const char *name,
break;
case AUXV_FORMAT_STR:
{
- struct value_print_options opts;
-
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
if (opts.addressprint)
gdb_printf (file, ("%s "), paddress (arch, val));
val_print_string (builtin_type (arch)->builtin_char,
diff --git a/gdb/break-catch-exec.c b/gdb/break-catch-exec.c
index 4fbe5e4f067..4e37bca585b 100644
--- a/gdb/break-catch-exec.c
+++ b/gdb/break-catch-exec.c
@@ -111,10 +111,8 @@ exec_catchpoint::print_it (const bpstat *bs) const
bool
exec_catchpoint::print_one (const bp_location **last_loc) const
{
- struct value_print_options opts;
struct ui_out *uiout = current_uiout;
-
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
/* Field 4, the address, is omitted (which makes the columns
not line up too nicely with the headers, but the effect
diff --git a/gdb/break-catch-fork.c b/gdb/break-catch-fork.c
index be00c15adeb..7af329ff7e3 100644
--- a/gdb/break-catch-fork.c
+++ b/gdb/break-catch-fork.c
@@ -137,10 +137,9 @@ fork_catchpoint::print_it (const bpstat *bs) const
bool
fork_catchpoint::print_one (const bp_location **last_loc) const
{
- struct value_print_options opts;
struct ui_out *uiout = current_uiout;
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
/* Field 4, the address, is omitted (which makes the columns not
line up too nicely with the headers, but the effect is relatively
diff --git a/gdb/break-catch-load.c b/gdb/break-catch-load.c
index 30bdd0604a7..5492a56b423 100644
--- a/gdb/break-catch-load.c
+++ b/gdb/break-catch-load.c
@@ -158,10 +158,9 @@ solib_catchpoint::print_it (const bpstat *bs) const
bool
solib_catchpoint::print_one (const bp_location **locs) const
{
- struct value_print_options opts;
struct ui_out *uiout = current_uiout;
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
/* Field 4, the address, is omitted (which makes the columns not
line up too nicely with the headers, but the effect is relatively
readable). */
diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c
index ea85083b6f8..15ff2c5c8ac 100644
--- a/gdb/break-catch-sig.c
+++ b/gdb/break-catch-sig.c
@@ -214,10 +214,8 @@ signal_catchpoint::print_it (const bpstat *bs) const
bool
signal_catchpoint::print_one (const bp_location **last_loc) const
{
- struct value_print_options opts;
struct ui_out *uiout = current_uiout;
-
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
/* Field 4, the address, is omitted (which makes the columns
not line up too nicely with the headers, but the effect
diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c
index 1a0bb931080..a2a68b22d0c 100644
--- a/gdb/break-catch-syscall.c
+++ b/gdb/break-catch-syscall.c
@@ -229,10 +229,9 @@ syscall_catchpoint::print_it (const bpstat *bs) const
bool
syscall_catchpoint::print_one (const bp_location **last_loc) const
{
- struct value_print_options opts;
struct ui_out *uiout = current_uiout;
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
/* Field 4, the address, is omitted (which makes the columns not
line up too nicely with the headers, but the effect is relatively
readable). */
diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c
index 03d8c5f772d..be4ff2a43a0 100644
--- a/gdb/break-catch-throw.c
+++ b/gdb/break-catch-throw.c
@@ -255,10 +255,9 @@ exception_catchpoint::print_it (const bpstat *bs) const
bool
exception_catchpoint::print_one (const bp_location **last_loc) const
{
- struct value_print_options opts;
struct ui_out *uiout = current_uiout;
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
if (opts.addressprint)
uiout->field_skip ("addr");
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index e4df4df04a7..68811ed57da 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -5038,8 +5038,7 @@ watchpoint_value_print (struct value *val, struct ui_file *stream)
fprintf_styled (stream, metadata_style.style (), _("<unreadable>"));
else
{
- struct value_print_options opts;
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
value_print (val, stream, &opts);
}
}
@@ -6591,9 +6590,7 @@ print_one_breakpoint_location (struct breakpoint *b,
struct ui_out *uiout = current_uiout;
bool header_of_multiple = false;
bool part_of_multiple = (loc != NULL);
- struct value_print_options opts;
-
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
gdb_assert (!loc || loc_number != 0);
/* See comment in print_one_breakpoint concerning treatment of
@@ -7081,13 +7078,11 @@ breakpoint_1 (const char *bp_num_list, bool show_internal,
{
const bp_location *last_loc = nullptr;
int nr_printable_breakpoints;
- struct value_print_options opts;
int print_address_bits = 0;
int print_type_col_width = 14;
struct ui_out *uiout = current_uiout;
bool has_disabled_by_cond_location = false;
-
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
/* Compute the number of rows in the table, as well as the size
required for address fields. */
@@ -9653,13 +9648,12 @@ ranged_breakpoint::print_it (const bpstat *bs) const
bool
ranged_breakpoint::print_one (const bp_location **last_loc) const
{
- struct value_print_options opts;
struct ui_out *uiout = current_uiout;
/* Ranged breakpoints have only one location. */
gdb_assert (this->has_single_location ());
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
if (opts.addressprint)
/* We don't print the address range here, it will be printed later
@@ -11840,9 +11834,7 @@ bpstat_remove_bp_location (bpstat *bps, struct breakpoint *bpt)
void
code_breakpoint::say_where () const
{
- struct value_print_options opts;
-
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
/* i18n: cagney/2005-02-11: Below needs to be merged into a
single string. */
diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c
index 9428ce08ae2..5312eccdaca 100644
--- a/gdb/c-varobj.c
+++ b/gdb/c-varobj.c
@@ -558,12 +558,11 @@ cplus_number_of_children (const struct varobj *var)
struct type *type;
int children, dont_know;
int lookup_actual_type = 0;
- struct value_print_options opts;
dont_know = 1;
children = 0;
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
if (!CPLUS_FAKE_CHILD (var))
{
@@ -681,7 +680,6 @@ cplus_describe_child (const struct varobj *parent, int index,
int lookup_actual_type = 0;
const char *parent_expression = NULL;
const struct varobj *var;
- struct value_print_options opts;
if (cname)
*cname = std::string ();
@@ -692,7 +690,7 @@ cplus_describe_child (const struct varobj *parent, int index,
if (cfull_expression)
*cfull_expression = std::string ();
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
var = (CPLUS_FAKE_CHILD (parent)) ? parent->parent : parent;
if (opts.objectprint)
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index 4a027de2625..7a60bd33a64 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -271,11 +271,10 @@ static void
compile_print_command (const char *arg, int from_tty)
{
enum compile_i_scope_types scope = COMPILE_I_PRINT_ADDRESS_SCOPE;
- value_print_options print_opts;
scoped_restore save_async = make_scoped_restore (¤t_ui->async, 0);
- get_user_print_options (&print_opts);
+ value_print_options print_opts = get_user_print_options ();
/* Override global settings with explicit options, if any. */
auto group = make_value_print_options_def_group (&print_opts);
gdb::option::process_options
diff --git a/gdb/eval.c b/gdb/eval.c
index 7e07765c9e6..d5d4963e374 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1250,9 +1250,8 @@ eval_op_structop_ptr (struct type *expect_type, struct expression *exp,
struct type *real_type;
int full, using_enc;
LONGEST top;
- struct value_print_options opts;
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
if (opts.objectprint && arg_type->target_type ()
&& (arg_type->target_type ()->code () == TYPE_CODE_STRUCT))
{
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index 8a383281a6c..f91c585fc0b 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -622,9 +622,7 @@ static void
info_common_command_for_block (const struct block *block, const char *comname,
int *any_printed)
{
- struct value_print_options opts;
-
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
for (struct symbol *sym : block_iterator_range (block))
if (sym->domain () == COMMON_BLOCK_DOMAIN)
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index 35910be0f06..2ca29ef77d3 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -683,9 +683,7 @@ gnuv3_print_method_ptr (const gdb_byte *contents,
}
else
{
- struct value_print_options opts;
-
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
print_address_demangle (&opts, gdbarch, ptr_value, stream, demangle);
}
@@ -872,7 +870,7 @@ compute_vtable_size (vtable_hash_t &offset_hash, struct value *value)
static void
print_one_vtable (struct gdbarch *gdbarch, struct value *value,
int max_voffset,
- struct value_print_options *opts)
+ const value_print_options *opts)
{
int i;
struct type *type = check_typedef (value->type ());
@@ -930,7 +928,6 @@ gnuv3_print_vtable (struct value *value)
struct gdbarch *gdbarch;
struct type *type;
struct value *vtable;
- struct value_print_options opts;
int count;
value = coerce_ref (value);
@@ -941,7 +938,7 @@ gnuv3_print_vtable (struct value *value)
type = check_typedef (value->type ());
}
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
/* Respect 'set print object'. */
if (opts.objectprint)
diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c
index 6eaf486af07..fb739c370ef 100644
--- a/gdb/guile/scm-value.c
+++ b/gdb/guile/scm-value.c
@@ -143,12 +143,11 @@ static int
vlscm_print_value_smob (SCM self, SCM port, scm_print_state *pstate)
{
value_smob *v_smob = (value_smob *) SCM_SMOB_DATA (self);
- struct value_print_options opts;
if (pstate->writingp)
gdbscm_printf (port, "#<%s ", value_smob_name);
- get_user_print_options (&opts);
+ value_print_options opts = get_user_print_options ();
opts.deref_ref = false;
/* pstate->writingp = zero if invoked by display/~A, and nonzero if
@@ -1266,9 +1265,8 @@ gdbscm_value_print (SCM self)
value_smob *v_smob
= vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct value *value = v_smob->value;
- struct value_print_options opts;
- get_user_print_options (&opts);
+ value_print_options opts = get_user_print_options ();
opts.deref_ref = false;
string_file stb;
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index eb7b4efa2a0..90a49eff8be 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1650,9 +1650,7 @@ print_return_value_1 (struct ui_out *uiout, struct return_value_info *rv)
if (finish_print)
{
- struct value_print_options opts;
- get_user_print_options (&opts);
-
+ const value_print_options opts = get_user_print_options ();
string_file stb;
value_print (rv->value, &stb, &opts);
uiout->field_stream ("return-value", stb);
@@ -2419,11 +2417,10 @@ default_print_one_register_info (struct ui_file *file,
if (regtype->code () == TYPE_CODE_FLT
|| regtype->code () == TYPE_CODE_DECFLOAT)
{
- struct value_print_options opts;
const gdb_byte *valaddr = val->contents_for_printing ().data ();
enum bfd_endian byte_order = type_byte_order (regtype);
- get_user_print_options (&opts);
+ value_print_options opts = get_user_print_options ();
opts.deref_ref = true;
common_val_print (val, &format_stream, 0, &opts, current_language);
@@ -2448,7 +2445,7 @@ default_print_one_register_info (struct ui_file *file,
if (print_raw_format && regtype->is_vector () == 0)
{
pad_to_column (format_stream, value_column_2);
- get_user_print_options (&opts);
+ opts = get_user_print_options ();
opts.deref_ref = true;
common_val_print (val, &format_stream, 0, &opts, current_language);
}
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 5e506c4f497..bbeed776f70 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -698,9 +698,7 @@ check_thread_db_callback (const td_thrhandle_t *th, void *arg)
if (tdb_testinfo->log_progress)
{
- struct value_print_options opts;
-
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
LOG (" = ");
value_print (val, gdb_stdlog, &opts);
}
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index b1c42ddfd24..5e5244619af 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -1145,7 +1145,6 @@ mi_cmd_data_evaluate_expression (const char *command, const char *const *argv,
int argc)
{
struct value *val;
- struct value_print_options opts;
struct ui_out *uiout = current_uiout;
if (argc != 1)
@@ -1159,7 +1158,7 @@ mi_cmd_data_evaluate_expression (const char *command, const char *const *argv,
string_file stb;
/* Print the result of the expression evaluation. */
- get_user_print_options (&opts);
+ value_print_options opts = get_user_print_options ();
opts.deref_ref = false;
common_val_print (val, &stb, 0, &opts, current_language);
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 4c964915a8b..9ebe563fed3 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1334,7 +1334,7 @@ static struct value *
process_print_command_args (const char *args, value_print_options *print_opts,
bool voidprint)
{
- get_user_print_options (print_opts);
+ *print_opts = get_user_print_options ();
/* Override global settings with explicit options, if any. */
auto group = make_value_print_options_def_group (print_opts);
gdb::option::process_options
@@ -2378,14 +2378,13 @@ print_variable_value (symbol *var, const frame_info_ptr &frame,
try
{
struct value *val;
- struct value_print_options opts;
/* READ_VAR_VALUE needs a block in order to deal with non-local
references (i.e. to handle nested functions). In this context, we
print variables that are local to this frame, so we can avoid passing
a block to it. */
val = read_var_value (var, NULL, frame);
- get_user_print_options (&opts);
+ value_print_options opts = get_user_print_options ();
opts.deref_ref = true;
common_val_print_checked (val, stream, indent, &opts, language);
}
@@ -2888,8 +2887,7 @@ ui_printf (const char *arg, struct ui_file *stream)
break;
case value_arg:
{
- value_print_options print_opts;
- get_user_print_options (&print_opts);
+ value_print_options print_opts = get_user_print_options ();
if (current_substring[2] == '[')
{
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index f256a26807c..6e3012a3331 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -417,9 +417,7 @@ enumerate_args (PyObject *iter,
int print_args_field,
const frame_info_ptr &frame)
{
- struct value_print_options opts;
-
- get_user_print_options (&opts);
+ value_print_options opts = get_user_print_options ();
opts.raw = raw_frame_args;
if (args_type == CLI_SCALAR_VALUES)
@@ -549,9 +547,7 @@ enumerate_locals (PyObject *iter,
int print_args_field,
const frame_info_ptr &frame)
{
- struct value_print_options opts;
-
- get_user_print_options (&opts);
+ value_print_options opts = get_user_print_options ();
opts.deref_ref = true;
while (true)
@@ -633,7 +629,6 @@ enumerate_locals (PyObject *iter,
static enum ext_lang_bt_status
py_mi_print_variables (PyObject *filter, struct ui_out *out,
- struct value_print_options *opts,
enum ext_lang_frame_args args_type,
const frame_info_ptr &frame,
bool raw_frame_args_p)
@@ -767,7 +762,6 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
CORE_ADDR address = 0;
struct gdbarch *gdbarch = NULL;
frame_info_ptr frame = NULL;
- struct value_print_options opts;
int print_level, print_frame_info, print_args, print_locals;
/* Note that the below default in non-mi mode is the same as the
@@ -786,7 +780,7 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
print_args = (flags & PRINT_ARGS) ? 1 : 0;
print_locals = (flags & PRINT_LOCALS) ? 1 : 0;
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
if (print_frame_info)
{
std::optional<enum print_what> user_frame_info_print_what;
@@ -818,7 +812,7 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
if (print_locals && print_args && ! print_frame_info)
{
bool raw_frame_args = (flags & PRINT_RAW_FRAME_ARGUMENTS) != 0;
- if (py_mi_print_variables (filter, out, &opts, args_type, frame,
+ if (py_mi_print_variables (filter, out, args_type, frame,
raw_frame_args) == EXT_LANG_BT_ERROR)
return EXT_LANG_BT_ERROR;
return EXT_LANG_BT_OK;
diff --git a/gdb/python/py-lazy-string.c b/gdb/python/py-lazy-string.c
index c9d06338b0a..e095bc3fb69 100644
--- a/gdb/python/py-lazy-string.c
+++ b/gdb/python/py-lazy-string.c
@@ -305,8 +305,7 @@ stpy_str (PyObject *self)
{
lazy_string_object *str = (lazy_string_object *) self;
- struct value_print_options opts;
- get_user_print_options (&opts);
+ value_print_options opts = get_user_print_options ();
opts.addressprint = false;
string_file stream;
diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c
index d3faf861fcf..1326aaae476 100644
--- a/gdb/python/py-prettyprint.c
+++ b/gdb/python/py-prettyprint.c
@@ -776,7 +776,7 @@ gdbpy_get_print_options (value_print_options *opts)
if (gdbpy_current_print_options != nullptr)
*opts = *gdbpy_current_print_options;
else
- get_user_print_options (opts);
+ *opts = get_user_print_options ();
}
/* A ValuePrinter is just a "tag", so it has no state other than that
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index 13eced4cecb..ec682c34ebc 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -210,9 +210,8 @@ unwind_infopy_str (PyObject *self)
stb.printf ("Frame ID: %s", unwind_info->frame_id.to_string ().c_str ());
{
const char *sep = "";
- struct value_print_options opts;
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
stb.printf ("\nSaved registers: (");
for (const saved_reg ® : *unwind_info->saved_regs)
{
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 695d9d1622c..c843236e5fe 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -2806,8 +2806,7 @@ maintenance_print_record_instruction (const char *args, int from_tty)
auto to_print = record_full_log.begin () + offset;
gdbarch *arch = current_inferior ()->arch ();
- struct value_print_options opts;
- get_user_print_options (&opts);
+ value_print_options opts = get_user_print_options ();
opts.raw = true;
for (auto &entry : to_print->effects)
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index a21796db1f9..d98d3f33fed 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -1180,11 +1180,10 @@ riscv_print_one_register_info (struct gdbarch *gdbarch,
if (riscv_is_fp_regno_p (regnum))
{
- struct value_print_options opts;
const gdb_byte *valaddr = val->contents_for_printing ().data ();
enum bfd_endian byte_order = type_byte_order (regtype);
- get_user_print_options (&opts);
+ value_print_options opts = get_user_print_options ();
opts.deref_ref = true;
common_val_print (val, file, 0, &opts, current_language);
@@ -1337,7 +1336,7 @@ riscv_print_one_register_info (struct gdbarch *gdbarch,
natural format. */
if (regtype->is_vector () == 0)
{
- get_user_print_options (&opts);
+ opts = get_user_print_options ();
opts.deref_ref = true;
gdb_printf (file, "\t");
common_val_print (val, file, 0, &opts, current_language);
diff --git a/gdb/skip.c b/gdb/skip.c
index 917b084860d..795a573412b 100644
--- a/gdb/skip.c
+++ b/gdb/skip.c
@@ -1035,9 +1035,6 @@ static void
info_skip_command (const char *arg, int from_tty)
{
int num_printable_entries = 0;
- struct value_print_options opts;
-
- get_user_print_options (&opts);
/* Count the number of rows in the table and see if we need space for a
64-bit address anywhere. */
diff --git a/gdb/stack.c b/gdb/stack.c
index 5d725803c1e..4ebecfc36c3 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1081,9 +1081,7 @@ do_print_frame_info (struct ui_out *uiout, const frame_print_options &fp_opts,
sal.line + 1, 0);
else
{
- struct value_print_options opts;
-
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
/* We used to do this earlier, but that is clearly
wrong. This function is used by many different
parts of gdb, including normal_stop in infrun.c,
@@ -1267,7 +1265,6 @@ print_frame (struct ui_out *uiout,
{
struct gdbarch *gdbarch = get_frame_arch (frame);
enum language funlang = language_unknown;
- struct value_print_options opts;
struct symbol *func;
std::optional <CORE_ADDR> pc;
@@ -1288,7 +1285,7 @@ print_frame (struct ui_out *uiout,
uiout->field_fmt_signed (2, ui_left, "level",
frame_relative_level (frame));
}
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
if (opts.addressprint)
if (!sal.symtab
|| frame_show_address (frame, sal)
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 798bb9a552d..18b678afd52 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -523,8 +523,6 @@ teval_pseudocommand (const char *args, int from_tty)
const char *
decode_agent_options (const char *exp, int *trace_string)
{
- struct value_print_options opts;
-
*trace_string = 0;
if (*exp != '/')
@@ -532,7 +530,7 @@ decode_agent_options (const char *exp, int *trace_string)
/* Call this to borrow the print elements default for collection
size. */
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
exp++;
if (*exp == 's')
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index 31a9c1814a3..46dd01199e5 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -357,7 +357,6 @@ whatis_exp (const char *exp, int show)
int full = 0;
LONGEST top = -1;
int using_enc = 0;
- struct value_print_options opts;
struct type_print_options flags = default_ptype_flags;
if (exp)
@@ -457,7 +456,7 @@ whatis_exp (const char *exp, int show)
flags.print_offsets = 0;
}
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
if (val != NULL && opts.objectprint)
{
if (type->is_pointer_or_reference ()
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 0c385f6ad52..4ef50707bef 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -97,13 +97,6 @@ struct value_print_options user_print_options =
PRINT_MAX_DEPTH_DEFAULT, /* max_depth */
};
-/* Initialize *OPTS to be a copy of the user print options. */
-void
-get_user_print_options (struct value_print_options *opts)
-{
- *opts = user_print_options;
-}
-
/* See valprint.h. */
value_print_options
diff --git a/gdb/valprint.h b/gdb/valprint.h
index b38af46f344..e743c39dca5 100644
--- a/gdb/valprint.h
+++ b/gdb/valprint.h
@@ -144,8 +144,14 @@ extern gdb::option::option_def_group make_value_print_options_def_group
code should call get_user_print_options instead. */
extern struct value_print_options user_print_options;
-/* Initialize *OPTS to be a copy of the user print options. */
-extern void get_user_print_options (struct value_print_options *opts);
+/* Accessor for the user print options. */
+
+static inline
+const value_print_options &
+get_user_print_options ()
+{
+ return user_print_options;
+}
/* Return a copy of the user print options, but with pretty-formatting
disabled. */
diff --git a/gdb/value.c b/gdb/value.c
index 1f6d7949d4d..e9c22cbc9da 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1083,10 +1083,8 @@ struct type *
value_actual_type (struct value *value, int resolve_simple_types,
int *real_type_found)
{
- struct value_print_options opts;
struct type *result;
-
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
if (real_type_found)
*real_type_found = 0;
@@ -1786,11 +1784,9 @@ show_values (const char *num_exp, int from_tty)
for (i = num; i < num + 10 && i <= value_history.size (); i++)
{
- struct value_print_options opts;
-
val = access_value_history (i);
gdb_printf (("$%d = "), i);
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
value_print (val, gdb_stdout, &opts);
gdb_printf (("\n"));
}
@@ -2564,9 +2560,8 @@ show_convenience (const char *ignore, int from_tty)
{
struct gdbarch *gdbarch = get_current_arch ();
int varseen = 0;
- struct value_print_options opts;
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
for (auto &pair : internalvars)
{
internalvar &var = pair.second;
diff --git a/gdb/varobj.c b/gdb/varobj.c
index a5caee56707..92a1f5ae578 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -1129,9 +1129,7 @@ update_type_if_necessary (struct varobj *var, struct value *new_value)
{
if (new_value)
{
- struct value_print_options opts;
-
- get_user_print_options (&opts);
+ const value_print_options &opts = get_user_print_options ();
if (opts.objectprint)
{
struct type *new_type = value_actual_type (new_value, 0, 0);
--
2.49.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/9] Return a const reference from gdbpy_get_print_options
2026-07-04 22:05 [PATCH 0/9] Some cleanups and C++-ification of value_print_options Tom Tromey
` (2 preceding siblings ...)
2026-07-04 22:05 ` [PATCH 3/9] Convert get_user_print_options Tom Tromey
@ 2026-07-04 22:05 ` Tom Tromey
2026-07-04 22:05 ` [PATCH 5/9] Return value_print_options from varobj_formatted_print_options Tom Tromey
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Tom Tromey @ 2026-07-04 22:05 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
This changes gdbpy_get_print_options to return a const reference to
the relevant value_print_options.
---
gdb/python/py-prettyprint.c | 11 +++++------
gdb/python/py-value.c | 7 ++-----
gdb/python/python-internal.h | 2 +-
3 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c
index 1326aaae476..a89bf073215 100644
--- a/gdb/python/py-prettyprint.c
+++ b/gdb/python/py-prettyprint.c
@@ -718,8 +718,7 @@ gdbpy_print_options (PyObject *unused1, PyObject *unused2)
if (result == nullptr)
return nullptr;
- value_print_options opts;
- gdbpy_get_print_options (&opts);
+ const value_print_options &opts = gdbpy_get_print_options ();
if (set_boolean (result.get (), "raw",
opts.raw) < 0
@@ -770,13 +769,13 @@ gdbpy_print_options (PyObject *unused1, PyObject *unused2)
/* Helper function that either finds the prevailing print options, or
calls get_user_print_options. */
-void
-gdbpy_get_print_options (value_print_options *opts)
+const value_print_options &
+gdbpy_get_print_options ()
{
if (gdbpy_current_print_options != nullptr)
- *opts = *gdbpy_current_print_options;
+ return *gdbpy_current_print_options;
else
- *opts = get_user_print_options ();
+ return get_user_print_options ();
}
/* A ValuePrinter is just a "tag", so it has no state other than that
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index 5b38110396e..a63af395e2c 100644
--- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c
@@ -690,8 +690,7 @@ valpy_format_string (PyObject *self, PyObject *args, PyObject *kw)
return NULL;
}
- struct value_print_options opts;
- gdbpy_get_print_options (&opts);
+ value_print_options opts = gdbpy_get_print_options ();
opts.deref_ref = false;
/* We need objects for booleans as the "p" flag for bools is new in
@@ -1248,9 +1247,7 @@ valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
static PyObject *
valpy_str (PyObject *self)
{
- struct value_print_options opts;
-
- gdbpy_get_print_options (&opts);
+ value_print_options opts = gdbpy_get_print_options ();
opts.deref_ref = false;
string_file stb;
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 4ca28bb6957..f9899740a5f 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -974,7 +974,7 @@ gdb::unique_xmalloc_ptr<char> gdbpy_get_display_hint (PyObject *printer);
PyObject *gdbpy_default_visualizer (PyObject *self, PyObject *args);
PyObject *gdbpy_print_options (PyObject *self, PyObject *args);
-void gdbpy_get_print_options (value_print_options *opts);
+const value_print_options &gdbpy_get_print_options ();
extern const struct value_print_options *gdbpy_current_print_options;
void bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj);
--
2.49.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 5/9] Return value_print_options from varobj_formatted_print_options
2026-07-04 22:05 [PATCH 0/9] Some cleanups and C++-ification of value_print_options Tom Tromey
` (3 preceding siblings ...)
2026-07-04 22:05 ` [PATCH 4/9] Return a const reference from gdbpy_get_print_options Tom Tromey
@ 2026-07-04 22:05 ` Tom Tromey
2026-07-04 22:05 ` [PATCH 6/9] Use 'const' with some value_print_options Tom Tromey
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Tom Tromey @ 2026-07-04 22:05 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
This changes varobj_formatted_print_options to return the
value_print_options object.
---
gdb/ada-varobj.c | 5 +----
gdb/varobj.c | 19 +++++++++----------
gdb/varobj.h | 4 ++--
3 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/gdb/ada-varobj.c b/gdb/ada-varobj.c
index d526d4c1857..6d4cf166b87 100644
--- a/gdb/ada-varobj.c
+++ b/gdb/ada-varobj.c
@@ -922,10 +922,7 @@ static std::string
ada_value_of_variable (const struct varobj *var,
enum varobj_display_formats format)
{
- struct value_print_options opts;
-
- varobj_formatted_print_options (&opts, format);
-
+ value_print_options opts = varobj_formatted_print_options (format);
return ada_varobj_get_value_of_variable (var->value.get (), var->type,
&opts);
}
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 92a1f5ae578..14eae8d920f 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -642,8 +642,7 @@ varobj_get_iterator (struct varobj *var)
#if HAVE_PYTHON
if (var->dynamic->pretty_printer)
{
- value_print_options opts;
- varobj_formatted_print_options (&opts, var->format);
+ value_print_options opts = varobj_formatted_print_options (var->format);
return py_varobj_get_iterator (var, var->dynamic->pretty_printer, &opts);
}
#endif
@@ -2100,13 +2099,14 @@ my_value_of_variable (struct varobj *var, enum varobj_display_formats format)
return std::string ();
}
-void
-varobj_formatted_print_options (struct value_print_options *opts,
- enum varobj_display_formats format)
+value_print_options
+varobj_formatted_print_options (enum varobj_display_formats format)
{
- *opts = get_formatted_print_options (format_code[(int) format]);
- opts->deref_ref = false;
- opts->raw = !pretty_printing;
+ value_print_options opts
+ = get_formatted_print_options (format_code[(int) format]);
+ opts.deref_ref = false;
+ opts.raw = !pretty_printing;
+ return opts;
}
std::string
@@ -2114,7 +2114,6 @@ varobj_value_get_print_value (struct value *value,
enum varobj_display_formats format,
const struct varobj *var)
{
- struct value_print_options opts;
struct type *type = NULL;
long len = 0;
gdb::unique_xmalloc_ptr<char> encoding;
@@ -2128,7 +2127,7 @@ varobj_value_get_print_value (struct value *value,
string_file stb;
std::string thevalue;
- varobj_formatted_print_options (&opts, format);
+ value_print_options opts = varobj_formatted_print_options (format);
#if HAVE_PYTHON
if (gdb_python_initialized)
diff --git a/gdb/varobj.h b/gdb/varobj.h
index 1fab22d1c9e..57161a31c66 100644
--- a/gdb/varobj.h
+++ b/gdb/varobj.h
@@ -347,8 +347,8 @@ extern std::string
enum varobj_display_formats format,
const struct varobj *var);
-extern void varobj_formatted_print_options (struct value_print_options *opts,
- enum varobj_display_formats format);
+extern value_print_options
+ varobj_formatted_print_options (enum varobj_display_formats format);
extern void varobj_restrict_range (const std::vector<varobj *> &children,
int *from, int *to);
--
2.49.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 6/9] Use 'const' with some value_print_options
2026-07-04 22:05 [PATCH 0/9] Some cleanups and C++-ification of value_print_options Tom Tromey
` (4 preceding siblings ...)
2026-07-04 22:05 ` [PATCH 5/9] Return value_print_options from varobj_formatted_print_options Tom Tromey
@ 2026-07-04 22:05 ` Tom Tromey
2026-07-04 22:05 ` [PATCH 7/9] Don't use 'struct' keyword with value_print_options Tom Tromey
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Tom Tromey @ 2026-07-04 22:05 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
I found one spot using value_print_options where 'const' would be
appropriate.
---
gdb/ada-varobj.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gdb/ada-varobj.c b/gdb/ada-varobj.c
index 6d4cf166b87..623df0f01ed 100644
--- a/gdb/ada-varobj.c
+++ b/gdb/ada-varobj.c
@@ -807,7 +807,7 @@ ada_varobj_get_type_of_child (struct value *parent_value,
static std::string
ada_varobj_get_value_image (struct value *value,
- struct value_print_options *opts)
+ const value_print_options *opts)
{
string_file buffer;
@@ -826,7 +826,7 @@ ada_varobj_get_value_image (struct value *value,
static std::string
ada_varobj_get_value_of_array_variable (struct value *value,
struct type *type,
- struct value_print_options *opts)
+ const value_print_options *opts)
{
const int numchild = ada_varobj_get_array_number_of_children (value, type);
@@ -851,7 +851,7 @@ ada_varobj_get_value_of_array_variable (struct value *value,
static std::string
ada_varobj_get_value_of_variable (struct value *value,
struct type *type,
- struct value_print_options *opts)
+ const value_print_options *opts)
{
ada_varobj_decode_var (&value, &type);
--
2.49.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 7/9] Don't use 'struct' keyword with value_print_options
2026-07-04 22:05 [PATCH 0/9] Some cleanups and C++-ification of value_print_options Tom Tromey
` (5 preceding siblings ...)
2026-07-04 22:05 ` [PATCH 6/9] Use 'const' with some value_print_options Tom Tromey
@ 2026-07-04 22:05 ` Tom Tromey
2026-07-04 22:05 ` [PATCH 8/9] Use std::forward in fortran_array_walker Tom Tromey
2026-07-04 22:05 ` [PATCH 9/9] Use references for value_print_options Tom Tromey
8 siblings, 0 replies; 10+ messages in thread
From: Tom Tromey @ 2026-07-04 22:05 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
This changes the uses of value_print_options to drop the 'struct'
keyword. There's no need for this any more.
---
gdb/ada-lang.c | 6 ++--
gdb/ada-lang.h | 4 +--
gdb/ada-valprint.c | 40 +++++++++++++--------------
gdb/c-lang.c | 2 +-
gdb/c-lang.h | 6 ++--
gdb/c-valprint.c | 18 ++++++------
gdb/char-print.c | 4 +--
gdb/char-print.h | 4 +--
gdb/cp-valprint.c | 14 +++++-----
gdb/d-lang.c | 2 +-
gdb/d-lang.h | 2 +-
gdb/d-valprint.c | 4 +--
gdb/extension-priv.h | 2 +-
gdb/extension.c | 2 +-
gdb/extension.h | 2 +-
gdb/f-lang.h | 4 +--
gdb/f-valprint.c | 10 +++----
gdb/gdbtypes.h | 2 +-
gdb/go-lang.h | 2 +-
gdb/go-valprint.c | 4 +--
gdb/guile/guile-internal.h | 4 +--
gdb/guile/scm-lazy-string.c | 2 +-
gdb/guile/scm-pretty-print.c | 14 +++++-----
gdb/language.c | 10 +++----
gdb/language.h | 6 ++--
gdb/m2-lang.c | 2 +-
gdb/m2-lang.h | 4 +--
gdb/m2-valprint.c | 14 +++++-----
gdb/p-lang.c | 2 +-
gdb/p-lang.h | 6 ++--
gdb/p-valprint.c | 24 ++++++++--------
gdb/printcmd.c | 10 +++----
gdb/python/py-framefilter.c | 4 +--
gdb/python/py-prettyprint.c | 16 +++++------
gdb/python/python-internal.h | 4 +--
gdb/rust-lang.c | 18 ++++++------
gdb/rust-lang.h | 12 ++++----
gdb/valprint.c | 66 ++++++++++++++++++++++----------------------
gdb/valprint.h | 22 +++++++--------
gdb/value.h | 8 +++---
40 files changed, 191 insertions(+), 191 deletions(-)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 74a35332bee..2bb6cf7f9ff 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -13810,7 +13810,7 @@ class ada_language : public language_defn
/* See language.h. */
void value_print (struct value *val, struct ui_file *stream,
- const struct value_print_options *options) const override
+ const value_print_options *options) const override
{
return ada_value_print (val, stream, options);
}
@@ -13819,7 +13819,7 @@ class ada_language : public language_defn
void value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const override
+ const value_print_options *options) const override
{
return ada_value_print_inner (val, stream, recurse, options);
}
@@ -13890,7 +13890,7 @@ class ada_language : public language_defn
void printstr (struct ui_file *stream, struct type *elttype,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
- const struct value_print_options *options) const override
+ const value_print_options *options) const override
{
/* ada_printstr doesn't handle UTF-8 too well, but we want this
for lazy-string printing. Defer this case to the generic
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index cd2fce73d61..882963baea4 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -165,10 +165,10 @@ extern void ada_print_typedef (struct type *type, struct symbol *new_symbol,
/* Implement la_value_print_inner for Ada. */
extern void ada_value_print_inner (struct value *, struct ui_file *, int,
- const struct value_print_options *);
+ const value_print_options *);
extern void ada_value_print (struct value *, struct ui_file *,
- const struct value_print_options *);
+ const value_print_options *);
/* Defined in ada-lang.c */
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index 65330d5e983..8eeccf1d589 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -32,7 +32,7 @@
static bool print_field_values (struct value *, struct value *,
struct ui_file *, int,
- const struct value_print_options *,
+ const value_print_options *,
bool, const struct language_defn *);
\f
@@ -43,7 +43,7 @@ static bool print_field_values (struct value *, struct value *,
static void
print_optional_low_bound (struct ui_file *stream, struct type *type,
- const struct value_print_options *options)
+ const value_print_options *options)
{
struct type *index_type;
LONGEST low_bound;
@@ -109,7 +109,7 @@ static void
val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
int offset, struct ui_file *stream,
int recurse,
- const struct value_print_options *options)
+ const value_print_options *options)
{
unsigned int i;
unsigned int things_printed = 0;
@@ -204,7 +204,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
if (i - i0 > options->repeat_count_threshold)
{
- struct value_print_options opts = *options;
+ value_print_options opts = *options;
opts.deref_ref = false;
common_val_print (v0, stream, recurse + 1, &opts, current_language);
@@ -217,7 +217,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
else
{
int j;
- struct value_print_options opts = *options;
+ value_print_options opts = *options;
opts.deref_ref = false;
for (j = i0; j < i; j += 1)
@@ -398,7 +398,7 @@ static bool
print_variant_part (struct value *value, int field_num,
struct value *outer_value,
struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
bool comma_needed,
const struct language_defn *language)
{
@@ -432,7 +432,7 @@ print_variant_part (struct value *value, int field_num,
static bool
print_field_values (struct value *value, struct value *outer_value,
struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
bool comma_needed,
const struct language_defn *language)
{
@@ -500,7 +500,7 @@ print_field_values (struct value *value, struct value *outer_value,
struct value *v;
int bit_pos = type->field (i).loc_bitpos ();
int bit_size = type->field (i).bitsize ();
- struct value_print_options opts;
+ value_print_options opts;
v = ada_value_primitive_packed_val
(value, nullptr,
@@ -514,7 +514,7 @@ print_field_values (struct value *value, struct value *outer_value,
}
else
{
- struct value_print_options opts = *options;
+ value_print_options opts = *options;
opts.deref_ref = false;
@@ -534,7 +534,7 @@ static void
ada_val_print_string (struct type *type, const gdb_byte *valaddr,
int offset_aligned,
struct ui_file *stream, int recurse,
- const struct value_print_options *options)
+ const value_print_options *options)
{
enum bfd_endian byte_order = type_byte_order (type);
struct type *elttype = type->target_type ();
@@ -578,7 +578,7 @@ ada_val_print_string (struct type *type, const gdb_byte *valaddr,
static void
ada_value_print_ptr (struct value *val,
struct ui_file *stream, int recurse,
- const struct value_print_options *options)
+ const value_print_options *options)
{
if (!options->format
&& val->type ()->target_type ()->code () == TYPE_CODE_INT
@@ -605,7 +605,7 @@ ada_value_print_ptr (struct value *val,
static void
ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options)
+ const value_print_options *options)
{
struct type *type = ada_check_typedef (val->type ());
const gdb_byte *valaddr = val->contents_for_printing ().data ();
@@ -632,7 +632,7 @@ ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
if (format)
{
- struct value_print_options opts = *options;
+ value_print_options opts = *options;
opts.format = format;
value_print_scalar_formatted (val, &opts, 0, stream);
@@ -676,7 +676,7 @@ ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
static void
ada_val_print_enum (struct value *value, struct ui_file *stream, int recurse,
- const struct value_print_options *options)
+ const value_print_options *options)
{
LONGEST val;
@@ -714,7 +714,7 @@ static void
ada_val_print_struct_union (struct value *value,
struct ui_file *stream,
int recurse,
- const struct value_print_options *options)
+ const value_print_options *options)
{
gdb_printf (stream, "(");
@@ -734,7 +734,7 @@ ada_val_print_struct_union (struct value *value,
static void
ada_value_print_array (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options)
+ const value_print_options *options)
{
struct type *type = ada_check_typedef (val->type ());
@@ -775,7 +775,7 @@ ada_val_print_ref (struct type *type, const gdb_byte *valaddr,
int offset, int offset_aligned, CORE_ADDR address,
struct ui_file *stream, int recurse,
struct value *original_value,
- const struct value_print_options *options)
+ const value_print_options *options)
{
/* For references, the debugger is expected to print the value as
an address if DEREF_REF is null. But printing an address in place
@@ -830,7 +830,7 @@ ada_val_print_ref (struct type *type, const gdb_byte *valaddr,
void
ada_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options)
+ const value_print_options *options)
{
struct type *type = ada_check_typedef (val->type ());
@@ -920,11 +920,11 @@ ada_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
void
ada_value_print (struct value *val0, struct ui_file *stream,
- const struct value_print_options *options)
+ const value_print_options *options)
{
struct value *val = ada_to_fixed_value (val0);
struct type *type = ada_check_typedef (val->type ());
- struct value_print_options opts;
+ value_print_options opts;
/* If it is a pointer, indicate what it points to; but not for
"void *" pointers. */
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index fdb5be7b2b7..fe7edd53366 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -174,7 +174,7 @@ void
language_defn::printstr (struct ui_file *stream, struct type *type,
const gdb_byte *string, unsigned int length,
const char *user_encoding, int force_ellipses,
- const struct value_print_options *options) const
+ const value_print_options *options) const
{
c_string_type str_type;
const char *type_encoding;
diff --git a/gdb/c-lang.h b/gdb/c-lang.h
index 7d9eaf8571b..14a74b30af8 100644
--- a/gdb/c-lang.h
+++ b/gdb/c-lang.h
@@ -84,10 +84,10 @@ extern void c_print_typedef (struct type *,
/* Implement la_value_print_inner for the C family of languages. */
extern void c_value_print_inner (struct value *, struct ui_file *, int,
- const struct value_print_options *);
+ const value_print_options *);
extern void c_value_print (struct value *, struct ui_file *,
- const struct value_print_options *);
+ const value_print_options *);
/* These are in c-lang.c: */
@@ -107,7 +107,7 @@ extern void cp_print_class_memberptr (struct value *, struct ui_file *);
extern void cp_print_value_fields (struct value *,
struct ui_file *, int,
- const struct value_print_options *,
+ const value_print_options *,
struct type **, int);
/* gcc-2.6 or later (when using -fvtable-thunks)
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 9f9f61ea2e0..48087d2d7f7 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -142,7 +142,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
struct type *unresolved_elttype,
const gdb_byte *valaddr, int embedded_offset,
CORE_ADDR address, struct ui_file *stream, int recurse,
- const struct value_print_options *options)
+ const value_print_options *options)
{
int want_space = 0;
struct gdbarch *gdbarch = type->arch ();
@@ -234,7 +234,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
static void
c_value_print_array (struct value *val,
struct ui_file *stream, int recurse,
- const struct value_print_options *options)
+ const value_print_options *options)
{
struct type *type = check_typedef (val->type ());
CORE_ADDR address = val->address ();
@@ -326,7 +326,7 @@ c_value_print_array (struct value *val,
static void
c_value_print_ptr (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options)
+ const value_print_options *options)
{
if (options->format && options->format != 's')
{
@@ -362,7 +362,7 @@ c_value_print_ptr (struct value *val, struct ui_file *stream, int recurse,
static void
c_value_print_struct (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options)
+ const value_print_options *options)
{
struct type *type = check_typedef (val->type ());
@@ -389,11 +389,11 @@ c_value_print_struct (struct value *val, struct ui_file *stream, int recurse,
static void
c_value_print_int (struct value *val, struct ui_file *stream,
- const struct value_print_options *options)
+ const value_print_options *options)
{
if (options->format || options->output_format)
{
- struct value_print_options opts = *options;
+ value_print_options opts = *options;
opts.format = (options->format ? options->format
: options->output_format);
@@ -421,7 +421,7 @@ c_value_print_int (struct value *val, struct ui_file *stream,
void
c_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options)
+ const value_print_options *options)
{
struct type *type = val->type ();
@@ -471,12 +471,12 @@ c_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
\f
void
c_value_print (struct value *val, struct ui_file *stream,
- const struct value_print_options *options)
+ const value_print_options *options)
{
struct type *type, *real_type;
int full, using_enc;
LONGEST top;
- struct value_print_options opts = *options;
+ value_print_options opts = *options;
opts.deref_ref = true;
diff --git a/gdb/char-print.c b/gdb/char-print.c
index 7c1ba85bbc1..8eba856c5bb 100644
--- a/gdb/char-print.c
+++ b/gdb/char-print.c
@@ -323,7 +323,7 @@ wchar_printer::count_next_character (wchar_iterator *iter,
void
wchar_printer::print_converted_chars_to_obstack
(const std::vector<converted_character> &chars,
- const struct value_print_options *options,
+ const value_print_options *options,
int *finished)
{
unsigned int idx, num_elements;
@@ -479,7 +479,7 @@ void
wchar_printer::print (struct ui_file *stream, const gdb_byte *string,
unsigned int length, int force_ellipses,
int c_style_terminator,
- const struct value_print_options *options)
+ const value_print_options *options)
{
unsigned int i;
int finished = 0;
diff --git a/gdb/char-print.h b/gdb/char-print.h
index bbadb968c80..44181a07de9 100644
--- a/gdb/char-print.h
+++ b/gdb/char-print.h
@@ -106,7 +106,7 @@ class wchar_printer
void print (struct ui_file *stream, const gdb_byte *string,
unsigned int length, int force_ellipses,
int c_style_terminator,
- const struct value_print_options *options);
+ const value_print_options *options);
protected:
@@ -165,7 +165,7 @@ class wchar_printer
elements in CHARS. */
void print_converted_chars_to_obstack
(const std::vector<converted_character> &chars,
- const struct value_print_options *options,
+ const value_print_options *options,
int *finished);
private:
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 0558cad87c0..83719b9dd6c 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -48,10 +48,10 @@ static struct obstack dont_print_stat_array_obstack;
static void cp_print_static_field (struct type *, struct value *,
struct ui_file *, int,
- const struct value_print_options *);
+ const value_print_options *);
static void cp_print_value (struct value *, struct ui_file *,
- int, const struct value_print_options *,
+ int, const value_print_options *,
struct type **);
@@ -122,7 +122,7 @@ cp_is_vtbl_member (struct type *type)
void
cp_print_value_fields (struct value *val, struct ui_file *stream,
- int recurse, const struct value_print_options *options,
+ int recurse, const value_print_options *options,
struct type **dont_print_vb,
int dont_print_statmem)
{
@@ -389,7 +389,7 @@ static void
cp_print_value_fields_pp (struct value *val,
struct ui_file *stream,
int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
struct type **dont_print_vb,
int dont_print_statmem)
{
@@ -413,7 +413,7 @@ cp_print_value_fields_pp (struct value *val,
static void
cp_print_value (struct value *val, struct ui_file *stream,
- int recurse, const struct value_print_options *options,
+ int recurse, const value_print_options *options,
struct type **dont_print_vb)
{
struct type *type = check_typedef (val->type ());
@@ -562,9 +562,9 @@ cp_print_static_field (struct type *type,
struct value *val,
struct ui_file *stream,
int recurse,
- const struct value_print_options *options)
+ const value_print_options *options)
{
- struct value_print_options opts;
+ value_print_options opts;
if (val->entirely_optimized_out ())
{
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index 0a779a7b7c0..f6ebf49fc19 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -160,7 +160,7 @@ class d_language : public language_defn
void value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const override
+ const value_print_options *options) const override
{
return d_value_print_inner (val, stream, recurse, options);
}
diff --git a/gdb/d-lang.h b/gdb/d-lang.h
index 25de21da465..57a4d5bfbac 100644
--- a/gdb/d-lang.h
+++ b/gdb/d-lang.h
@@ -82,6 +82,6 @@ extern struct block_symbol d_lookup_nested_symbol (struct type *, const char *,
extern void d_value_print_inner (struct value *val,
struct ui_file *stream, int recurse,
- const struct value_print_options *options);
+ const value_print_options *options);
#endif /* GDB_D_LANG_H */
diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c
index 6e5757192da..493c043a7e2 100644
--- a/gdb/d-valprint.c
+++ b/gdb/d-valprint.c
@@ -31,7 +31,7 @@ dynamic_array_type (struct type *type,
LONGEST embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
struct value *val,
- const struct value_print_options *options)
+ const value_print_options *options)
{
if (type->num_fields () == 2
&& type->field (0).type ()->code () == TYPE_CODE_INT
@@ -71,7 +71,7 @@ dynamic_array_type (struct type *type,
void
d_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options)
+ const value_print_options *options)
{
int ret;
diff --git a/gdb/extension-priv.h b/gdb/extension-priv.h
index 4ef87415413..24f9e79a9e5 100644
--- a/gdb/extension-priv.h
+++ b/gdb/extension-priv.h
@@ -165,7 +165,7 @@ struct extension_language_ops
enum ext_lang_rc (*apply_val_pretty_printer)
(const struct extension_language_defn *,
struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct language_defn *language);
/* GDB access to the "frame filter" feature.
diff --git a/gdb/extension.c b/gdb/extension.c
index d8ef8123ab5..d82efa88a50 100644
--- a/gdb/extension.c
+++ b/gdb/extension.c
@@ -468,7 +468,7 @@ ext_lang_type_printers::~ext_lang_type_printers ()
int
apply_ext_lang_val_pretty_printer (struct value *val,
struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct language_defn *language)
{
for (const struct extension_language_defn *extlang : extension_languages)
diff --git a/gdb/extension.h b/gdb/extension.h
index b7bbf2a502d..ab5c7b2d167 100644
--- a/gdb/extension.h
+++ b/gdb/extension.h
@@ -296,7 +296,7 @@ extern gdb::unique_xmalloc_ptr<char> apply_ext_lang_type_printers
extern int apply_ext_lang_val_pretty_printer
(struct value *value, struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct language_defn *language);
extern enum ext_lang_bt_status apply_ext_lang_frame_filter
diff --git a/gdb/f-lang.h b/gdb/f-lang.h
index 7f43957c887..cb48eb3fde0 100644
--- a/gdb/f-lang.h
+++ b/gdb/f-lang.h
@@ -137,7 +137,7 @@ class f_language : public language_defn
void value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const override;
+ const value_print_options *options) const override;
/* See language.h. */
@@ -170,7 +170,7 @@ class f_language : public language_defn
void printstr (struct ui_file *stream, struct type *elttype,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
- const struct value_print_options *options) const override
+ const value_print_options *options) const override
{
if (elttype->length () == 4)
gdb_puts ("4_", stream);
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index f91c585fc0b..bff2acf6056 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -121,7 +121,7 @@ class fortran_array_printer_impl : public fortran_array_walker_base_impl
struct value *val,
struct ui_file *stream,
int recurse,
- const struct value_print_options *options)
+ const value_print_options *options)
: m_elts (0),
m_val (val),
m_stream (stream),
@@ -401,7 +401,7 @@ class fortran_array_printer_impl : public fortran_array_walker_base_impl
/* The print control options. Gives us the maximum number of elements to
print, and is passed through to each element that we print. */
- const struct value_print_options *m_options = nullptr;
+ const value_print_options *m_options = nullptr;
/* The number of the current dimension being handled. */
LONGEST m_dimension;
@@ -424,7 +424,7 @@ static void
fortran_print_array (struct type *type, CORE_ADDR address,
struct ui_file *stream, int recurse,
const struct value *val,
- const struct value_print_options *options)
+ const value_print_options *options)
{
fortran_array_walker<fortran_array_printer_impl> p
(type, address, (struct value *) val, stream, recurse, options);
@@ -451,7 +451,7 @@ static const struct generic_val_print_decorations f_decorations =
void
f_language::value_print_inner (struct value *val, struct ui_file *stream,
int recurse,
- const struct value_print_options *options) const
+ const value_print_options *options) const
{
struct type *type = check_typedef (val->type ());
struct gdbarch *gdbarch = type->arch ();
@@ -583,7 +583,7 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
case TYPE_CODE_BOOL:
if (options->format || options->output_format)
{
- struct value_print_options opts = *options;
+ value_print_options opts = *options;
opts.format = (options->format ? options->format
: options->output_format);
value_print_scalar_formatted (val, &opts, 0, stream);
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 572bf6d3d6f..7186362e026 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -2793,7 +2793,7 @@ extern void recursive_dump_type (struct type *, int);
/* printcmd.c */
extern void print_scalar_formatted (const gdb_byte *, struct type *,
- const struct value_print_options *,
+ const value_print_options *,
int, struct ui_file *);
extern int can_dereference (struct type *);
diff --git a/gdb/go-lang.h b/gdb/go-lang.h
index 333cf74d161..c2be398df52 100644
--- a/gdb/go-lang.h
+++ b/gdb/go-lang.h
@@ -123,7 +123,7 @@ class go_language : public language_defn
void value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const override;
+ const value_print_options *options) const override;
/* See language.h. */
diff --git a/gdb/go-valprint.c b/gdb/go-valprint.c
index 877232e1ad5..0ee6571bc75 100644
--- a/gdb/go-valprint.c
+++ b/gdb/go-valprint.c
@@ -40,7 +40,7 @@ print_go_string (struct type *type,
LONGEST embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
struct value *val,
- const struct value_print_options *options)
+ const value_print_options *options)
{
struct gdbarch *gdbarch = type->arch ();
struct type *elt_ptr_type = type->field (0).type ();
@@ -88,7 +88,7 @@ print_go_string (struct type *type,
void
go_language::value_print_inner (struct value *val, struct ui_file *stream,
int recurse,
- const struct value_print_options *options) const
+ const value_print_options *options) const
{
struct type *type = check_typedef (val->type ());
diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h
index a86ad48eb12..7d406890e62 100644
--- a/gdb/guile/guile-internal.h
+++ b/gdb/guile/guile-internal.h
@@ -500,7 +500,7 @@ extern struct value *lsscm_safe_lazy_string_to_value (SCM string,
extern void lsscm_val_print_lazy_string
(SCM string, struct ui_file *stream,
- const struct value_print_options *options);
+ const value_print_options *options);
/* scm-objfile.c */
@@ -612,7 +612,7 @@ extern enum ext_lang_rc gdbscm_apply_val_pretty_printer
(const struct extension_language_defn *,
struct value *val,
struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct language_defn *language);
extern int gdbscm_breakpoint_has_cond (const struct extension_language_defn *,
diff --git a/gdb/guile/scm-lazy-string.c b/gdb/guile/scm-lazy-string.c
index a13567eaa32..53324172617 100644
--- a/gdb/guile/scm-lazy-string.c
+++ b/gdb/guile/scm-lazy-string.c
@@ -349,7 +349,7 @@ lsscm_safe_lazy_string_to_value (SCM string, int arg_pos,
void
lsscm_val_print_lazy_string (SCM string, struct ui_file *stream,
- const struct value_print_options *options)
+ const value_print_options *options)
{
lazy_string_smob *ls_smob;
struct type *elt_type;
diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c
index 59825e32998..3bf994a7bdf 100644
--- a/gdb/guile/scm-pretty-print.c
+++ b/gdb/guile/scm-pretty-print.c
@@ -645,7 +645,7 @@ ppscm_print_exception_unless_memory_error (SCM exception,
static enum guile_string_repr_result
ppscm_print_string_repr (SCM printer, enum display_hint hint,
struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
struct gdbarch *gdbarch,
const struct language_defn *language)
{
@@ -661,7 +661,7 @@ ppscm_print_string_repr (SCM printer, enum display_hint hint,
}
else if (scm_is_eq (str_scm, SCM_BOOL_T))
{
- struct value_print_options opts = *options;
+ value_print_options opts = *options;
gdb_assert (replacement != NULL);
opts.addressprint = false;
@@ -700,7 +700,7 @@ ppscm_print_string_repr (SCM printer, enum display_hint hint,
}
else if (lsscm_is_lazy_string (str_scm))
{
- struct value_print_options local_opts = *options;
+ value_print_options local_opts = *options;
local_opts.addressprint = false;
lsscm_val_print_lazy_string (str_scm, stream, &local_opts);
@@ -725,7 +725,7 @@ ppscm_print_string_repr (SCM printer, enum display_hint hint,
static void
ppscm_print_children (SCM printer, enum display_hint hint,
struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
struct gdbarch *gdbarch,
const struct language_defn *language,
int printed_nothing)
@@ -885,7 +885,7 @@ ppscm_print_children (SCM printer, enum display_hint hint,
if (lsscm_is_lazy_string (v_scm))
{
- struct value_print_options local_opts = *options;
+ value_print_options local_opts = *options;
local_opts.addressprint = false;
lsscm_val_print_lazy_string (v_scm, stream, &local_opts);
@@ -914,7 +914,7 @@ ppscm_print_children (SCM printer, enum display_hint hint,
/* When printing the key of a map we allow one additional
level of depth. This means the key will print before the
value does. */
- struct value_print_options opt = *options;
+ value_print_options opt = *options;
if (is_map && i % 2 == 0
&& opt.max_depth != -1
&& opt.max_depth < INT_MAX)
@@ -957,7 +957,7 @@ enum ext_lang_rc
gdbscm_apply_val_pretty_printer (const struct extension_language_defn *extlang,
struct value *value,
struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct language_defn *language)
{
struct type *type = value->type ();
diff --git a/gdb/language.c b/gdb/language.c
index 3e3be66a676..25d57af363b 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -635,7 +635,7 @@ language_defn::watch_location_expression (struct type *type,
void
language_defn::value_print (struct value *val, struct ui_file *stream,
- const struct value_print_options *options) const
+ const value_print_options *options) const
{
return c_value_print (val, stream, options);
}
@@ -653,7 +653,7 @@ language_defn::parser (struct parser_state *ps) const
void
language_defn::value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const
+ const value_print_options *options) const
{
return c_value_print_inner (val, stream, recurse, options);
}
@@ -774,7 +774,7 @@ class unknown_language : public language_defn
/* See language.h. */
void value_print (struct value *val, struct ui_file *stream,
- const struct value_print_options *options) const override
+ const value_print_options *options) const override
{
error (_("value printing not implemented for language \"%s\""),
natural_name ());
@@ -784,7 +784,7 @@ class unknown_language : public language_defn
void value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const override
+ const value_print_options *options) const override
{
error (_("inner value printing not implemented for language \"%s\""),
natural_name ());
@@ -812,7 +812,7 @@ class unknown_language : public language_defn
void printstr (struct ui_file *stream, struct type *elttype,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
- const struct value_print_options *options) const override
+ const value_print_options *options) const override
{
error (_("print string not implemented for language \"%s\""),
natural_name ());
diff --git a/gdb/language.h b/gdb/language.h
index 75154d9c591..3330151ed36 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -499,13 +499,13 @@ struct language_defn
/* Print a top-level value using syntax appropriate for this language. */
virtual void value_print (struct value *val, struct ui_file *stream,
- const struct value_print_options *options) const;
+ const value_print_options *options) const;
/* Print a value using syntax appropriate for this language. RECURSE is
the recursion depth. It is zero-based. */
virtual void value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const;
+ const value_print_options *options) const;
/* Parser function. */
@@ -522,7 +522,7 @@ struct language_defn
virtual void printstr (struct ui_file *stream, struct type *elttype,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
- const struct value_print_options *options) const;
+ const value_print_options *options) const;
/* Print a typedef using syntax appropriate for this language.
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index de8edacbdaf..0fc84e5d4db 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -179,7 +179,7 @@ void
m2_language::printstr (struct ui_file *stream, struct type *elttype,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
- const struct value_print_options *options) const
+ const value_print_options *options) const
{
m2_wchar_printer printer (elttype, '"', encoding);
printer.print (stream, string, length, force_ellipses, 0, options);
diff --git a/gdb/m2-lang.h b/gdb/m2-lang.h
index 3492b4cd4fe..cf082a07e9b 100644
--- a/gdb/m2-lang.h
+++ b/gdb/m2-lang.h
@@ -84,7 +84,7 @@ class m2_language : public language_defn
void value_print_inner (struct value *val, struct ui_file *stream,
int recurse,
- const struct value_print_options *options) const override;
+ const value_print_options *options) const override;
/* See language.h. */
@@ -100,7 +100,7 @@ class m2_language : public language_defn
void printstr (struct ui_file *stream, struct type *elttype,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
- const struct value_print_options *options) const override;
+ const value_print_options *options) const override;
/* See language.h. */
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index eb2be9d33a8..6bad4c95c08 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -31,12 +31,12 @@
static int print_unpacked_pointer (struct type *type,
CORE_ADDR address, CORE_ADDR addr,
- const struct value_print_options *options,
+ const value_print_options *options,
struct ui_file *stream);
static void
m2_print_array_contents (struct value *val,
struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
int len);
@@ -157,7 +157,7 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
static void
m2_print_unbounded_array (struct value *value,
struct ui_file *stream, int recurse,
- const struct value_print_options *options)
+ const value_print_options *options)
{
CORE_ADDR addr;
LONGEST len;
@@ -182,7 +182,7 @@ m2_print_unbounded_array (struct value *value,
static int
print_unpacked_pointer (struct type *type,
CORE_ADDR address, CORE_ADDR addr,
- const struct value_print_options *options,
+ const value_print_options *options,
struct ui_file *stream)
{
struct gdbarch *gdbarch = type->arch ();
@@ -226,7 +226,7 @@ print_variable_at_address (struct type *type,
const gdb_byte *valaddr,
struct ui_file *stream,
int recurse,
- const struct value_print_options *options)
+ const value_print_options *options)
{
struct gdbarch *gdbarch = type->arch ();
CORE_ADDR addr = unpack_pointer (type, valaddr);
@@ -257,7 +257,7 @@ print_variable_at_address (struct type *type,
static void
m2_print_array_contents (struct value *val,
struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
int len)
{
struct type *type = check_typedef (val->type ());
@@ -300,7 +300,7 @@ static const struct generic_val_print_decorations m2_decorations =
void
m2_language::value_print_inner (struct value *val, struct ui_file *stream,
int recurse,
- const struct value_print_options *options) const
+ const value_print_options *options) const
{
unsigned len;
struct type *elttype;
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index 3703e024786..b727255ea12 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -212,7 +212,7 @@ void
pascal_language::printstr (struct ui_file *stream, struct type *elttype,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
- const struct value_print_options *options) const
+ const value_print_options *options) const
{
pascal_wchar_printer printer (elttype, '\'', encoding);
printer.print (stream, string, length, force_ellipses, 0, options);
diff --git a/gdb/p-lang.h b/gdb/p-lang.h
index 046980b36be..4c80e1b21c4 100644
--- a/gdb/p-lang.h
+++ b/gdb/p-lang.h
@@ -95,13 +95,13 @@ class pascal_language : public language_defn
/* See language.h. */
void value_print (struct value *val, struct ui_file *stream,
- const struct value_print_options *options) const override;
+ const value_print_options *options) const override;
/* See language.h. */
void value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const override;
+ const value_print_options *options) const override;
/* See language.h. */
@@ -117,7 +117,7 @@ class pascal_language : public language_defn
void printstr (struct ui_file *stream, struct type *elttype,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
- const struct value_print_options *options) const override;
+ const value_print_options *options) const override;
/* See language.h. */
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index f64c1069b53..4f94189b6e6 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -44,7 +44,7 @@
static void pascal_object_print_value_fields (struct value *, struct ui_file *,
int,
- const struct value_print_options *,
+ const value_print_options *,
struct type **, int);
/* Decorations for Pascal. */
@@ -66,7 +66,7 @@ static const struct generic_val_print_decorations p_decorations =
void
pascal_language::value_print_inner (struct value *val,
struct ui_file *stream, int recurse,
- const struct value_print_options *options) const
+ const value_print_options *options) const
{
struct type *type = check_typedef (val->type ());
@@ -407,10 +407,10 @@ pascal_language::value_print_inner (struct value *val,
\f
void
pascal_language::value_print (struct value *val, struct ui_file *stream,
- const struct value_print_options *options) const
+ const value_print_options *options) const
{
struct type *type = val->type ();
- struct value_print_options opts = *options;
+ value_print_options opts = *options;
opts.deref_ref = true;
@@ -456,10 +456,10 @@ static struct obstack dont_print_statmem_obstack;
static void pascal_object_print_static_field (struct value *,
struct ui_file *, int,
- const struct value_print_options *);
+ const value_print_options *);
static void pascal_object_print_value (struct value *, struct ui_file *, int,
- const struct value_print_options *,
+ const value_print_options *,
struct type **);
/* It was changed to this after 2.4.5. */
@@ -513,7 +513,7 @@ pascal_object_is_vtbl_member (struct type *type)
static void
pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
struct type **dont_print_vb,
int dont_print_statmem)
{
@@ -618,7 +618,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
}
else
{
- struct value_print_options opts = *options;
+ value_print_options opts = *options;
v = value_field_bitfield (type, i, valaddr, 0, val);
@@ -650,7 +650,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
}
else
{
- struct value_print_options opts = *options;
+ value_print_options opts = *options;
opts.deref_ref = false;
@@ -686,7 +686,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
static void
pascal_object_print_value (struct value *val, struct ui_file *stream,
int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
struct type **dont_print_vb)
{
struct type **last_dont_print
@@ -813,10 +813,10 @@ static void
pascal_object_print_static_field (struct value *val,
struct ui_file *stream,
int recurse,
- const struct value_print_options *options)
+ const value_print_options *options)
{
struct type *type = val->type ();
- struct value_print_options opts;
+ value_print_options opts;
if (val->entirely_optimized_out ())
{
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 9ebe563fed3..64df1030bb0 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -287,7 +287,7 @@ decode_format (const char **string_ptr, int oformat, int osize)
static void
print_formatted (struct value *val, int size,
- const struct value_print_options *options,
+ const value_print_options *options,
struct ui_file *stream)
{
struct type *type = check_typedef (val->type ());
@@ -363,7 +363,7 @@ float_type_from_length (struct type *type)
void
print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
- const struct value_print_options *options,
+ const value_print_options *options,
int size, struct ui_file *stream)
{
struct gdbarch *gdbarch = type->arch ();
@@ -493,7 +493,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
break;
case 'c':
{
- struct value_print_options opts = *options;
+ value_print_options opts = *options;
if (!val_long.has_value ())
val_long.emplace (unpack_long (type, valaddr));
@@ -762,7 +762,7 @@ pc_prefix (CORE_ADDR addr)
Return non-zero if anything was printed; zero otherwise. */
int
-print_address_demangle (const struct value_print_options *opts,
+print_address_demangle (const value_print_options *opts,
struct gdbarch *gdbarch, CORE_ADDR addr,
struct ui_file *stream, int do_demangle)
{
@@ -933,7 +933,7 @@ integer_is_zero (const gdb_byte *x, int len)
static CORE_ADDR
find_string_backward (struct gdbarch *gdbarch,
CORE_ADDR addr, int count, int char_size,
- const struct value_print_options *options,
+ const value_print_options *options,
int *strings_counted)
{
const int chunk_size = 0x20;
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index 6e3012a3331..d095a9779db 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -221,7 +221,7 @@ py_print_type (struct ui_out *out, struct value *val)
static void
py_print_value (struct ui_out *out, struct value *val,
- const struct value_print_options *opts,
+ const value_print_options *opts,
int indent,
enum ext_lang_frame_args args_type,
const struct language_defn *language)
@@ -304,7 +304,7 @@ py_print_single_arg (struct ui_out *out,
const char *sym_name,
struct frame_arg *fa,
struct value *fv,
- const struct value_print_options *opts,
+ const value_print_options *opts,
enum ext_lang_frame_args args_type,
int print_args_field,
const struct language_defn *language)
diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c
index a89bf073215..057d6b35aaf 100644
--- a/gdb/python/py-prettyprint.c
+++ b/gdb/python/py-prettyprint.c
@@ -42,7 +42,7 @@ enum gdbpy_string_repr_result
/* If non-null, points to options that are in effect while
printing. */
-const struct value_print_options *gdbpy_current_print_options;
+const value_print_options *gdbpy_current_print_options;
/* Helper function for find_pretty_printer which iterates over a list,
calls each function and inspects output. This will return a
@@ -281,7 +281,7 @@ print_stack_unless_memory_error (struct ui_file *stream)
static enum gdbpy_string_repr_result
print_string_repr (PyObject *printer, const char *hint,
struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct language_defn *language,
struct gdbarch *gdbarch)
{
@@ -299,7 +299,7 @@ print_string_repr (PyObject *printer, const char *hint,
long length;
struct type *type;
gdb::unique_xmalloc_ptr<char> encoding;
- struct value_print_options local_opts = *options;
+ value_print_options local_opts = *options;
gdbpy_extract_lazy_string (py_str.get (), &addr, &type,
&length, &encoding);
@@ -338,7 +338,7 @@ print_string_repr (PyObject *printer, const char *hint,
}
else if (replacement)
{
- struct value_print_options opts = *options;
+ value_print_options opts = *options;
opts.addressprint = false;
common_val_print (replacement, stream, recurse, &opts, language);
@@ -358,7 +358,7 @@ print_string_repr (PyObject *printer, const char *hint,
static void
print_children (PyObject *printer, const char *hint,
struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct language_defn *language,
int is_py_none)
{
@@ -504,7 +504,7 @@ print_children (PyObject *printer, const char *hint,
struct type *type;
long length;
gdb::unique_xmalloc_ptr<char> encoding;
- struct value_print_options local_opts = *options;
+ value_print_options local_opts = *options;
gdbpy_extract_lazy_string (py_v, &addr, &type, &length, &encoding);
@@ -536,7 +536,7 @@ print_children (PyObject *printer, const char *hint,
/* When printing the key of a map we allow one additional
level of depth. This means the key will print before the
value does. */
- struct value_print_options opt = *options;
+ value_print_options opt = *options;
if (is_map && i % 2 == 0
&& opt.max_depth != -1
&& opt.max_depth < INT_MAX)
@@ -573,7 +573,7 @@ enum ext_lang_rc
gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang,
struct value *value,
struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct language_defn *language)
{
struct type *type = value->type ();
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index f9899740a5f..d7acd873f0f 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -435,7 +435,7 @@ extern enum ext_lang_rc gdbpy_apply_val_pretty_printer
(const struct extension_language_defn *,
struct value *value,
struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct language_defn *language);
extern void gdbpy_load_ptwrite_filter
(const struct extension_language_defn *extlang,
@@ -975,7 +975,7 @@ PyObject *gdbpy_default_visualizer (PyObject *self, PyObject *args);
PyObject *gdbpy_print_options (PyObject *self, PyObject *args);
const value_print_options &gdbpy_get_print_options ();
-extern const struct value_print_options *gdbpy_current_print_options;
+extern const value_print_options *gdbpy_current_print_options;
void bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj);
void bpfinishpy_post_stop_hook (struct gdbpy_breakpoint_object *bp_obj);
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 517d6333d12..a4614e9874a 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -461,7 +461,7 @@ void
rust_language::printstr (struct ui_file *stream, struct type *type,
const gdb_byte *string, unsigned int length,
const char *user_encoding, int force_ellipses,
- const struct value_print_options *options) const
+ const value_print_options *options) const
{
/* Rust always uses UTF-8, but let the caller override this if need
be. */
@@ -518,7 +518,7 @@ rust_slice_to_array (struct value *val)
void
rust_language::val_print_slice
(struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const
+ const value_print_options *options) const
{
struct type *orig_type = check_typedef (val->type ());
@@ -558,7 +558,7 @@ rust_language::val_print_slice
void
rust_language::val_print_struct
(struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const
+ const value_print_options *options) const
{
int first_field;
struct type *type = check_typedef (val->type ());
@@ -571,7 +571,7 @@ rust_language::val_print_struct
bool is_tuple = rust_tuple_type_p (type);
bool is_tuple_struct = !is_tuple && rust_tuple_struct_type_p (type);
- struct value_print_options opts;
+ value_print_options opts;
if (!is_tuple)
{
@@ -640,9 +640,9 @@ rust_language::val_print_struct
void
rust_language::print_enum (struct value *val, struct ui_file *stream,
int recurse,
- const struct value_print_options *options) const
+ const value_print_options *options) const
{
- struct value_print_options opts = *options;
+ value_print_options opts = *options;
struct type *type = check_typedef (val->type ());
opts.deref_ref = false;
@@ -714,9 +714,9 @@ rust_language::print_enum (struct value *val, struct ui_file *stream,
void
rust_language::value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const
+ const value_print_options *options) const
{
- struct value_print_options opts = *options;
+ value_print_options opts = *options;
opts.deref_ref = true;
if (opts.prettyformat == Val_prettyformat_default)
@@ -826,7 +826,7 @@ rust_language::value_print_inner
void
rust_language::value_print
(struct value *val, struct ui_file *stream,
- const struct value_print_options *options) const
+ const value_print_options *options) const
{
value_print_options opts = *options;
opts.deref_ref = true;
diff --git a/gdb/rust-lang.h b/gdb/rust-lang.h
index c7a5bef0e0f..8e20d352394 100644
--- a/gdb/rust-lang.h
+++ b/gdb/rust-lang.h
@@ -137,12 +137,12 @@ class rust_language : public language_defn
void value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const override;
+ const value_print_options *options) const override;
/* See language.h. */
void value_print (struct value *val, struct ui_file *stream,
- const struct value_print_options *options) const override;
+ const value_print_options *options) const override;
/* See language.h. */
@@ -164,7 +164,7 @@ class rust_language : public language_defn
void printstr (struct ui_file *stream, struct type *elttype,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
- const struct value_print_options *options) const override;
+ const value_print_options *options) const override;
/* See language.h. */
@@ -202,20 +202,20 @@ class rust_language : public language_defn
void val_print_slice (struct value *val, struct ui_file *stream,
int recurse,
- const struct value_print_options *options) const;
+ const value_print_options *options) const;
/* Helper for value_print_inner, arguments are as for that function.
Prints structs and untagged unions. */
void val_print_struct (struct value *val, struct ui_file *stream,
int recurse,
- const struct value_print_options *options) const;
+ const value_print_options *options) const;
/* Helper for value_print_inner, arguments are as for that function.
Prints discriminated unions (Rust enums). */
void print_enum (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const;
+ const value_print_options *options) const;
};
#endif /* GDB_RUST_LANG_H */
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 4ef50707bef..1873b5d58b3 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -70,7 +70,7 @@ static void val_print_type_code_flags (struct type *type,
/* Start print_max_depth at this value. */
#define PRINT_MAX_DEPTH_DEFAULT 20
-struct value_print_options user_print_options =
+value_print_options user_print_options =
{
Val_prettyformat_default, /* prettyformat */
false, /* prettyformat_arrays */
@@ -409,7 +409,7 @@ val_print_invalid_address (struct ui_file *stream)
static void
print_unpacked_pointer (struct type *type, struct type *elttype,
CORE_ADDR address, struct ui_file *stream,
- const struct value_print_options *options)
+ const value_print_options *options)
{
struct gdbarch *gdbarch = type->arch ();
@@ -432,7 +432,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
static void
generic_val_print_array (struct value *val,
struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct
generic_val_print_decorations *decorations)
{
@@ -465,7 +465,7 @@ generic_val_print_array (struct value *val,
static void
generic_val_print_string (struct value *val,
struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct generic_val_print_decorations
*decorations)
{
@@ -534,7 +534,7 @@ generic_val_print_string (struct value *val,
static void
generic_value_print_ptr (struct value *val, struct ui_file *stream,
- const struct value_print_options *options)
+ const value_print_options *options)
{
if (options->format && options->format != 's')
@@ -593,7 +593,7 @@ static void
generic_val_print_ref (struct type *type,
struct ui_file *stream, int recurse,
struct value *original_value,
- const struct value_print_options *options)
+ const value_print_options *options)
{
struct type *elttype = check_typedef (type->target_type ());
struct value *deref_val = NULL;
@@ -737,7 +737,7 @@ generic_val_print_enum_1 (struct type *type, LONGEST val,
static void
generic_val_print_enum (struct type *type, struct ui_file *stream,
struct value *original_value,
- const struct value_print_options *options)
+ const value_print_options *options)
{
gdb_assert (!options->format);
@@ -754,7 +754,7 @@ static void
generic_val_print_func (struct type *type, CORE_ADDR address,
struct ui_file *stream,
struct value *original_value,
- const struct value_print_options *options)
+ const value_print_options *options)
{
struct gdbarch *gdbarch = type->arch ();
@@ -775,12 +775,12 @@ generic_val_print_func (struct type *type, CORE_ADDR address,
static void
generic_value_print_bool
(struct value *value, struct ui_file *stream,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct generic_val_print_decorations *decorations)
{
if (options->format || options->output_format)
{
- struct value_print_options opts = *options;
+ value_print_options opts = *options;
opts.format = (options->format ? options->format
: options->output_format);
value_print_scalar_formatted (value, &opts, 0, stream);
@@ -803,9 +803,9 @@ generic_value_print_bool
static void
generic_value_print_int (struct value *val, struct ui_file *stream,
- const struct value_print_options *options)
+ const value_print_options *options)
{
- struct value_print_options opts = *options;
+ value_print_options opts = *options;
opts.format = (options->format ? options->format
: options->output_format);
@@ -816,11 +816,11 @@ generic_value_print_int (struct value *val, struct ui_file *stream,
static void
generic_value_print_char (struct value *value, struct ui_file *stream,
- const struct value_print_options *options)
+ const value_print_options *options)
{
if (options->format || options->output_format)
{
- struct value_print_options opts = *options;
+ value_print_options opts = *options;
opts.format = (options->format ? options->format
: options->output_format);
@@ -847,7 +847,7 @@ generic_value_print_char (struct value *value, struct ui_file *stream,
static void
generic_val_print_float (struct type *type, struct ui_file *stream,
struct value *original_value,
- const struct value_print_options *options)
+ const value_print_options *options)
{
gdb_assert (!options->format);
@@ -860,7 +860,7 @@ generic_val_print_float (struct type *type, struct ui_file *stream,
static void
generic_val_print_fixed_point (struct value *val, struct ui_file *stream,
- const struct value_print_options *options)
+ const value_print_options *options)
{
if (options->format)
value_print_scalar_formatted (val, options, 0, stream);
@@ -885,7 +885,7 @@ generic_val_print_fixed_point (struct value *val, struct ui_file *stream,
static void
generic_value_print_complex (struct value *val, struct ui_file *stream,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct generic_val_print_decorations
*decorations)
{
@@ -906,7 +906,7 @@ static void
generic_value_print_memberptr
(struct value *val, struct ui_file *stream,
int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct generic_val_print_decorations *decorations)
{
if (!options->format)
@@ -923,7 +923,7 @@ generic_value_print_memberptr
void
generic_value_print (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct generic_val_print_decorations *decorations)
{
struct type *type = val->type ();
@@ -1053,7 +1053,7 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse,
void
common_val_print (struct value *value, struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct language_defn *language)
{
if (language->la_language == language_ada)
@@ -1066,7 +1066,7 @@ common_val_print (struct value *value, struct ui_file *stream, int recurse,
if (value->lazy ())
value->fetch_lazy ();
- struct value_print_options local_opts = *options;
+ value_print_options local_opts = *options;
struct type *type = value->type ();
struct type *real_type = check_typedef (type);
@@ -1124,7 +1124,7 @@ common_val_print (struct value *value, struct ui_file *stream, int recurse,
bool
val_print_check_max_depth (struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct language_defn *language)
{
if (options->max_depth > -1 && recurse >= options->max_depth)
@@ -1143,7 +1143,7 @@ val_print_check_max_depth (struct ui_file *stream, int recurse,
static bool
value_check_printable (struct value *val, struct ui_file *stream,
- const struct value_print_options *options)
+ const value_print_options *options)
{
if (val == 0)
{
@@ -1192,7 +1192,7 @@ value_check_printable (struct value *val, struct ui_file *stream,
void
common_val_print_checked (struct value *val, struct ui_file *stream,
int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct language_defn *language)
{
if (!value_check_printable (val, stream, options))
@@ -1205,7 +1205,7 @@ common_val_print_checked (struct value *val, struct ui_file *stream,
void
value_print (struct value *val, struct ui_file *stream,
- const struct value_print_options *options)
+ const value_print_options *options)
{
scoped_value_mark free_values;
@@ -1291,7 +1291,7 @@ val_print_type_code_flags (struct type *type, struct value *original_value,
void
value_print_scalar_formatted (struct value *val,
- const struct value_print_options *options,
+ const value_print_options *options,
int size,
struct ui_file *stream)
{
@@ -1304,7 +1304,7 @@ value_print_scalar_formatted (struct value *val,
again. */
if (options->format == 's')
{
- struct value_print_options opts = *options;
+ value_print_options opts = *options;
opts.format = 0;
opts.deref_ref = false;
common_val_print (val, stream, 0, &opts, current_language);
@@ -1414,7 +1414,7 @@ print_floating (const gdb_byte *valaddr, struct type *type,
void
print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
unsigned len, enum bfd_endian byte_order, bool zero_pad,
- const struct value_print_options *options)
+ const value_print_options *options)
{
const gdb_byte *p;
unsigned int i;
@@ -1916,7 +1916,7 @@ print_hex_chars (struct ui_file *stream, const gdb_byte *valaddr,
stream STREAM. */
void
-print_function_pointer_address (const struct value_print_options *options,
+print_function_pointer_address (const value_print_options *options,
struct gdbarch *gdbarch,
CORE_ADDR address,
struct ui_file *stream)
@@ -1943,7 +1943,7 @@ print_function_pointer_address (const struct value_print_options *options,
void
maybe_print_array_index (struct type *index_type, LONGEST index,
struct ui_file *stream,
- const struct value_print_options *options)
+ const value_print_options *options)
{
if (!options->print_array_indexes)
return;
@@ -1956,7 +1956,7 @@ maybe_print_array_index (struct type *index_type, LONGEST index,
void
value_print_array_elements (struct value *val, struct ui_file *stream,
int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
unsigned int i)
{
unsigned int things_printed = 0;
@@ -2112,7 +2112,7 @@ generic_printstr (struct ui_file *stream, struct type *type,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
int quote_char, int c_style_terminator,
- const struct value_print_options *options)
+ const value_print_options *options)
{
wchar_printer printer (type, quote_char, encoding);
printer.print (stream, string, length, force_ellipses,
@@ -2131,7 +2131,7 @@ int
val_print_string (struct type *elttype, const char *encoding,
CORE_ADDR addr, int len,
struct ui_file *stream,
- const struct value_print_options *options)
+ const value_print_options *options)
{
int force_ellipsis = 0; /* Force ellipsis to be printed if nonzero. */
int err; /* Non-zero if we got a bad read. */
diff --git a/gdb/valprint.h b/gdb/valprint.h
index e743c39dca5..8c4c601b16d 100644
--- a/gdb/valprint.h
+++ b/gdb/valprint.h
@@ -128,7 +128,7 @@ struct value_print_options
/* Return the character count limit for printing strings. */
static inline unsigned int
-get_print_max_chars (const struct value_print_options *options)
+get_print_max_chars (const value_print_options *options)
{
return (options->print_max_chars != PRINT_MAX_CHARS_ELEMENTS
? options->print_max_chars : options->print_max);
@@ -142,7 +142,7 @@ extern gdb::option::option_def_group make_value_print_options_def_group
/* The global print options set by the user. In general this should
not be directly accessed, except by set/show commands. Ordinary
code should call get_user_print_options instead. */
-extern struct value_print_options user_print_options;
+extern value_print_options user_print_options;
/* Accessor for the user print options. */
@@ -163,13 +163,13 @@ extern value_print_options get_formatted_print_options (char format);
extern void maybe_print_array_index (struct type *index_type, LONGEST index,
struct ui_file *stream,
- const struct value_print_options *);
+ const value_print_options *);
/* Print elements of an array. */
extern void value_print_array_elements (struct value *, struct ui_file *, int,
- const struct value_print_options *,
+ const value_print_options *,
unsigned int);
/* Print a scalar according to OPTIONS and SIZE on STREAM. Format 'i'
@@ -179,12 +179,12 @@ extern void value_print_array_elements (struct value *, struct ui_file *, int,
with a format. */
extern void value_print_scalar_formatted
- (struct value *val, const struct value_print_options *options,
+ (struct value *val, const value_print_options *options,
int size, struct ui_file *stream);
extern void print_binary_chars (struct ui_file *, const gdb_byte *,
unsigned int, enum bfd_endian, bool,
- const struct value_print_options *options);
+ const value_print_options *options);
extern void print_octal_chars (struct ui_file *, const gdb_byte *,
unsigned int, enum bfd_endian);
@@ -195,7 +195,7 @@ extern void print_decimal_chars (struct ui_file *, const gdb_byte *,
extern void print_hex_chars (struct ui_file *, const gdb_byte *,
unsigned int, enum bfd_endian, bool);
-extern void print_function_pointer_address (const struct value_print_options *options,
+extern void print_function_pointer_address (const value_print_options *options,
struct gdbarch *gdbarch,
CORE_ADDR address,
struct ui_file *stream);
@@ -259,7 +259,7 @@ struct generic_val_print_decorations
extern void generic_value_print (struct value *val, struct ui_file *stream,
int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct generic_val_print_decorations *d);
extern void generic_emit_char (int c, struct type *type, struct ui_file *stream,
@@ -269,7 +269,7 @@ extern void generic_printstr (struct ui_file *stream, struct type *type,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
int quote_char, int c_style_terminator,
- const struct value_print_options *options);
+ const value_print_options *options);
/* Run the "output" command. ARGS and FROM_TTY are the usual
arguments passed to all command implementations, except ARGS is
@@ -335,7 +335,7 @@ extern int build_address_symbolic (struct gdbarch *,
LANGUAGE determines what type of ellipsis expression is printed. */
extern bool val_print_check_max_depth (struct ui_file *stream, int recurse,
- const struct value_print_options *opts,
+ const value_print_options *opts,
const struct language_defn *language);
/* Like common_val_print, but call value_check_printable first. */
@@ -343,7 +343,7 @@ extern bool val_print_check_max_depth (struct ui_file *stream, int recurse,
extern void common_val_print_checked
(struct value *val,
struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct language_defn *language);
#endif /* GDB_VALPRINT_H */
diff --git a/gdb/value.h b/gdb/value.h
index e94c69e49d3..3651a089fd2 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -1051,7 +1051,7 @@ struct value *value_vector_widen (struct value *scalar_value,
class frame_info_ptr;
struct fn_field;
-extern int print_address_demangle (const struct value_print_options *,
+extern int print_address_demangle (const value_print_options *,
struct gdbarch *, CORE_ADDR,
struct ui_file *, int);
@@ -1557,7 +1557,7 @@ extern void print_floating (const gdb_byte *valaddr, struct type *type,
struct ui_file *stream);
extern void value_print (struct value *val, struct ui_file *stream,
- const struct value_print_options *options);
+ const value_print_options *options);
/* Release values from the value chain and return them. Values
created after MARK are released. If MARK is nullptr, or if MARK is
@@ -1570,13 +1570,13 @@ extern std::vector<value_ref_ptr> value_release_to_mark
extern void common_val_print (struct value *val,
struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+ const value_print_options *options,
const struct language_defn *language);
extern int val_print_string (struct type *elttype, const char *encoding,
CORE_ADDR addr, int len,
struct ui_file *stream,
- const struct value_print_options *options);
+ const value_print_options *options);
/* Print the value in stack frame FRAME of a variable specified by a
struct symbol. STREAM is the ui_file on which to print the value.
--
2.49.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 8/9] Use std::forward in fortran_array_walker
2026-07-04 22:05 [PATCH 0/9] Some cleanups and C++-ification of value_print_options Tom Tromey
` (6 preceding siblings ...)
2026-07-04 22:05 ` [PATCH 7/9] Don't use 'struct' keyword with value_print_options Tom Tromey
@ 2026-07-04 22:05 ` Tom Tromey
2026-07-04 22:05 ` [PATCH 9/9] Use references for value_print_options Tom Tromey
8 siblings, 0 replies; 10+ messages in thread
From: Tom Tromey @ 2026-07-04 22:05 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
This changes fortran_array_walker to std::forward some arguments.
This isn't needed in the current tree, but is needed to make the next
patch work correctly.
Sometime earlier this year I had a patch where I ended up removing the
use of std::forward. After debugging this case, I tend to think that
if a function uses variadic template parameters, then it should always
use the "&&" and std::forward to pass them on, just because this is
more future-proof -- one never knows when one might need this.
---
gdb/f-array-walker.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/f-array-walker.h b/gdb/f-array-walker.h
index 4392e54013b..e7deef8ac5a 100644
--- a/gdb/f-array-walker.h
+++ b/gdb/f-array-walker.h
@@ -195,10 +195,10 @@ class fortran_array_walker
template parameter class IMPL. */
template <typename ...Args>
fortran_array_walker (struct type *type, CORE_ADDR address,
- Args... args)
+ Args&&... args)
: m_type (type),
m_address (address),
- m_impl (type, address, args...),
+ m_impl (type, address, std::forward<Args> (args)...),
m_ndimensions (calc_f77_array_dims (m_type)),
m_nss (0)
{ /* Nothing. */ }
--
2.49.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 9/9] Use references for value_print_options
2026-07-04 22:05 [PATCH 0/9] Some cleanups and C++-ification of value_print_options Tom Tromey
` (7 preceding siblings ...)
2026-07-04 22:05 ` [PATCH 8/9] Use std::forward in fortran_array_walker Tom Tromey
@ 2026-07-04 22:05 ` Tom Tromey
8 siblings, 0 replies; 10+ messages in thread
From: Tom Tromey @ 2026-07-04 22:05 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
Nearly all code using value_print_options will not work with a NULL
pointer. This patch changes such code to use a reference instead.
Only a small number of uses of "value_print_options *" remain, all
seemingly necessary.
---
gdb/ada-lang.c | 8 +-
gdb/ada-lang.h | 4 +-
gdb/ada-valprint.c | 82 ++++++++++-----------
gdb/ada-varobj.c | 10 +--
gdb/auxv.c | 2 +-
gdb/breakpoint.c | 2 +-
gdb/c-lang.c | 2 +-
gdb/c-lang.h | 6 +-
gdb/c-valprint.c | 58 +++++++--------
gdb/char-print.c | 14 ++--
gdb/char-print.h | 4 +-
gdb/cli/cli-cmds.c | 2 +-
gdb/compile/compile.c | 6 +-
gdb/cp-valprint.c | 45 ++++++-----
gdb/d-lang.c | 2 +-
gdb/d-lang.h | 2 +-
gdb/d-valprint.c | 4 +-
gdb/dwarf2/read.c | 2 +-
gdb/extension-priv.h | 2 +-
gdb/extension.c | 2 +-
gdb/extension.h | 2 +-
gdb/f-lang.c | 2 +-
gdb/f-lang.h | 6 +-
gdb/f-valprint.c | 44 +++++------
gdb/gdbtypes.h | 2 +-
gdb/gnu-v3-abi.c | 6 +-
gdb/go-lang.h | 2 +-
gdb/go-valprint.c | 8 +-
gdb/guile/guile-internal.h | 4 +-
gdb/guile/scm-lazy-string.c | 2 +-
gdb/guile/scm-pretty-print.c | 34 ++++-----
gdb/guile/scm-value.c | 4 +-
gdb/infcmd.c | 8 +-
gdb/language.c | 12 +--
gdb/language.h | 8 +-
gdb/linux-thread-db.c | 2 +-
gdb/m2-lang.c | 2 +-
gdb/m2-lang.h | 4 +-
gdb/m2-valprint.c | 28 +++----
gdb/mi/mi-cmd-stack.c | 2 +-
gdb/mi/mi-main.c | 10 +--
gdb/mips-tdep.c | 6 +-
gdb/p-lang.c | 2 +-
gdb/p-lang.h | 6 +-
gdb/p-valprint.c | 66 ++++++++---------
gdb/printcmd.c | 90 +++++++++++-----------
gdb/python/py-framefilter.c | 14 ++--
gdb/python/py-lazy-string.c | 2 +-
gdb/python/py-prettyprint.c | 40 +++++-----
gdb/python/py-unwind.c | 2 +-
gdb/python/py-value.c | 4 +-
gdb/python/py-varobj.c | 10 +--
gdb/python/python-internal.h | 6 +-
gdb/record-full.c | 4 +-
gdb/riscv-tdep.c | 6 +-
gdb/rust-lang.c | 42 +++++------
gdb/rust-lang.h | 12 +--
gdb/stack.c | 2 +-
gdb/tracepoint.c | 2 +-
gdb/valprint.c | 172 +++++++++++++++++++++----------------------
gdb/valprint.h | 26 +++----
gdb/value.c | 4 +-
gdb/value.h | 8 +-
gdb/varobj.c | 10 +--
64 files changed, 493 insertions(+), 494 deletions(-)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 2bb6cf7f9ff..0e7db2704a3 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -13504,7 +13504,7 @@ class ada_language : public language_defn
void print_array_index (struct type *index_type,
LONGEST index,
struct ui_file *stream,
- const value_print_options *options) const override
+ const value_print_options &options) const override
{
struct value *index_value = val_atr (index_type, index);
@@ -13810,7 +13810,7 @@ class ada_language : public language_defn
/* See language.h. */
void value_print (struct value *val, struct ui_file *stream,
- const value_print_options *options) const override
+ const value_print_options &options) const override
{
return ada_value_print (val, stream, options);
}
@@ -13819,7 +13819,7 @@ class ada_language : public language_defn
void value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options) const override
+ const value_print_options &options) const override
{
return ada_value_print_inner (val, stream, recurse, options);
}
@@ -13890,7 +13890,7 @@ class ada_language : public language_defn
void printstr (struct ui_file *stream, struct type *elttype,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
- const value_print_options *options) const override
+ const value_print_options &options) const override
{
/* ada_printstr doesn't handle UTF-8 too well, but we want this
for lazy-string printing. Defer this case to the generic
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 882963baea4..5382fe894cf 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -165,10 +165,10 @@ extern void ada_print_typedef (struct type *type, struct symbol *new_symbol,
/* Implement la_value_print_inner for Ada. */
extern void ada_value_print_inner (struct value *, struct ui_file *, int,
- const value_print_options *);
+ const value_print_options &);
extern void ada_value_print (struct value *, struct ui_file *,
- const value_print_options *);
+ const value_print_options &);
/* Defined in ada-lang.c */
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index 8eeccf1d589..d66f9f84d52 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -32,7 +32,7 @@
static bool print_field_values (struct value *, struct value *,
struct ui_file *, int,
- const value_print_options *,
+ const value_print_options &,
bool, const struct language_defn *);
\f
@@ -43,13 +43,13 @@ static bool print_field_values (struct value *, struct value *,
static void
print_optional_low_bound (struct ui_file *stream, struct type *type,
- const value_print_options *options)
+ const value_print_options &options)
{
struct type *index_type;
LONGEST low_bound;
LONGEST high_bound;
- if (options->print_array_indexes)
+ if (options.print_array_indexes)
return;
if (!get_array_bounds (type, &low_bound, &high_bound))
@@ -109,7 +109,7 @@ static void
val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
int offset, struct ui_file *stream,
int recurse,
- const value_print_options *options)
+ const value_print_options &options)
{
unsigned int i;
unsigned int things_printed = 0;
@@ -146,7 +146,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
i = 0;
annotate_array_section_begin (i, elttype);
- while (i < len && things_printed < options->print_max)
+ while (i < len && things_printed < options.print_max)
{
/* Both this outer loop and the inner loop that checks for
duplicates may allocate many values. To avoid using too much
@@ -158,7 +158,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
if (i != 0)
{
- if (options->prettyformat_arrays)
+ if (options.prettyformat_arrays)
{
gdb_printf (stream, ",\n");
print_spaces (2 + 2 * recurse, stream);
@@ -168,7 +168,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
gdb_printf (stream, ", ");
}
}
- else if (options->prettyformat_arrays)
+ else if (options.prettyformat_arrays)
{
gdb_printf (stream, "\n");
print_spaces (2 + 2 * recurse, stream);
@@ -202,12 +202,12 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
break;
}
- if (i - i0 > options->repeat_count_threshold)
+ if (i - i0 > options.repeat_count_threshold)
{
- value_print_options opts = *options;
+ value_print_options opts = options;
opts.deref_ref = false;
- common_val_print (v0, stream, recurse + 1, &opts, current_language);
+ common_val_print (v0, stream, recurse + 1, opts, current_language);
annotate_elt_rep (i - i0);
gdb_printf (stream, _(" %p[<repeats %u times>%p]"),
metadata_style.style ().ptr (), i - i0, nullptr);
@@ -217,14 +217,14 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
else
{
int j;
- value_print_options opts = *options;
+ value_print_options opts = options;
opts.deref_ref = false;
for (j = i0; j < i; j += 1)
{
if (j > i0)
{
- if (options->prettyformat_arrays)
+ if (options.prettyformat_arrays)
{
gdb_printf (stream, ",\n");
print_spaces (2 + 2 * recurse, stream);
@@ -237,7 +237,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
maybe_print_array_index (index_type, j + low,
stream, options);
}
- common_val_print (v0, stream, recurse + 1, &opts,
+ common_val_print (v0, stream, recurse + 1, opts,
current_language);
annotate_elt ();
}
@@ -398,7 +398,7 @@ static bool
print_variant_part (struct value *value, int field_num,
struct value *outer_value,
struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
bool comma_needed,
const struct language_defn *language)
{
@@ -432,7 +432,7 @@ print_variant_part (struct value *value, int field_num,
static bool
print_field_values (struct value *value, struct value *outer_value,
struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
bool comma_needed,
const struct language_defn *language)
{
@@ -468,7 +468,7 @@ print_field_values (struct value *value, struct value *outer_value,
gdb_printf (stream, ", ");
comma_needed = true;
- if (options->prettyformat)
+ if (options.prettyformat)
{
gdb_printf (stream, "\n");
print_spaces (2 + 2 * recurse, stream);
@@ -507,19 +507,19 @@ print_field_values (struct value *value, struct value *outer_value,
bit_pos / HOST_CHAR_BIT,
bit_pos % HOST_CHAR_BIT,
bit_size, type->field (i).type ());
- opts = *options;
+ opts = options;
opts.deref_ref = false;
- common_val_print (v, stream, recurse + 1, &opts, language);
+ common_val_print (v, stream, recurse + 1, opts, language);
}
}
else
{
- value_print_options opts = *options;
+ value_print_options opts = options;
opts.deref_ref = false;
struct value *v = value->field (i);
- common_val_print (v, stream, recurse + 1, &opts, language);
+ common_val_print (v, stream, recurse + 1, opts, language);
}
annotate_field_end ();
}
@@ -534,7 +534,7 @@ static void
ada_val_print_string (struct type *type, const gdb_byte *valaddr,
int offset_aligned,
struct ui_file *stream, int recurse,
- const value_print_options *options)
+ const value_print_options &options)
{
enum bfd_endian byte_order = type_byte_order (type);
struct type *elttype = type->target_type ();
@@ -553,7 +553,7 @@ ada_val_print_string (struct type *type, const gdb_byte *valaddr,
/* If requested, look for the first null char and only print
elements up to it. */
- if (options->stop_print_at_null)
+ if (options.stop_print_at_null)
{
unsigned int print_max_chars = get_print_max_chars (options);
int temp_len;
@@ -578,9 +578,9 @@ ada_val_print_string (struct type *type, const gdb_byte *valaddr,
static void
ada_value_print_ptr (struct value *val,
struct ui_file *stream, int recurse,
- const value_print_options *options)
+ const value_print_options &options)
{
- if (!options->format
+ if (!options.format
&& val->type ()->target_type ()->code () == TYPE_CODE_INT
&& val->type ()->target_type ()->length () == 0)
{
@@ -605,7 +605,7 @@ ada_value_print_ptr (struct value *val,
static void
ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options)
+ const value_print_options &options)
{
struct type *type = ada_check_typedef (val->type ());
const gdb_byte *valaddr = val->contents_for_printing ().data ();
@@ -627,15 +627,15 @@ ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
}
else
{
- int format = (options->format ? options->format
- : options->output_format);
+ int format = (options.format ? options.format
+ : options.output_format);
if (format)
{
- value_print_options opts = *options;
+ value_print_options opts = options;
opts.format = format;
- value_print_scalar_formatted (val, &opts, 0, stream);
+ value_print_scalar_formatted (val, opts, 0, stream);
}
else if (ada_is_system_address_type (type))
{
@@ -676,11 +676,11 @@ ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
static void
ada_val_print_enum (struct value *value, struct ui_file *stream, int recurse,
- const value_print_options *options)
+ const value_print_options &options)
{
LONGEST val;
- if (options->format)
+ if (options.format)
{
value_print_scalar_formatted (value, options, 0, stream);
return;
@@ -714,13 +714,13 @@ static void
ada_val_print_struct_union (struct value *value,
struct ui_file *stream,
int recurse,
- const value_print_options *options)
+ const value_print_options &options)
{
gdb_printf (stream, "(");
if (print_field_values (value, value, stream, recurse, options,
false, language_def (language_ada))
- && options->prettyformat)
+ && options.prettyformat)
{
gdb_printf (stream, "\n");
print_spaces (2 * recurse, stream);
@@ -734,13 +734,13 @@ ada_val_print_struct_union (struct value *value,
static void
ada_value_print_array (struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options)
+ const value_print_options &options)
{
struct type *type = ada_check_typedef (val->type ());
/* For an array of characters, print with string syntax. */
if (ada_is_string_type (type)
- && (options->format == 0 || options->format == 's'))
+ && (options.format == 0 || options.format == 's'))
{
const gdb_byte *valaddr = val->contents_for_printing ().data ();
int offset_aligned = ada_aligned_value_addr (type, valaddr) - valaddr;
@@ -775,7 +775,7 @@ ada_val_print_ref (struct type *type, const gdb_byte *valaddr,
int offset, int offset_aligned, CORE_ADDR address,
struct ui_file *stream, int recurse,
struct value *original_value,
- const value_print_options *options)
+ const value_print_options &options)
{
/* For references, the debugger is expected to print the value as
an address if DEREF_REF is null. But printing an address in place
@@ -830,7 +830,7 @@ ada_val_print_ref (struct type *type, const gdb_byte *valaddr,
void
ada_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options)
+ const value_print_options &options)
{
struct type *type = ada_check_typedef (val->type ());
@@ -891,7 +891,7 @@ ada_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
break;
case TYPE_CODE_FLT:
- if (options->format)
+ if (options.format)
{
common_val_print (val, stream, recurse, options,
language_def (language_c));
@@ -920,7 +920,7 @@ ada_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
void
ada_value_print (struct value *val0, struct ui_file *stream,
- const value_print_options *options)
+ const value_print_options &options)
{
struct value *val = ada_to_fixed_value (val0);
struct type *type = ada_check_typedef (val->type ());
@@ -956,7 +956,7 @@ ada_value_print (struct value *val0, struct ui_file *stream,
}
}
- opts = *options;
+ opts = options;
opts.deref_ref = true;
- common_val_print (val, stream, 0, &opts, current_language);
+ common_val_print (val, stream, 0, opts, current_language);
}
diff --git a/gdb/ada-varobj.c b/gdb/ada-varobj.c
index 623df0f01ed..4291a56da53 100644
--- a/gdb/ada-varobj.c
+++ b/gdb/ada-varobj.c
@@ -807,7 +807,7 @@ ada_varobj_get_type_of_child (struct value *parent_value,
static std::string
ada_varobj_get_value_image (struct value *value,
- const value_print_options *opts)
+ const value_print_options &opts)
{
string_file buffer;
@@ -826,7 +826,7 @@ ada_varobj_get_value_image (struct value *value,
static std::string
ada_varobj_get_value_of_array_variable (struct value *value,
struct type *type,
- const value_print_options *opts)
+ const value_print_options &opts)
{
const int numchild = ada_varobj_get_array_number_of_children (value, type);
@@ -836,7 +836,7 @@ ada_varobj_get_value_of_array_variable (struct value *value,
which is not very convenient... */
if (value
&& ada_is_string_type (type)
- && (opts->format == 0 || opts->format == 's'))
+ && (opts.format == 0 || opts.format == 's'))
{
std::string str = ada_varobj_get_value_image (value, opts);
return string_printf ("[%d] %s", numchild, str.c_str ());
@@ -851,7 +851,7 @@ ada_varobj_get_value_of_array_variable (struct value *value,
static std::string
ada_varobj_get_value_of_variable (struct value *value,
struct type *type,
- const value_print_options *opts)
+ const value_print_options &opts)
{
ada_varobj_decode_var (&value, &type);
@@ -924,7 +924,7 @@ ada_value_of_variable (const struct varobj *var,
{
value_print_options opts = varobj_formatted_print_options (format);
return ada_varobj_get_value_of_variable (var->value.get (), var->type,
- &opts);
+ opts);
}
/* Implement the "value_is_changeable_p" routine for Ada. */
diff --git a/gdb/auxv.c b/gdb/auxv.c
index 206406f8175..d2cfe99a995 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -446,7 +446,7 @@ fprint_auxv_entry (struct ui_file *file, const char *name,
if (opts.addressprint)
gdb_printf (file, ("%s "), paddress (arch, val));
val_print_string (builtin_type (arch)->builtin_char,
- NULL, val, -1, file, &opts);
+ NULL, val, -1, file, opts);
gdb_printf (file, ("\n"));
}
break;
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 68811ed57da..1bba5f0f8ac 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -5039,7 +5039,7 @@ watchpoint_value_print (struct value *val, struct ui_file *stream)
else
{
const value_print_options &opts = get_user_print_options ();
- value_print (val, stream, &opts);
+ value_print (val, stream, opts);
}
}
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index fe7edd53366..6bc0782846b 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -174,7 +174,7 @@ void
language_defn::printstr (struct ui_file *stream, struct type *type,
const gdb_byte *string, unsigned int length,
const char *user_encoding, int force_ellipses,
- const value_print_options *options) const
+ const value_print_options &options) const
{
c_string_type str_type;
const char *type_encoding;
diff --git a/gdb/c-lang.h b/gdb/c-lang.h
index 14a74b30af8..dd1fbaefe8e 100644
--- a/gdb/c-lang.h
+++ b/gdb/c-lang.h
@@ -84,10 +84,10 @@ extern void c_print_typedef (struct type *,
/* Implement la_value_print_inner for the C family of languages. */
extern void c_value_print_inner (struct value *, struct ui_file *, int,
- const value_print_options *);
+ const value_print_options &);
extern void c_value_print (struct value *, struct ui_file *,
- const value_print_options *);
+ const value_print_options &);
/* These are in c-lang.c: */
@@ -107,7 +107,7 @@ extern void cp_print_class_memberptr (struct value *, struct ui_file *);
extern void cp_print_value_fields (struct value *,
struct ui_file *, int,
- const value_print_options *,
+ const value_print_options &,
struct type **, int);
/* gcc-2.6 or later (when using -fvtable-thunks)
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 48087d2d7f7..9d9708e5be0 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -142,7 +142,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
struct type *unresolved_elttype,
const gdb_byte *valaddr, int embedded_offset,
CORE_ADDR address, struct ui_file *stream, int recurse,
- const value_print_options *options)
+ const value_print_options &options)
{
int want_space = 0;
struct gdbarch *gdbarch = type->arch ();
@@ -154,10 +154,10 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
return;
}
- if (options->symbol_print)
+ if (options.symbol_print)
want_space = print_address_demangle (options, gdbarch, address, stream,
demangle);
- else if (options->addressprint)
+ else if (options.addressprint)
{
fputs_styled (paddress (gdbarch, address), address_style.style (),
stream);
@@ -167,7 +167,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
/* For a pointer to a textual type, also print the string
pointed to, unless pointer is null. */
- if (c_textual_element_type (unresolved_elttype, options->format)
+ if (c_textual_element_type (unresolved_elttype, options.format)
&& address != 0)
{
if (want_space)
@@ -181,7 +181,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
bound_minimal_symbol msymbol = lookup_minimal_symbol_by_pc (vt_address);
/* If 'symbol_print' is set, we did the work above. */
- if (!options->symbol_print
+ if (!options.symbol_print
&& (msymbol.minsym != NULL)
&& (vt_address == msymbol.value_address ()))
{
@@ -193,7 +193,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
want_space = 1;
}
- if (vt_address && options->vtblprint)
+ if (vt_address && options.vtblprint)
{
struct value *vt_val;
struct symbol *wsym = NULL;
@@ -220,7 +220,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
vt_val = value_at (wtype, vt_address);
common_val_print (vt_val, stream, recurse + 1, options,
current_language);
- if (options->prettyformat)
+ if (options.prettyformat)
{
gdb_printf (stream, "\n");
print_spaces (2 + 2 * recurse, stream);
@@ -234,7 +234,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
static void
c_value_print_array (struct value *val,
struct ui_file *stream, int recurse,
- const value_print_options *options)
+ const value_print_options &options)
{
struct type *type = check_typedef (val->type ());
CORE_ADDR address = val->address ();
@@ -257,7 +257,7 @@ c_value_print_array (struct value *val,
/* Print arrays of textual chars with a string syntax, as
long as the entire array is valid. */
if (c_textual_element_type (unresolved_elttype,
- options->format)
+ options.format)
&& val->bytes_available (0, type->length ())
&& !val->bits_any_optimized_out (0,
TARGET_CHAR_BIT * type->length ()))
@@ -266,7 +266,7 @@ c_value_print_array (struct value *val,
/* If requested, look for the first null char and only
print elements up to it. */
- if (options->stop_print_at_null)
+ if (options.stop_print_at_null)
{
unsigned int print_max_chars = get_print_max_chars (options);
unsigned int temp_len;
@@ -326,9 +326,9 @@ c_value_print_array (struct value *val,
static void
c_value_print_ptr (struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options)
+ const value_print_options &options)
{
- if (options->format && options->format != 's')
+ if (options.format && options.format != 's')
{
value_print_scalar_formatted (val, options, 0, stream);
return;
@@ -337,7 +337,7 @@ c_value_print_ptr (struct value *val, struct ui_file *stream, int recurse,
struct type *type = check_typedef (val->type ());
const gdb_byte *valaddr = val->contents_for_printing ().data ();
- if (options->vtblprint && cp_is_vtbl_ptr_type (type))
+ if (options.vtblprint && cp_is_vtbl_ptr_type (type))
{
/* Print the unmangled name if desired. */
/* Print vtable entry - we only get here if we ARE using
@@ -362,13 +362,13 @@ c_value_print_ptr (struct value *val, struct ui_file *stream, int recurse,
static void
c_value_print_struct (struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options)
+ const value_print_options &options)
{
struct type *type = check_typedef (val->type ());
- if (type->code () == TYPE_CODE_UNION && recurse && !options->unionprint)
+ if (type->code () == TYPE_CODE_UNION && recurse && !options.unionprint)
gdb_printf (stream, "{...}");
- else if (options->vtblprint && cp_is_vtbl_ptr_type (type))
+ else if (options.vtblprint && cp_is_vtbl_ptr_type (type))
{
/* Print the unmangled name if desired. */
/* Print vtable entry - we only get here if NOT using
@@ -389,15 +389,15 @@ c_value_print_struct (struct value *val, struct ui_file *stream, int recurse,
static void
c_value_print_int (struct value *val, struct ui_file *stream,
- const value_print_options *options)
+ const value_print_options &options)
{
- if (options->format || options->output_format)
+ if (options.format || options.output_format)
{
- value_print_options opts = *options;
+ value_print_options opts = options;
- opts.format = (options->format ? options->format
- : options->output_format);
- value_print_scalar_formatted (val, &opts, 0, stream);
+ opts.format = (options.format ? options.format
+ : options.output_format);
+ value_print_scalar_formatted (val, opts, 0, stream);
}
else
{
@@ -408,7 +408,7 @@ c_value_print_int (struct value *val, struct ui_file *stream,
the character equivalent as well. */
struct type *type = val->type ();
const gdb_byte *valaddr = val->contents_for_printing ().data ();
- if (c_textual_element_type (type, options->format))
+ if (c_textual_element_type (type, options.format))
{
gdb_puts (" ", stream);
current_language->printchar (unpack_long (type, valaddr), type,
@@ -421,7 +421,7 @@ c_value_print_int (struct value *val, struct ui_file *stream,
void
c_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options)
+ const value_print_options &options)
{
struct type *type = val->type ();
@@ -471,12 +471,12 @@ c_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
\f
void
c_value_print (struct value *val, struct ui_file *stream,
- const value_print_options *options)
+ const value_print_options &options)
{
struct type *type, *real_type;
int full, using_enc;
LONGEST top;
- value_print_options opts = *options;
+ value_print_options opts = options;
opts.deref_ref = true;
@@ -505,7 +505,7 @@ c_value_print (struct value *val, struct ui_file *stream,
{
/* Print nothing. */
}
- else if (options->objectprint
+ else if (options.objectprint
&& (type->target_type ()->code () == TYPE_CODE_STRUCT))
{
int is_ref = TYPE_IS_REFERENCE (type);
@@ -557,7 +557,7 @@ c_value_print (struct value *val, struct ui_file *stream,
if (!val->initialized ())
gdb_printf (stream, " [uninitialized] ");
- if (options->objectprint && (type->code () == TYPE_CODE_STRUCT))
+ if (options.objectprint && (type->code () == TYPE_CODE_STRUCT))
{
/* Attempt to determine real type of object. */
real_type = value_rtti_type (val, &full, &top, &using_enc);
@@ -586,5 +586,5 @@ c_value_print (struct value *val, struct ui_file *stream,
}
}
- common_val_print (val, stream, 0, &opts, current_language);
+ common_val_print (val, stream, 0, opts, current_language);
}
diff --git a/gdb/char-print.c b/gdb/char-print.c
index 8eba856c5bb..f3425ac2cbc 100644
--- a/gdb/char-print.c
+++ b/gdb/char-print.c
@@ -323,15 +323,15 @@ wchar_printer::count_next_character (wchar_iterator *iter,
void
wchar_printer::print_converted_chars_to_obstack
(const std::vector<converted_character> &chars,
- const value_print_options *options,
+ const value_print_options &options,
int *finished)
{
unsigned int idx, num_elements;
const converted_character *elem;
enum {START, SINGLE, REPEAT, INCOMPLETE, FINISH} state, last;
gdb_wchar_t wide_quote_char = gdb_btowc (m_quoter);
- const int print_max = options->print_max_chars > 0
- ? options->print_max_chars : options->print_max;
+ const int print_max = options.print_max_chars > 0
+ ? options.print_max_chars : options.print_max;
/* Set the start state. */
idx = num_elements = 0;
@@ -351,7 +351,7 @@ wchar_printer::print_converted_chars_to_obstack
int j;
/* We are outputting a single character
- (< options->repeat_count_threshold). */
+ (< options.repeat_count_threshold). */
if (last != SINGLE)
{
@@ -385,7 +385,7 @@ wchar_printer::print_converted_chars_to_obstack
int j;
/* We are outputting a character with a repeat count
- greater than options->repeat_count_threshold. */
+ greater than options.repeat_count_threshold. */
if (last == SINGLE)
{
@@ -455,7 +455,7 @@ wchar_printer::print_converted_chars_to_obstack
{
case wchar_iterate_ok:
case wchar_iterate_invalid:
- if (elem->repeat_count > options->repeat_count_threshold)
+ if (elem->repeat_count > options.repeat_count_threshold)
state = REPEAT;
else
state = SINGLE;
@@ -479,7 +479,7 @@ void
wchar_printer::print (struct ui_file *stream, const gdb_byte *string,
unsigned int length, int force_ellipses,
int c_style_terminator,
- const value_print_options *options)
+ const value_print_options &options)
{
unsigned int i;
int finished = 0;
diff --git a/gdb/char-print.h b/gdb/char-print.h
index 44181a07de9..61b90a94ba2 100644
--- a/gdb/char-print.h
+++ b/gdb/char-print.h
@@ -106,7 +106,7 @@ class wchar_printer
void print (struct ui_file *stream, const gdb_byte *string,
unsigned int length, int force_ellipses,
int c_style_terminator,
- const value_print_options *options);
+ const value_print_options &options);
protected:
@@ -165,7 +165,7 @@ class wchar_printer
elements in CHARS. */
void print_converted_chars_to_obstack
(const std::vector<converted_character> &chars,
- const value_print_options *options,
+ const value_print_options &options,
int *finished);
private:
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 3aa5f0038a9..8a89358f16b 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -2705,7 +2705,7 @@ shell_internal_fn (struct gdbarch *gdbarch,
value_print_options opts = get_no_prettyformat_print_options ();
string_file stream;
- value_print (val, &stream, &opts);
+ value_print (val, &stream, opts);
/* We should always have two quote chars, which we'll strip. */
gdb_assert (stream.size () >= 2);
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index 7a60bd33a64..d91ce18ea2c 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -257,9 +257,9 @@ compile_code_command_completer (struct cmd_list_element *ignore,
void
compile_print_value (struct value *val, void *data_voidp)
{
- const value_print_options *print_opts = (value_print_options *) data_voidp;
+ const value_print_options &print_opts = * (value_print_options *) data_voidp;
- print_value (val, *print_opts);
+ print_value (val, print_opts);
}
/* Handle the input from the 'compile print' command. The "compile
@@ -280,7 +280,7 @@ compile_print_command (const char *arg, int from_tty)
gdb::option::process_options
(&arg, gdb::option::PROCESS_OPTIONS_REQUIRE_DELIMITER, group);
- print_command_parse_format (&arg, "compile print", &print_opts);
+ print_command_parse_format (&arg, "compile print", print_opts);
/* Passing &PRINT_OPTS as SCOPE_DATA is safe as do_module_cleanup
will not touch the stale pointer if compile_object_run has
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 83719b9dd6c..ca2f16b04ac 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -48,10 +48,10 @@ static struct obstack dont_print_stat_array_obstack;
static void cp_print_static_field (struct type *, struct value *,
struct ui_file *, int,
- const value_print_options *);
+ const value_print_options &);
static void cp_print_value (struct value *, struct ui_file *,
- int, const value_print_options *,
+ int, const value_print_options &,
struct type **);
@@ -122,7 +122,7 @@ cp_is_vtbl_member (struct type *type)
void
cp_print_value_fields (struct value *val, struct ui_file *stream,
- int recurse, const value_print_options *options,
+ int recurse, const value_print_options &options,
struct type **dont_print_vb,
int dont_print_statmem)
{
@@ -193,19 +193,19 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
const gdb_byte *valaddr = val->contents_for_printing ().data ();
/* If requested, skip printing of static fields. */
- if (!options->static_field_print
+ if (!options.static_field_print
&& type->field (i).is_static ())
continue;
if (fields_seen)
{
gdb_puts (",", stream);
- if (!options->prettyformat)
+ if (!options.prettyformat)
gdb_puts (" ", stream);
}
else if (n_baseclasses > 0)
{
- if (options->prettyformat)
+ if (options.prettyformat)
{
gdb_printf (stream, "\n");
print_spaces (2 + 2 * recurse, stream);
@@ -216,7 +216,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
}
fields_seen = 1;
- if (options->prettyformat)
+ if (options.prettyformat)
{
gdb_printf (stream, "\n");
print_spaces (2 + 2 * recurse, stream);
@@ -242,8 +242,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
annotate_field_name_end ();
/* We tweak various options in a few cases below. */
- value_print_options options_copy = *options;
- value_print_options *opts = &options_copy;
+ value_print_options opts = options;
/* Do not print leading '=' in case of anonymous
unions. */
@@ -254,8 +253,8 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
/* If this is an anonymous field then we want to consider it
as though it is at its parent's depth when it comes to the
max print depth. */
- if (opts->max_depth != -1 && opts->max_depth < INT_MAX)
- ++opts->max_depth;
+ if (opts.max_depth != -1 && opts.max_depth < INT_MAX)
+ ++opts.max_depth;
}
annotate_field_value ();
@@ -280,7 +279,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
}
else
{
- opts->deref_ref = false;
+ opts.deref_ref = false;
v = value_field_bitfield (type, i, valaddr,
val->embedded_offset (), val);
@@ -332,7 +331,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
else
{
struct value *v = val->primitive_field (0, i, type);
- opts->deref_ref = false;
+ opts.deref_ref = false;
common_val_print (v, stream, recurse + 1, opts,
current_language);
}
@@ -372,7 +371,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
}
}
- if (options->prettyformat)
+ if (options.prettyformat)
{
gdb_printf (stream, "\n");
print_spaces (2 * recurse, stream);
@@ -389,7 +388,7 @@ static void
cp_print_value_fields_pp (struct value *val,
struct ui_file *stream,
int recurse,
- const value_print_options *options,
+ const value_print_options &options,
struct type **dont_print_vb,
int dont_print_statmem)
{
@@ -397,7 +396,7 @@ cp_print_value_fields_pp (struct value *val,
/* Attempt to run an extension language pretty-printer if
possible. */
- if (!options->raw)
+ if (!options.raw)
result
= apply_ext_lang_val_pretty_printer (val, stream,
recurse, options,
@@ -413,7 +412,7 @@ cp_print_value_fields_pp (struct value *val,
static void
cp_print_value (struct value *val, struct ui_file *stream,
- int recurse, const value_print_options *options,
+ int recurse, const value_print_options &options,
struct type **dont_print_vb)
{
struct type *type = check_typedef (val->type ());
@@ -503,7 +502,7 @@ cp_print_value (struct value *val, struct ui_file *stream,
}
/* Now do the printing. */
- if (options->prettyformat)
+ if (options.prettyformat)
{
gdb_printf (stream, "\n");
print_spaces (2 * recurse, stream);
@@ -562,7 +561,7 @@ cp_print_static_field (struct type *type,
struct value *val,
struct ui_file *stream,
int recurse,
- const value_print_options *options)
+ const value_print_options &options)
{
value_print_options opts;
@@ -628,9 +627,9 @@ cp_print_static_field (struct type *type,
sizeof (struct type *));
}
- opts = *options;
+ opts = options;
opts.deref_ref = false;
- common_val_print (val, stream, recurse, &opts, current_language);
+ common_val_print (val, stream, recurse, opts, current_language);
}
/* Find the field in *SELF, or its non-virtual base classes, with
@@ -780,12 +779,12 @@ test_print_fields (gdbarch *arch)
string_file out;
value_print_options opts = get_no_prettyformat_print_options ();
- cp_print_value_fields(val, &out, 0, &opts, NULL, 0);
+ cp_print_value_fields (val, &out, 0, opts, NULL, 0);
SELF_CHECK (out.string () == "{A = false, B = 5, C = true}");
out.clear();
opts.format = 'x';
- cp_print_value_fields(val, &out, 0, &opts, NULL, 0);
+ cp_print_value_fields (val, &out, 0, opts, NULL, 0);
SELF_CHECK (out.string () == "{A = 0x0, B = 0x5, C = 0x1}");
}
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index f6ebf49fc19..437b397a3a4 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -160,7 +160,7 @@ class d_language : public language_defn
void value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options) const override
+ const value_print_options &options) const override
{
return d_value_print_inner (val, stream, recurse, options);
}
diff --git a/gdb/d-lang.h b/gdb/d-lang.h
index 57a4d5bfbac..7921d3ac804 100644
--- a/gdb/d-lang.h
+++ b/gdb/d-lang.h
@@ -82,6 +82,6 @@ extern struct block_symbol d_lookup_nested_symbol (struct type *, const char *,
extern void d_value_print_inner (struct value *val,
struct ui_file *stream, int recurse,
- const value_print_options *options);
+ const value_print_options &options);
#endif /* GDB_D_LANG_H */
diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c
index 493c043a7e2..4713a923db8 100644
--- a/gdb/d-valprint.c
+++ b/gdb/d-valprint.c
@@ -31,7 +31,7 @@ dynamic_array_type (struct type *type,
LONGEST embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
struct value *val,
- const value_print_options *options)
+ const value_print_options &options)
{
if (type->num_fields () == 2
&& type->field (0).type ()->code () == TYPE_CODE_INT
@@ -71,7 +71,7 @@ dynamic_array_type (struct type *type,
void
d_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options)
+ const value_print_options &options)
{
int ret;
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 6f34f187d47..4b1844a1f14 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -5138,7 +5138,7 @@ dwarf2_compute_name (const char *name,
value_print_options opts
= get_formatted_print_options ('d');
opts.raw = true;
- value_print (v, &buf, &opts);
+ value_print (v, &buf, opts);
release_value (v);
}
}
diff --git a/gdb/extension-priv.h b/gdb/extension-priv.h
index 24f9e79a9e5..bb6acdf8290 100644
--- a/gdb/extension-priv.h
+++ b/gdb/extension-priv.h
@@ -165,7 +165,7 @@ struct extension_language_ops
enum ext_lang_rc (*apply_val_pretty_printer)
(const struct extension_language_defn *,
struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
const struct language_defn *language);
/* GDB access to the "frame filter" feature.
diff --git a/gdb/extension.c b/gdb/extension.c
index d82efa88a50..de3b3eb69a5 100644
--- a/gdb/extension.c
+++ b/gdb/extension.c
@@ -468,7 +468,7 @@ ext_lang_type_printers::~ext_lang_type_printers ()
int
apply_ext_lang_val_pretty_printer (struct value *val,
struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
const struct language_defn *language)
{
for (const struct extension_language_defn *extlang : extension_languages)
diff --git a/gdb/extension.h b/gdb/extension.h
index ab5c7b2d167..e500e52f19f 100644
--- a/gdb/extension.h
+++ b/gdb/extension.h
@@ -296,7 +296,7 @@ extern gdb::unique_xmalloc_ptr<char> apply_ext_lang_type_printers
extern int apply_ext_lang_val_pretty_printer
(struct value *value, struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
const struct language_defn *language);
extern enum ext_lang_bt_status apply_ext_lang_frame_filter
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 90062734b0e..5a40995f310 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -1635,7 +1635,7 @@ fortran_structop_operation::evaluate (struct type *expect_type,
void
f_language::print_array_index (struct type *index_type, LONGEST index,
struct ui_file *stream,
- const value_print_options *options) const
+ const value_print_options &options) const
{
struct value *index_value = value_from_longest (index_type, index);
diff --git a/gdb/f-lang.h b/gdb/f-lang.h
index cb48eb3fde0..b660ddf371e 100644
--- a/gdb/f-lang.h
+++ b/gdb/f-lang.h
@@ -64,7 +64,7 @@ class f_language : public language_defn
void print_array_index (struct type *index_type,
LONGEST index,
struct ui_file *stream,
- const value_print_options *options) const override;
+ const value_print_options &options) const override;
/* See language.h. */
void language_arch_info (struct gdbarch *gdbarch,
@@ -137,7 +137,7 @@ class f_language : public language_defn
void value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options) const override;
+ const value_print_options &options) const override;
/* See language.h. */
@@ -170,7 +170,7 @@ class f_language : public language_defn
void printstr (struct ui_file *stream, struct type *elttype,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
- const value_print_options *options) const override
+ const value_print_options &options) const override
{
if (elttype->length () == 4)
gdb_puts ("4_", stream);
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index bff2acf6056..e1b9b8eebc0 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -121,7 +121,7 @@ class fortran_array_printer_impl : public fortran_array_walker_base_impl
struct value *val,
struct ui_file *stream,
int recurse,
- const value_print_options *options)
+ const value_print_options &options)
: m_elts (0),
m_val (val),
m_stream (stream),
@@ -139,7 +139,7 @@ class fortran_array_printer_impl : public fortran_array_walker_base_impl
cases, return true. */
bool continue_walking (bool should_continue)
{
- bool cont = should_continue && (m_elts < m_options->print_max);
+ bool cont = should_continue && (m_elts < m_options.print_max);
if (!cont && should_continue)
gdb_puts ("...", m_stream);
return cont;
@@ -191,11 +191,11 @@ class fortran_array_printer_impl : public fortran_array_walker_base_impl
size_t dim_indx = m_dimension - 1;
struct type *elt_type_prev = m_elt_type_prev;
LONGEST elt_off_prev = m_elt_off_prev;
- bool repeated = (m_options->repeat_count_threshold < UINT_MAX
+ bool repeated = (m_options.repeat_count_threshold < UINT_MAX
&& elt_type_prev != nullptr
&& (m_elts + ((m_nrepeats + 1)
* m_stats[dim_indx + 1].nelts)
- <= m_options->print_max)
+ <= m_options.print_max)
&& dimension_contents_eq (m_val, elt_type,
elt_off_prev, elt_off));
@@ -206,7 +206,7 @@ class fortran_array_printer_impl : public fortran_array_walker_base_impl
LONGEST nrepeats = m_nrepeats;
m_nrepeats = 0;
- if (nrepeats >= m_options->repeat_count_threshold)
+ if (nrepeats >= m_options.repeat_count_threshold)
{
annotate_elt_rep (nrepeats + 1);
gdb_printf (m_stream, "%p[<repeats %s times>%p]",
@@ -234,7 +234,7 @@ class fortran_array_printer_impl : public fortran_array_walker_base_impl
And we need to print `...' by hand if the skipped element
would be the last one processed, because the subsequent call
to `continue_walking' from our caller won't do that. */
- if (m_elts < m_options->print_max)
+ if (m_elts < m_options.print_max)
{
maybe_print_array_index (m_stats[dim_indx].index_type, index,
m_stream, m_options);
@@ -262,7 +262,7 @@ class fortran_array_printer_impl : public fortran_array_walker_base_impl
LONGEST elt_off_prev = m_elt_off_prev;
bool repeated = false;
- if (m_options->repeat_count_threshold < UINT_MAX
+ if (m_options.repeat_count_threshold < UINT_MAX
&& elt_type_prev != nullptr)
{
/* When printing large arrays this spot is called frequently, so clean
@@ -281,7 +281,7 @@ class fortran_array_printer_impl : public fortran_array_walker_base_impl
if (repeated)
m_nrepeats++;
- if (!repeated || last_p || m_elts + 1 == m_options->print_max)
+ if (!repeated || last_p || m_elts + 1 == m_options.print_max)
{
LONGEST nrepeats = m_nrepeats;
bool printed = false;
@@ -289,7 +289,7 @@ class fortran_array_printer_impl : public fortran_array_walker_base_impl
if (nrepeats != 0)
{
m_nrepeats = 0;
- if (nrepeats >= m_options->repeat_count_threshold)
+ if (nrepeats >= m_options.repeat_count_threshold)
{
annotate_elt_rep (nrepeats + 1);
gdb_printf (m_stream, "%p[<repeats %s times>%p]",
@@ -401,7 +401,7 @@ class fortran_array_printer_impl : public fortran_array_walker_base_impl
/* The print control options. Gives us the maximum number of elements to
print, and is passed through to each element that we print. */
- const value_print_options *m_options = nullptr;
+ const value_print_options &m_options;
/* The number of the current dimension being handled. */
LONGEST m_dimension;
@@ -424,7 +424,7 @@ static void
fortran_print_array (struct type *type, CORE_ADDR address,
struct ui_file *stream, int recurse,
const struct value *val,
- const value_print_options *options)
+ const value_print_options &options)
{
fortran_array_walker<fortran_array_printer_impl> p
(type, address, (struct value *) val, stream, recurse, options);
@@ -451,7 +451,7 @@ static const struct generic_val_print_decorations f_decorations =
void
f_language::value_print_inner (struct value *val, struct ui_file *stream,
int recurse,
- const value_print_options *options) const
+ const value_print_options &options) const
{
struct type *type = check_typedef (val->type ());
struct gdbarch *gdbarch = type->arch ();
@@ -485,7 +485,7 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
break;
case TYPE_CODE_PTR:
- if (options->format && options->format != 's')
+ if (options.format && options.format != 's')
{
value_print_scalar_formatted (val, options, 0, stream);
break;
@@ -504,10 +504,10 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
return;
}
- if (options->symbol_print)
+ if (options.symbol_print)
want_space = print_address_demangle (options, gdbarch, addr,
stream, demangle);
- else if (options->addressprint && options->format != 's')
+ else if (options.addressprint && options.format != 's')
{
fputs_styled (paddress (gdbarch, addr), address_style.style (),
stream);
@@ -518,7 +518,7 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
pointed to, unless pointer is null. */
if (elttype->length () == 1
&& elttype->code () == TYPE_CODE_INT
- && (options->format == 0 || options->format == 's')
+ && (options.format == 0 || options.format == 's')
&& addr != 0)
{
if (want_space)
@@ -581,12 +581,12 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
break;
case TYPE_CODE_BOOL:
- if (options->format || options->output_format)
+ if (options.format || options.output_format)
{
- value_print_options opts = *options;
- opts.format = (options->format ? options->format
- : options->output_format);
- value_print_scalar_formatted (val, &opts, 0, stream);
+ value_print_options opts = options;
+ opts.format = (options.format ? options.format
+ : options.output_format);
+ value_print_scalar_formatted (val, opts, 0, stream);
}
else
{
@@ -657,7 +657,7 @@ info_common_command_for_block (const struct block *block, const char *comname,
try
{
val = value_of_variable (common->contents[index], block);
- value_print (val, gdb_stdout, &opts);
+ value_print (val, gdb_stdout, opts);
}
catch (const gdb_exception_error &except)
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 7186362e026..8fdfdad9676 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -2793,7 +2793,7 @@ extern void recursive_dump_type (struct type *, int);
/* printcmd.c */
extern void print_scalar_formatted (const gdb_byte *, struct type *,
- const value_print_options *,
+ const value_print_options &,
int, struct ui_file *);
extern int can_dereference (struct type *);
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index 2ca29ef77d3..834f9b24bf6 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -684,7 +684,7 @@ gnuv3_print_method_ptr (const gdb_byte *contents,
else
{
const value_print_options &opts = get_user_print_options ();
- print_address_demangle (&opts, gdbarch, ptr_value, stream, demangle);
+ print_address_demangle (opts, gdbarch, ptr_value, stream, demangle);
}
if (adjustment)
@@ -870,7 +870,7 @@ compute_vtable_size (vtable_hash_t &offset_hash, struct value *value)
static void
print_one_vtable (struct gdbarch *gdbarch, struct value *value,
int max_voffset,
- const value_print_options *opts)
+ const value_print_options &opts)
{
int i;
struct type *type = check_typedef (value->type ());
@@ -975,7 +975,7 @@ gnuv3_print_vtable (struct value *value)
{
if (count > 0)
gdb_printf ("\n");
- print_one_vtable (gdbarch, item.first, item.second, &opts);
+ print_one_vtable (gdbarch, item.first, item.second, opts);
++count;
}
}
diff --git a/gdb/go-lang.h b/gdb/go-lang.h
index c2be398df52..67f624dc21a 100644
--- a/gdb/go-lang.h
+++ b/gdb/go-lang.h
@@ -123,7 +123,7 @@ class go_language : public language_defn
void value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options) const override;
+ const value_print_options &options) const override;
/* See language.h. */
diff --git a/gdb/go-valprint.c b/gdb/go-valprint.c
index 0ee6571bc75..c99e034369b 100644
--- a/gdb/go-valprint.c
+++ b/gdb/go-valprint.c
@@ -40,7 +40,7 @@ print_go_string (struct type *type,
LONGEST embedded_offset, CORE_ADDR address,
struct ui_file *stream, int recurse,
struct value *val,
- const value_print_options *options)
+ const value_print_options &options)
{
struct gdbarch *gdbarch = type->arch ();
struct type *elt_ptr_type = type->field (0).type ();
@@ -63,7 +63,7 @@ print_go_string (struct type *type,
error (_("Unable to read string length"));
/* TODO(dje): Print address of struct or actual string? */
- if (options->addressprint)
+ if (options.addressprint)
{
fputs_styled (paddress (gdbarch, addr), address_style.style (), stream);
gdb_puts (" ", stream);
@@ -88,7 +88,7 @@ print_go_string (struct type *type,
void
go_language::value_print_inner (struct value *val, struct ui_file *stream,
int recurse,
- const value_print_options *options) const
+ const value_print_options &options) const
{
struct type *type = check_typedef (val->type ());
@@ -101,7 +101,7 @@ go_language::value_print_inner (struct value *val, struct ui_file *stream,
switch (go_type)
{
case GO_TYPE_STRING:
- if (! options->raw)
+ if (! options.raw)
{
print_go_string (type, val->embedded_offset (),
val->address (),
diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h
index 7d406890e62..cb46d7497ea 100644
--- a/gdb/guile/guile-internal.h
+++ b/gdb/guile/guile-internal.h
@@ -500,7 +500,7 @@ extern struct value *lsscm_safe_lazy_string_to_value (SCM string,
extern void lsscm_val_print_lazy_string
(SCM string, struct ui_file *stream,
- const value_print_options *options);
+ const value_print_options &options);
/* scm-objfile.c */
@@ -612,7 +612,7 @@ extern enum ext_lang_rc gdbscm_apply_val_pretty_printer
(const struct extension_language_defn *,
struct value *val,
struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
const struct language_defn *language);
extern int gdbscm_breakpoint_has_cond (const struct extension_language_defn *,
diff --git a/gdb/guile/scm-lazy-string.c b/gdb/guile/scm-lazy-string.c
index 53324172617..1011256c3c8 100644
--- a/gdb/guile/scm-lazy-string.c
+++ b/gdb/guile/scm-lazy-string.c
@@ -349,7 +349,7 @@ lsscm_safe_lazy_string_to_value (SCM string, int arg_pos,
void
lsscm_val_print_lazy_string (SCM string, struct ui_file *stream,
- const value_print_options *options)
+ const value_print_options &options)
{
lazy_string_smob *ls_smob;
struct type *elt_type;
diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c
index 3bf994a7bdf..5545a9070d7 100644
--- a/gdb/guile/scm-pretty-print.c
+++ b/gdb/guile/scm-pretty-print.c
@@ -645,7 +645,7 @@ ppscm_print_exception_unless_memory_error (SCM exception,
static enum guile_string_repr_result
ppscm_print_string_repr (SCM printer, enum display_hint hint,
struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
struct gdbarch *gdbarch,
const struct language_defn *language)
{
@@ -661,11 +661,11 @@ ppscm_print_string_repr (SCM printer, enum display_hint hint,
}
else if (scm_is_eq (str_scm, SCM_BOOL_T))
{
- value_print_options opts = *options;
+ value_print_options opts = options;
gdb_assert (replacement != NULL);
opts.addressprint = false;
- common_val_print (replacement, stream, recurse, &opts, language);
+ common_val_print (replacement, stream, recurse, opts, language);
result = STRING_REPR_OK;
}
else if (scm_is_string (str_scm))
@@ -700,10 +700,10 @@ ppscm_print_string_repr (SCM printer, enum display_hint hint,
}
else if (lsscm_is_lazy_string (str_scm))
{
- value_print_options local_opts = *options;
+ value_print_options local_opts = options;
local_opts.addressprint = false;
- lsscm_val_print_lazy_string (str_scm, stream, &local_opts);
+ lsscm_val_print_lazy_string (str_scm, stream, local_opts);
result = STRING_REPR_OK;
}
else
@@ -725,7 +725,7 @@ ppscm_print_string_repr (SCM printer, enum display_hint hint,
static void
ppscm_print_children (SCM printer, enum display_hint hint,
struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
struct gdbarch *gdbarch,
const struct language_defn *language,
int printed_nothing)
@@ -774,17 +774,17 @@ ppscm_print_children (SCM printer, enum display_hint hint,
/* Use the prettyformat_arrays option if we are printing an array,
and the pretty option otherwise. */
if (is_array)
- pretty = options->prettyformat_arrays;
+ pretty = options.prettyformat_arrays;
else
{
- if (options->prettyformat == Val_prettyformat)
+ if (options.prettyformat == Val_prettyformat)
pretty = 1;
else
- pretty = options->prettyformat_structs;
+ pretty = options.prettyformat_structs;
}
done_flag = 0;
- for (i = 0; i < options->print_max; ++i)
+ for (i = 0; i < options.print_max; ++i)
{
SCM scm_name, v_scm;
SCM item = itscm_safe_call_next_x (iter, gdbscm_memory_error_p);
@@ -847,7 +847,7 @@ ppscm_print_children (SCM printer, enum display_hint hint,
/* In summary mode, we just want to print "= {...}" if there is
a value. */
- if (options->summary)
+ if (options.summary)
{
/* This increment tricks the post-loop logic to print what
we want. */
@@ -874,7 +874,7 @@ ppscm_print_children (SCM printer, enum display_hint hint,
{
/* We print the index, not whatever the child method
returned as the name. */
- if (options->print_array_indexes)
+ if (options.print_array_indexes)
gdb_printf (stream, "[%d] = ", i);
}
else if (! is_map)
@@ -885,10 +885,10 @@ ppscm_print_children (SCM printer, enum display_hint hint,
if (lsscm_is_lazy_string (v_scm))
{
- value_print_options local_opts = *options;
+ value_print_options local_opts = options;
local_opts.addressprint = false;
- lsscm_val_print_lazy_string (v_scm, stream, &local_opts);
+ lsscm_val_print_lazy_string (v_scm, stream, local_opts);
}
else if (scm_is_string (v_scm))
{
@@ -914,12 +914,12 @@ ppscm_print_children (SCM printer, enum display_hint hint,
/* When printing the key of a map we allow one additional
level of depth. This means the key will print before the
value does. */
- value_print_options opt = *options;
+ value_print_options opt = options;
if (is_map && i % 2 == 0
&& opt.max_depth != -1
&& opt.max_depth < INT_MAX)
++opt.max_depth;
- common_val_print (value, stream, recurse + 1, &opt, language);
+ common_val_print (value, stream, recurse + 1, opt, language);
}
}
@@ -957,7 +957,7 @@ enum ext_lang_rc
gdbscm_apply_val_pretty_printer (const struct extension_language_defn *extlang,
struct value *value,
struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
const struct language_defn *language)
{
struct type *type = value->type ();
diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c
index fb739c370ef..27719568809 100644
--- a/gdb/guile/scm-value.c
+++ b/gdb/guile/scm-value.c
@@ -161,7 +161,7 @@ vlscm_print_value_smob (SCM self, SCM port, scm_print_state *pstate)
{
string_file stb;
- common_val_print (v_smob->value, &stb, 0, &opts, current_language);
+ common_val_print (v_smob->value, &stb, 0, opts, current_language);
scm_puts (stb.c_str (), port);
}
catch (const gdb_exception &except)
@@ -1274,7 +1274,7 @@ gdbscm_value_print (SCM self)
gdbscm_gdb_exception exc {};
try
{
- common_val_print (value, &stb, 0, &opts, current_language);
+ common_val_print (value, &stb, 0, opts, current_language);
}
catch (const gdb_exception &except)
{
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 90a49eff8be..4b7cdd0e686 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1652,7 +1652,7 @@ print_return_value_1 (struct ui_out *uiout, struct return_value_info *rv)
{
const value_print_options opts = get_user_print_options ();
string_file stb;
- value_print (rv->value, &stb, &opts);
+ value_print (rv->value, &stb, opts);
uiout->field_stream ("return-value", stb);
}
else
@@ -2423,7 +2423,7 @@ default_print_one_register_info (struct ui_file *file,
value_print_options opts = get_user_print_options ();
opts.deref_ref = true;
- common_val_print (val, &format_stream, 0, &opts, current_language);
+ common_val_print (val, &format_stream, 0, opts, current_language);
if (print_raw_format)
{
@@ -2439,7 +2439,7 @@ default_print_one_register_info (struct ui_file *file,
/* Print the register in hex. */
value_print_options opts = get_formatted_print_options ('x');
opts.deref_ref = true;
- common_val_print (val, &format_stream, 0, &opts, current_language);
+ common_val_print (val, &format_stream, 0, opts, current_language);
/* If not a vector register, print it also according to its
natural format. */
if (print_raw_format && regtype->is_vector () == 0)
@@ -2447,7 +2447,7 @@ default_print_one_register_info (struct ui_file *file,
pad_to_column (format_stream, value_column_2);
opts = get_user_print_options ();
opts.deref_ref = true;
- common_val_print (val, &format_stream, 0, &opts, current_language);
+ common_val_print (val, &format_stream, 0, opts, current_language);
}
}
diff --git a/gdb/language.c b/gdb/language.c
index 25d57af363b..a83ef441279 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -610,7 +610,7 @@ default_word_break_characters (void)
void
language_defn::print_array_index (struct type *index_type, LONGEST index,
struct ui_file *stream,
- const value_print_options *options) const
+ const value_print_options &options) const
{
struct value *index_value = value_from_longest (index_type, index);
@@ -635,7 +635,7 @@ language_defn::watch_location_expression (struct type *type,
void
language_defn::value_print (struct value *val, struct ui_file *stream,
- const value_print_options *options) const
+ const value_print_options &options) const
{
return c_value_print (val, stream, options);
}
@@ -653,7 +653,7 @@ language_defn::parser (struct parser_state *ps) const
void
language_defn::value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options) const
+ const value_print_options &options) const
{
return c_value_print_inner (val, stream, recurse, options);
}
@@ -774,7 +774,7 @@ class unknown_language : public language_defn
/* See language.h. */
void value_print (struct value *val, struct ui_file *stream,
- const value_print_options *options) const override
+ const value_print_options &options) const override
{
error (_("value printing not implemented for language \"%s\""),
natural_name ());
@@ -784,7 +784,7 @@ class unknown_language : public language_defn
void value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options) const override
+ const value_print_options &options) const override
{
error (_("inner value printing not implemented for language \"%s\""),
natural_name ());
@@ -812,7 +812,7 @@ class unknown_language : public language_defn
void printstr (struct ui_file *stream, struct type *elttype,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
- const value_print_options *options) const override
+ const value_print_options &options) const override
{
error (_("print string not implemented for language \"%s\""),
natural_name ());
diff --git a/gdb/language.h b/gdb/language.h
index 3330151ed36..9afe5e960c3 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -305,7 +305,7 @@ struct language_defn
virtual void print_array_index (struct type *index_type,
LONGEST index_value,
struct ui_file *stream,
- const value_print_options *options) const;
+ const value_print_options &options) const;
/* Given a symbol VAR, the corresponding block VAR_BLOCK (if any) and a
stack frame id FRAME, read the value of the variable and return (pointer
@@ -499,13 +499,13 @@ struct language_defn
/* Print a top-level value using syntax appropriate for this language. */
virtual void value_print (struct value *val, struct ui_file *stream,
- const value_print_options *options) const;
+ const value_print_options &options) const;
/* Print a value using syntax appropriate for this language. RECURSE is
the recursion depth. It is zero-based. */
virtual void value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options) const;
+ const value_print_options &options) const;
/* Parser function. */
@@ -522,7 +522,7 @@ struct language_defn
virtual void printstr (struct ui_file *stream, struct type *elttype,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
- const value_print_options *options) const;
+ const value_print_options &options) const;
/* Print a typedef using syntax appropriate for this language.
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index bbeed776f70..4a5d2124926 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -700,7 +700,7 @@ check_thread_db_callback (const td_thrhandle_t *th, void *arg)
{
const value_print_options &opts = get_user_print_options ();
LOG (" = ");
- value_print (val, gdb_stdlog, &opts);
+ value_print (val, gdb_stdlog, opts);
}
}
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index 0fc84e5d4db..7bee1f36dc8 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -179,7 +179,7 @@ void
m2_language::printstr (struct ui_file *stream, struct type *elttype,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
- const value_print_options *options) const
+ const value_print_options &options) const
{
m2_wchar_printer printer (elttype, '"', encoding);
printer.print (stream, string, length, force_ellipses, 0, options);
diff --git a/gdb/m2-lang.h b/gdb/m2-lang.h
index cf082a07e9b..f1640e0301b 100644
--- a/gdb/m2-lang.h
+++ b/gdb/m2-lang.h
@@ -84,7 +84,7 @@ class m2_language : public language_defn
void value_print_inner (struct value *val, struct ui_file *stream,
int recurse,
- const value_print_options *options) const override;
+ const value_print_options &options) const override;
/* See language.h. */
@@ -100,7 +100,7 @@ class m2_language : public language_defn
void printstr (struct ui_file *stream, struct type *elttype,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
- const value_print_options *options) const override;
+ const value_print_options &options) const override;
/* See language.h. */
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index 6bad4c95c08..85266999a54 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -31,12 +31,12 @@
static int print_unpacked_pointer (struct type *type,
CORE_ADDR address, CORE_ADDR addr,
- const value_print_options *options,
+ const value_print_options &options,
struct ui_file *stream);
static void
m2_print_array_contents (struct value *val,
struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
int len);
@@ -157,7 +157,7 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
static void
m2_print_unbounded_array (struct value *value,
struct ui_file *stream, int recurse,
- const value_print_options *options)
+ const value_print_options &options)
{
CORE_ADDR addr;
LONGEST len;
@@ -182,7 +182,7 @@ m2_print_unbounded_array (struct value *value,
static int
print_unpacked_pointer (struct type *type,
CORE_ADDR address, CORE_ADDR addr,
- const value_print_options *options,
+ const value_print_options &options,
struct ui_file *stream)
{
struct gdbarch *gdbarch = type->arch ();
@@ -197,7 +197,7 @@ print_unpacked_pointer (struct type *type,
return 0;
}
- if (options->addressprint && options->format != 's')
+ if (options.addressprint && options.format != 's')
{
fputs_styled (paddress (gdbarch, address), address_style.style (),
stream);
@@ -209,7 +209,7 @@ print_unpacked_pointer (struct type *type,
if (elttype->length () == 1
&& elttype->code () == TYPE_CODE_INT
- && (options->format == 0 || options->format == 's')
+ && (options.format == 0 || options.format == 's')
&& addr != 0)
{
if (want_space)
@@ -226,7 +226,7 @@ print_variable_at_address (struct type *type,
const gdb_byte *valaddr,
struct ui_file *stream,
int recurse,
- const value_print_options *options)
+ const value_print_options &options)
{
struct gdbarch *gdbarch = type->arch ();
CORE_ADDR addr = unpack_pointer (type, valaddr);
@@ -257,7 +257,7 @@ print_variable_at_address (struct type *type,
static void
m2_print_array_contents (struct value *val,
struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
int len)
{
struct type *type = check_typedef (val->type ());
@@ -269,7 +269,7 @@ m2_print_array_contents (struct value *val,
((type->code () == TYPE_CODE_INT)
|| ((current_language->la_language == language_m2)
&& (type->code () == TYPE_CODE_CHAR)))
- && (options->format == 0 || options->format == 's'))
+ && (options.format == 0 || options.format == 's'))
val_print_string (type, NULL, val->address (), len+1, stream,
options);
else
@@ -300,7 +300,7 @@ static const struct generic_val_print_decorations m2_decorations =
void
m2_language::value_print_inner (struct value *val, struct ui_file *stream,
int recurse,
- const value_print_options *options) const
+ const value_print_options &options) const
{
unsigned len;
struct type *elttype;
@@ -321,11 +321,11 @@ m2_language::value_print_inner (struct value *val, struct ui_file *stream,
((elttype->code () == TYPE_CODE_INT)
|| ((current_language->la_language == language_m2)
&& (elttype->code () == TYPE_CODE_CHAR)))
- && (options->format == 0 || options->format == 's'))
+ && (options.format == 0 || options.format == 's'))
{
/* If requested, look for the first null char and only print
elements up to it. */
- if (options->stop_print_at_null)
+ if (options.stop_print_at_null)
{
unsigned int print_max_chars = get_print_max_chars (options);
unsigned int temp_len;
@@ -358,7 +358,7 @@ m2_language::value_print_inner (struct value *val, struct ui_file *stream,
case TYPE_CODE_PTR:
if (TYPE_CONST (type))
print_variable_at_address (type, valaddr, stream, recurse, options);
- else if (options->format && options->format != 's')
+ else if (options.format && options.format != 's')
value_print_scalar_formatted (val, options, 0, stream);
else
{
@@ -368,7 +368,7 @@ m2_language::value_print_inner (struct value *val, struct ui_file *stream,
break;
case TYPE_CODE_UNION:
- if (recurse && !options->unionprint)
+ if (recurse && !options.unionprint)
{
gdb_printf (stream, "{...}");
break;
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index ce58ab15e7f..87ed3d9dcb4 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -547,7 +547,7 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
opts.deref_ref = true;
if (arg->sym->is_argument ())
opts.raw = fp_opts.print_raw_frame_arguments;
- common_val_print (arg->val, &stb, 0, &opts,
+ common_val_print (arg->val, &stb, 0, opts,
language_def (arg->sym->language ()));
}
catch (const gdb_exception_error &except)
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 5e5244619af..750f22a8e46 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -1076,7 +1076,7 @@ output_register (const frame_info_ptr &frame, int regnum, int format,
value_print_options opts = get_formatted_print_options (format);
opts.deref_ref = true;
- common_val_print (val, &stb, 0, &opts, current_language);
+ common_val_print (val, &stb, 0, opts, current_language);
uiout->field_stream ("value", stb);
}
@@ -1160,7 +1160,7 @@ mi_cmd_data_evaluate_expression (const char *command, const char *const *argv,
/* Print the result of the expression evaluation. */
value_print_options opts = get_user_print_options ();
opts.deref_ref = false;
- common_val_print (val, &stb, 0, &opts, current_language);
+ common_val_print (val, &stb, 0, opts, current_language);
uiout->field_stream ("value", stb);
}
@@ -1334,7 +1334,7 @@ mi_cmd_data_read_memory (const char *command, const char *const *argv,
{
stream.clear ();
print_scalar_formatted (&mbuf[col_byte], word_type,
- &print_opts, word_asize, &stream);
+ print_opts, word_asize, &stream);
uiout->field_stream (NULL, stream);
}
}
@@ -2492,7 +2492,7 @@ print_variable_or_computed (const char *expression, enum print_values values)
{
value_print_options opts = get_no_prettyformat_print_options ();
opts.deref_ref = true;
- common_val_print (val, &stb, 0, &opts, current_language);
+ common_val_print (val, &stb, 0, opts, current_language);
uiout->field_stream ("value", stb);
}
break;
@@ -2500,7 +2500,7 @@ print_variable_or_computed (const char *expression, enum print_values values)
{
value_print_options opts = get_no_prettyformat_print_options ();
opts.deref_ref = true;
- common_val_print (val, &stb, 0, &opts, current_language);
+ common_val_print (val, &stb, 0, opts, current_language);
uiout->field_stream ("value", stb);
}
break;
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 6532884f69b..3026f2c1e92 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -6349,7 +6349,7 @@ mips_print_fp_register (struct ui_file *file, const frame_info_ptr &frame,
value_print_options opts = get_formatted_print_options ('x');
print_scalar_formatted (raw_buffer.data (),
builtin_type (gdbarch)->builtin_uint32,
- &opts, 'w', file);
+ opts, 'w', file);
gdb_printf (file, " flt: %s", flt_str.c_str ());
@@ -6376,7 +6376,7 @@ mips_print_fp_register (struct ui_file *file, const frame_info_ptr &frame,
value_print_options opts = get_formatted_print_options ('x');
print_scalar_formatted (raw_buffer.data (),
builtin_type (gdbarch)->builtin_uint64,
- &opts, 'g', file);
+ opts, 'g', file);
gdb_printf (file, " flt: %s", flt_str.c_str ());
gdb_printf (file, " dbl: %s", dbl_str.c_str ());
@@ -6410,7 +6410,7 @@ mips_print_register (struct ui_file *file, const frame_info_ptr &frame,
gdb_printf (file, ": ");
value_print_options opts = get_formatted_print_options ('x');
- value_print_scalar_formatted (val, &opts, 0, file);
+ value_print_scalar_formatted (val, opts, 0, file);
}
/* Print IEEE exception condition bits in FLAGS. */
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index b727255ea12..457642e00eb 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -212,7 +212,7 @@ void
pascal_language::printstr (struct ui_file *stream, struct type *elttype,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
- const value_print_options *options) const
+ const value_print_options &options) const
{
pascal_wchar_printer printer (elttype, '\'', encoding);
printer.print (stream, string, length, force_ellipses, 0, options);
diff --git a/gdb/p-lang.h b/gdb/p-lang.h
index 4c80e1b21c4..89c59e27450 100644
--- a/gdb/p-lang.h
+++ b/gdb/p-lang.h
@@ -95,13 +95,13 @@ class pascal_language : public language_defn
/* See language.h. */
void value_print (struct value *val, struct ui_file *stream,
- const value_print_options *options) const override;
+ const value_print_options &options) const override;
/* See language.h. */
void value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options) const override;
+ const value_print_options &options) const override;
/* See language.h. */
@@ -117,7 +117,7 @@ class pascal_language : public language_defn
void printstr (struct ui_file *stream, struct type *elttype,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
- const value_print_options *options) const override;
+ const value_print_options &options) const override;
/* See language.h. */
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 4f94189b6e6..d647090fcd0 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -44,7 +44,7 @@
static void pascal_object_print_value_fields (struct value *, struct ui_file *,
int,
- const value_print_options *,
+ const value_print_options &,
struct type **, int);
/* Decorations for Pascal. */
@@ -66,7 +66,7 @@ static const struct generic_val_print_decorations p_decorations =
void
pascal_language::value_print_inner (struct value *val,
struct ui_file *stream, int recurse,
- const value_print_options *options) const
+ const value_print_options &options) const
{
struct type *type = check_typedef (val->type ());
@@ -96,14 +96,14 @@ pascal_language::value_print_inner (struct value *val,
/* If 's' format is used, try to print out as string.
If no format is given, print as string if element type
is of TYPE_CODE_CHAR and element size is 1,2 or 4. */
- if (options->format == 's'
+ if (options.format == 's'
|| ((eltlen == 1 || eltlen == 2 || eltlen == 4)
&& elttype->code () == TYPE_CODE_CHAR
- && options->format == 0))
+ && options.format == 0))
{
/* If requested, look for the first null char and only print
elements up to it. */
- if (options->stop_print_at_null)
+ if (options.stop_print_at_null)
{
unsigned int print_max_chars
= get_print_max_chars (options);
@@ -148,12 +148,12 @@ pascal_language::value_print_inner (struct value *val,
goto print_unpacked_pointer;
case TYPE_CODE_PTR:
- if (options->format && options->format != 's')
+ if (options.format && options.format != 's')
{
value_print_scalar_formatted (val, options, 0, stream);
break;
}
- if (options->vtblprint && pascal_object_is_vtbl_ptr_type (type))
+ if (options.vtblprint && pascal_object_is_vtbl_ptr_type (type))
{
/* Print the unmangled name if desired. */
/* Print vtable entry - we only get here if we ARE using
@@ -177,7 +177,7 @@ pascal_language::value_print_inner (struct value *val,
return;
}
- if (options->addressprint && options->format != 's')
+ if (options.addressprint && options.format != 's')
{
fputs_styled (paddress (gdbarch, addr), address_style.style (),
stream);
@@ -191,7 +191,7 @@ pascal_language::value_print_inner (struct value *val,
|| elttype->code () == TYPE_CODE_CHAR))
|| ((elttype->length () == 2 || elttype->length () == 4)
&& elttype->code () == TYPE_CODE_CHAR))
- && (options->format == 0 || options->format == 's')
+ && (options.format == 0 || options.format == 's')
&& addr != 0)
{
if (want_space)
@@ -230,7 +230,7 @@ pascal_language::value_print_inner (struct value *val,
= lookup_minimal_symbol_by_pc (vt_address);
/* If 'symbol_print' is set, we did the work above. */
- if (!options->symbol_print
+ if (!options.symbol_print
&& (msymbol.minsym != NULL)
&& (vt_address == msymbol.value_address ()))
{
@@ -241,7 +241,7 @@ pascal_language::value_print_inner (struct value *val,
gdb_puts (">", stream);
want_space = 1;
}
- if (vt_address && options->vtblprint)
+ if (vt_address && options.vtblprint)
{
struct value *vt_val;
struct symbol *wsym = NULL;
@@ -268,7 +268,7 @@ pascal_language::value_print_inner (struct value *val,
vt_val = value_at (wtype, vt_address);
common_val_print (vt_val, stream, recurse + 1, options,
current_language);
- if (options->prettyformat)
+ if (options.prettyformat)
{
gdb_printf (stream, "\n");
print_spaces (2 + 2 * recurse, stream);
@@ -294,14 +294,14 @@ pascal_language::value_print_inner (struct value *val,
break;
case TYPE_CODE_UNION:
- if (recurse && !options->unionprint)
+ if (recurse && !options.unionprint)
{
gdb_printf (stream, "{...}");
break;
}
[[fallthrough]];
case TYPE_CODE_STRUCT:
- if (options->vtblprint && pascal_object_is_vtbl_ptr_type (type))
+ if (options.vtblprint && pascal_object_is_vtbl_ptr_type (type))
{
/* Print the unmangled name if desired. */
/* Print vtable entry - we only get here if NOT using
@@ -407,10 +407,10 @@ pascal_language::value_print_inner (struct value *val,
\f
void
pascal_language::value_print (struct value *val, struct ui_file *stream,
- const value_print_options *options) const
+ const value_print_options &options) const
{
struct type *type = val->type ();
- value_print_options opts = *options;
+ value_print_options opts = options;
opts.deref_ref = true;
@@ -439,7 +439,7 @@ pascal_language::value_print (struct value *val, struct ui_file *stream,
gdb_printf (stream, ") ");
}
}
- common_val_print (val, stream, 0, &opts, current_language);
+ common_val_print (val, stream, 0, opts, current_language);
}
@@ -456,10 +456,10 @@ static struct obstack dont_print_statmem_obstack;
static void pascal_object_print_static_field (struct value *,
struct ui_file *, int,
- const value_print_options *);
+ const value_print_options &);
static void pascal_object_print_value (struct value *, struct ui_file *, int,
- const value_print_options *,
+ const value_print_options &,
struct type **);
/* It was changed to this after 2.4.5. */
@@ -513,7 +513,7 @@ pascal_object_is_vtbl_member (struct type *type)
static void
pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
int recurse,
- const value_print_options *options,
+ const value_print_options &options,
struct type **dont_print_vb,
int dont_print_statmem)
{
@@ -552,14 +552,14 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
for (i = n_baseclasses; i < len; i++)
{
/* If requested, skip printing of static fields. */
- if (!options->pascal_static_field_print
+ if (!options.pascal_static_field_print
&& type->field (i).is_static ())
continue;
if (fields_seen)
gdb_printf (stream, ", ");
else if (n_baseclasses > 0)
{
- if (options->prettyformat)
+ if (options.prettyformat)
{
gdb_printf (stream, "\n");
print_spaces (2 + 2 * recurse, stream);
@@ -570,7 +570,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
}
fields_seen = 1;
- if (options->prettyformat)
+ if (options.prettyformat)
{
gdb_printf (stream, "\n");
print_spaces (2 + 2 * recurse, stream);
@@ -618,12 +618,12 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
}
else
{
- value_print_options opts = *options;
+ value_print_options opts = options;
v = value_field_bitfield (type, i, valaddr, 0, val);
opts.deref_ref = false;
- common_val_print (v, stream, recurse + 1, &opts,
+ common_val_print (v, stream, recurse + 1, opts,
current_language);
}
}
@@ -650,13 +650,13 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
}
else
{
- value_print_options opts = *options;
+ value_print_options opts = options;
opts.deref_ref = false;
struct value *v = val->primitive_field (0, i,
val->type ());
- common_val_print (v, stream, recurse + 1, &opts,
+ common_val_print (v, stream, recurse + 1, opts,
current_language);
}
}
@@ -671,7 +671,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
dont_print_statmem_obstack = tmp_obstack;
}
- if (options->prettyformat)
+ if (options.prettyformat)
{
gdb_printf (stream, "\n");
print_spaces (2 * recurse, stream);
@@ -686,7 +686,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
static void
pascal_object_print_value (struct value *val, struct ui_file *stream,
int recurse,
- const value_print_options *options,
+ const value_print_options &options,
struct type **dont_print_vb)
{
struct type **last_dont_print
@@ -762,7 +762,7 @@ pascal_object_print_value (struct value *val, struct ui_file *stream,
}
}
- if (options->prettyformat)
+ if (options.prettyformat)
{
gdb_printf (stream, "\n");
print_spaces (2 * recurse, stream);
@@ -813,7 +813,7 @@ static void
pascal_object_print_static_field (struct value *val,
struct ui_file *stream,
int recurse,
- const value_print_options *options)
+ const value_print_options &options)
{
struct type *type = val->type ();
value_print_options opts;
@@ -855,9 +855,9 @@ pascal_object_print_static_field (struct value *val,
return;
}
- opts = *options;
+ opts = options;
opts.deref_ref = false;
- common_val_print (val, stream, recurse, &opts, current_language);
+ common_val_print (val, stream, recurse, opts, current_language);
}
INIT_GDB_FILE (pascal_valprint)
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 64df1030bb0..e103602bde1 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -287,7 +287,7 @@ decode_format (const char **string_ptr, int oformat, int osize)
static void
print_formatted (struct value *val, int size,
- const value_print_options *options,
+ const value_print_options &options,
struct ui_file *stream)
{
struct type *type = check_typedef (val->type ());
@@ -298,7 +298,7 @@ print_formatted (struct value *val, int size,
if (size)
{
- switch (options->format)
+ switch (options.format)
{
case 's':
{
@@ -322,7 +322,7 @@ print_formatted (struct value *val, int size,
}
}
- if (options->format == 0 || options->format == 's'
+ if (options.format == 0 || options.format == 's'
|| type->code () == TYPE_CODE_VOID
|| type->code () == TYPE_CODE_REF
|| type->code () == TYPE_CODE_ARRAY
@@ -363,7 +363,7 @@ float_type_from_length (struct type *type)
void
print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
- const value_print_options *options,
+ const value_print_options &options,
int size, struct ui_file *stream)
{
struct gdbarch *gdbarch = type->arch ();
@@ -371,7 +371,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
enum bfd_endian byte_order = type_byte_order (type);
/* String printing should go through val_print_scalar_formatted. */
- gdb_assert (options->format != 's');
+ gdb_assert (options.format != 's');
/* If the value is a pointer, and pointers and addresses are not the
same, then at this point, the value's length (in target bytes) is
@@ -382,8 +382,8 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
/* If we are printing it as unsigned, truncate it in case it is actually
a negative signed value (e.g. "print/u (short)-1" should print 65535
(if shorts are 16 bits) instead of 4294967295). */
- if (options->format != 'c'
- && (options->format != 'd' || type->is_unsigned ()))
+ if (options.format != 'c'
+ && (options.format != 'd' || type->is_unsigned ()))
{
if (len < type->length () && byte_order == BFD_ENDIAN_BIG)
valaddr += type->length () - len;
@@ -398,7 +398,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
valaddr = &zero;
}
- if (size != 0 && (options->format == 'x' || options->format == 't'))
+ if (size != 0 && (options.format == 'x' || options.format == 't'))
{
/* Truncate to fit. */
unsigned newlen;
@@ -432,12 +432,12 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
here for possible use later. */
std::optional<LONGEST> val_long;
if ((is_fixed_point_type (type)
- && (options->format == 'o'
- || options->format == 'x'
- || options->format == 't'
- || options->format == 'z'
- || options->format == 'd'
- || options->format == 'u'))
+ && (options.format == 'o'
+ || options.format == 'x'
+ || options.format == 't'
+ || options.format == 'z'
+ || options.format == 'd'
+ || options.format == 'u'))
|| (type->code () == TYPE_CODE_RANGE && type->bounds ()->bias != 0)
|| type->bit_size_differs_p ())
{
@@ -451,7 +451,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
/* Printing a non-float type as 'f' will interpret the data as if it were
of a floating-point type of the same length, if that exists. Otherwise,
the data is printed as integer. */
- char format = options->format;
+ char format = options.format;
if (format == 'f' && type->code () != TYPE_CODE_FLT)
{
type = float_type_from_length (type);
@@ -493,7 +493,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
break;
case 'c':
{
- value_print_options opts = *options;
+ value_print_options opts = options;
if (!val_long.has_value ())
val_long.emplace (unpack_long (type, valaddr));
@@ -504,7 +504,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
else
type = builtin_type (gdbarch)->builtin_true_char;
- value_print (value_from_longest (type, *val_long), stream, &opts);
+ value_print (value_from_longest (type, *val_long), stream, opts);
}
break;
@@ -762,11 +762,11 @@ pc_prefix (CORE_ADDR addr)
Return non-zero if anything was printed; zero otherwise. */
int
-print_address_demangle (const value_print_options *opts,
+print_address_demangle (const value_print_options &opts,
struct gdbarch *gdbarch, CORE_ADDR addr,
struct ui_file *stream, int do_demangle)
{
- if (opts->addressprint)
+ if (opts.addressprint)
{
fputs_styled (paddress (gdbarch, addr), address_style.style (), stream);
print_address_symbolic (gdbarch, addr, stream, do_demangle, " ");
@@ -926,14 +926,14 @@ integer_is_zero (const gdb_byte *x, int len)
/* Find the start address of a string in which ADDR is included.
Basically we search for '\0' and return the next address,
- but if OPTIONS->PRINT_MAX is smaller than the length of a string,
+ but if OPTIONS.PRINT_MAX is smaller than the length of a string,
we stop searching and return the address to print characters as many as
PRINT_MAX from the string. */
static CORE_ADDR
find_string_backward (struct gdbarch *gdbarch,
CORE_ADDR addr, int count, int char_size,
- const value_print_options *options,
+ const value_print_options &options,
int *strings_counted)
{
const int chunk_size = 0x20;
@@ -1124,7 +1124,7 @@ do_examine_next_address (struct format_data fmt)
{
next_address = find_string_backward (gdbarch, next_address,
count, val_type->length (),
- &opts, &count);
+ opts, &count);
}
else
{
@@ -1209,7 +1209,7 @@ do_examine_next_address (struct format_data fmt)
last_examine_value
= release_value (value_at_lazy (val_type, next_address));
- print_formatted (last_examine_value.get (), size, &opts, gdb_stdout);
+ print_formatted (last_examine_value.get (), size, opts, gdb_stdout);
/* Display any branch delay slots following the final insn. */
if (format == 'i' && count == 1)
@@ -1246,13 +1246,13 @@ validate_format (struct format_data fmt, const char *cmdname)
void
print_command_parse_format (const char **expp, const char *cmdname,
- value_print_options *opts)
+ value_print_options &opts)
{
const char *exp = *expp;
- /* opts->raw value might already have been set by 'set print raw-values'
+ /* opts.raw value might already have been set by 'set print raw-values'
or by using 'print -raw-values'.
- So, do not set opts->raw to 0, only set it to 1 if /r is given. */
+ So, do not set opts.raw to 0, only set it to 1 if /r is given. */
if (exp && *exp == '/')
{
format_data fmt;
@@ -1262,12 +1262,12 @@ print_command_parse_format (const char **expp, const char *cmdname,
validate_format (fmt, cmdname);
last_format = fmt.format;
- opts->format = fmt.format;
- opts->raw = opts->raw || fmt.raw;
+ opts.format = fmt.format;
+ opts.raw = opts.raw || fmt.raw;
}
else
{
- opts->format = 0;
+ opts.format = 0;
}
*expp = exp;
@@ -1293,7 +1293,7 @@ print_value (value *val, const value_print_options &opts)
annotate_value_history_value ();
- print_formatted (val, 0, &opts, gdb_stdout);
+ print_formatted (val, 0, opts, gdb_stdout);
gdb_printf ("\n");
annotate_value_history_end ();
@@ -1331,12 +1331,12 @@ should_validate_memtags (gdbarch *gdbarch, struct value *value)
/* Helper for parsing arguments for print_command_1. */
static struct value *
-process_print_command_args (const char *args, value_print_options *print_opts,
+process_print_command_args (const char *args, value_print_options &print_opts,
bool voidprint)
{
- *print_opts = get_user_print_options ();
+ print_opts = get_user_print_options ();
/* Override global settings with explicit options, if any. */
- auto group = make_value_print_options_def_group (print_opts);
+ auto group = make_value_print_options_def_group (&print_opts);
gdb::option::process_options
(&args, gdb::option::PROCESS_OPTIONS_REQUIRE_DELIMITER, group);
@@ -1349,7 +1349,7 @@ process_print_command_args (const char *args, value_print_options *print_opts,
/* This setting allows large arrays to be printed by limiting the
number of elements that are loaded into GDB's memory; we only
need to load as many array elements as we plan to print. */
- scoped_array_length_limiting limit_large_arrays (print_opts->print_max);
+ scoped_array_length_limiting limit_large_arrays (print_opts.print_max);
/* VOIDPRINT is true to indicate that we do want to print a void
value, so invert it for parse_expression. */
@@ -1372,7 +1372,7 @@ print_command_1 (const char *args, int voidprint)
{
value_print_options print_opts;
- struct value *val = process_print_command_args (args, &print_opts, voidprint);
+ struct value *val = process_print_command_args (args, print_opts, voidprint);
if (voidprint || (val && val->type () &&
val->type ()->code () != TYPE_CODE_VOID))
@@ -1483,7 +1483,7 @@ output_command (const char *exp, int from_tty)
need to load as many array elements as we plan to print. */
scoped_array_length_limiting limit_large_arrays (opts.print_max);
- print_formatted (val, fmt.size, &opts, gdb_stdout);
+ print_formatted (val, fmt.size, opts, gdb_stdout);
annotate_value_end ();
@@ -2212,7 +2212,7 @@ do_one_display (struct display *d)
struct value *val;
val = d->exp->evaluate ();
- print_formatted (val, d->format.size, &opts, gdb_stdout);
+ print_formatted (val, d->format.size, opts, gdb_stdout);
}
catch (const gdb_exception_error &ex)
{
@@ -2386,7 +2386,7 @@ print_variable_value (symbol *var, const frame_info_ptr &frame,
val = read_var_value (var, NULL, frame);
value_print_options opts = get_user_print_options ();
opts.deref_ref = true;
- common_val_print_checked (val, stream, indent, &opts, language);
+ common_val_print_checked (val, stream, indent, opts, language);
}
catch (const gdb_exception_error &except)
{
@@ -2909,7 +2909,7 @@ ui_printf (const char *arg, struct ui_file *stream)
args_ptr);
}
- print_formatted (val_args[i], 0, &print_opts, stream);
+ print_formatted (val_args[i], 0, print_opts, stream);
}
break;
case literal_piece:
@@ -2991,7 +2991,7 @@ memory_tag_print_tag_command (const char *args, enum memtag_type tag_type)
then fetch the logical or allocation tag. */
value_print_options print_opts;
- struct value *val = process_print_command_args (args, &print_opts, true);
+ struct value *val = process_print_command_args (args, print_opts, true);
gdbarch *arch = current_inferior ()->arch ();
/* If the address is not in a region memory mapped with a memory tagging
@@ -3012,7 +3012,7 @@ memory_tag_print_tag_command (const char *args, enum memtag_type tag_type)
== memtag_type::logical? "Logical" : "Allocation");
struct value *v_tag = process_print_command_args (tag.c_str (),
- &print_opts,
+ print_opts,
true);
print_opts.output_format = 'x';
print_value (v_tag, print_opts);
@@ -3046,7 +3046,7 @@ memory_tag_print_allocation_tag_command (const char *args, int from_tty)
static void
parse_with_logical_tag_input (const char *args, struct value **val,
gdb::byte_vector &tags,
- value_print_options *print_opts)
+ value_print_options &print_opts)
{
/* Fetch the address. */
std::string address_string = extract_string_maybe_quoted (&args);
@@ -3085,7 +3085,7 @@ memory_tag_with_logical_tag_command (const char *args, int from_tty)
gdbarch *arch = current_inferior ()->arch ();
/* Parse the input. */
- parse_with_logical_tag_input (args, &val, tags, &print_opts);
+ parse_with_logical_tag_input (args, &val, tags, print_opts);
/* Setting the logical tag is just a local operation that does not touch
any memory from the target. Given an input value, we modify the value
@@ -3125,7 +3125,7 @@ parse_set_allocation_tag_input (const char *args, struct value **val,
/* Parse the address into a value. */
value_print_options print_opts;
- *val = process_print_command_args (address_string.c_str (), &print_opts,
+ *val = process_print_command_args (address_string.c_str (), print_opts,
true);
/* Fetch the length. */
@@ -3203,7 +3203,7 @@ memory_tag_check_command (const char *args, int from_tty)
pointer, then check its logical tag against the allocation tag. */
value_print_options print_opts;
- struct value *val = process_print_command_args (args, &print_opts, true);
+ struct value *val = process_print_command_args (args, print_opts, true);
gdbarch *arch = current_inferior ()->arch ();
CORE_ADDR addr = value_as_address (val);
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index d095a9779db..2777b944097 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -221,7 +221,7 @@ py_print_type (struct ui_out *out, struct value *val)
static void
py_print_value (struct ui_out *out, struct value *val,
- const value_print_options *opts,
+ const value_print_options &opts,
int indent,
enum ext_lang_frame_args args_type,
const struct language_defn *language)
@@ -304,7 +304,7 @@ py_print_single_arg (struct ui_out *out,
const char *sym_name,
struct frame_arg *fa,
struct value *fv,
- const value_print_options *opts,
+ const value_print_options &opts,
enum ext_lang_frame_args args_type,
int print_args_field,
const struct language_defn *language)
@@ -485,7 +485,7 @@ enumerate_args (PyObject *iter,
if (arg.entry_kind != print_entry_values_only)
{
py_print_single_arg (out, NULL, &arg,
- NULL, &opts,
+ NULL, opts,
args_type,
print_args_field,
NULL);
@@ -499,7 +499,7 @@ enumerate_args (PyObject *iter,
out->wrap_hint (4);
}
- py_print_single_arg (out, NULL, &entryarg, NULL, &opts,
+ py_print_single_arg (out, NULL, &entryarg, NULL, opts,
args_type, print_args_field, NULL);
}
}
@@ -507,7 +507,7 @@ enumerate_args (PyObject *iter,
{
/* If the object has provided a value, we just print that. */
if (val != NULL)
- py_print_single_arg (out, sym_name.get (), NULL, val, &opts,
+ py_print_single_arg (out, sym_name.get (), NULL, val, opts,
args_type, print_args_field,
language);
}
@@ -605,13 +605,13 @@ enumerate_locals (PyObject *iter,
{
int val_indent = (indent + 1) * 4;
- py_print_value (out, val, &opts, val_indent, args_type,
+ py_print_value (out, val, opts, val_indent, args_type,
language);
}
else
{
if (args_type != NO_VALUES)
- py_print_value (out, val, &opts, 0, args_type,
+ py_print_value (out, val, opts, 0, args_type,
language);
}
diff --git a/gdb/python/py-lazy-string.c b/gdb/python/py-lazy-string.c
index e095bc3fb69..e155e1ee2ef 100644
--- a/gdb/python/py-lazy-string.c
+++ b/gdb/python/py-lazy-string.c
@@ -313,7 +313,7 @@ stpy_str (PyObject *self)
{
struct type *type = stpy_lazy_string_elt_type (str);
val_print_string (type, str->encoding, str->address, str->length,
- &stream, &opts);
+ &stream, opts);
}
catch (const gdb_exception &exc)
{
diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c
index 057d6b35aaf..ce6ed699f3e 100644
--- a/gdb/python/py-prettyprint.c
+++ b/gdb/python/py-prettyprint.c
@@ -281,7 +281,7 @@ print_stack_unless_memory_error (struct ui_file *stream)
static enum gdbpy_string_repr_result
print_string_repr (PyObject *printer, const char *hint,
struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
const struct language_defn *language,
struct gdbarch *gdbarch)
{
@@ -299,14 +299,14 @@ print_string_repr (PyObject *printer, const char *hint,
long length;
struct type *type;
gdb::unique_xmalloc_ptr<char> encoding;
- value_print_options local_opts = *options;
+ value_print_options local_opts = options;
gdbpy_extract_lazy_string (py_str.get (), &addr, &type,
&length, &encoding);
local_opts.addressprint = false;
val_print_string (type, encoding.get (), addr, (int) length,
- stream, &local_opts);
+ stream, local_opts);
}
else
{
@@ -338,10 +338,10 @@ print_string_repr (PyObject *printer, const char *hint,
}
else if (replacement)
{
- value_print_options opts = *options;
+ value_print_options opts = options;
opts.addressprint = false;
- common_val_print (replacement, stream, recurse, &opts, language);
+ common_val_print (replacement, stream, recurse, opts, language);
}
else
{
@@ -358,7 +358,7 @@ print_string_repr (PyObject *printer, const char *hint,
static void
print_children (PyObject *printer, const char *hint,
struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
const struct language_defn *language,
int is_py_none)
{
@@ -391,17 +391,17 @@ print_children (PyObject *printer, const char *hint,
/* Use the prettyformat_arrays option if we are printing an array,
and the pretty option otherwise. */
if (is_array)
- pretty = options->prettyformat_arrays;
+ pretty = options.prettyformat_arrays;
else
{
- if (options->prettyformat == Val_prettyformat)
+ if (options.prettyformat == Val_prettyformat)
pretty = 1;
else
- pretty = options->prettyformat_structs;
+ pretty = options.prettyformat_structs;
}
done_flag = 0;
- for (i = 0; i < options->print_max; ++i)
+ for (i = 0; i < options.print_max; ++i)
{
PyObject *py_v;
const char *name;
@@ -462,7 +462,7 @@ print_children (PyObject *printer, const char *hint,
/* In summary mode, we just want to print "= {...}" if there is
a value. */
- if (options->summary)
+ if (options.summary)
{
/* This increment tricks the post-loop logic to print what
we want. */
@@ -489,7 +489,7 @@ print_children (PyObject *printer, const char *hint,
{
/* We print the index, not whatever the child method
returned as the name. */
- if (options->print_array_indexes)
+ if (options.print_array_indexes)
gdb_printf (stream, "[%d] = ", i);
}
else if (! is_map)
@@ -504,13 +504,13 @@ print_children (PyObject *printer, const char *hint,
struct type *type;
long length;
gdb::unique_xmalloc_ptr<char> encoding;
- value_print_options local_opts = *options;
+ value_print_options local_opts = options;
gdbpy_extract_lazy_string (py_v, &addr, &type, &length, &encoding);
local_opts.addressprint = false;
val_print_string (type, encoding.get (), addr, (int) length, stream,
- &local_opts);
+ local_opts);
}
else if (gdbpy_is_string (py_v))
{
@@ -536,12 +536,12 @@ print_children (PyObject *printer, const char *hint,
/* When printing the key of a map we allow one additional
level of depth. This means the key will print before the
value does. */
- value_print_options opt = *options;
+ value_print_options opt = options;
if (is_map && i % 2 == 0
&& opt.max_depth != -1
&& opt.max_depth < INT_MAX)
++opt.max_depth;
- common_val_print (value, stream, recurse + 1, &opt, language);
+ common_val_print (value, stream, recurse + 1, opt, language);
}
}
@@ -573,7 +573,7 @@ enum ext_lang_rc
gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang,
struct value *value,
struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
const struct language_defn *language)
{
struct type *type = value->type ();
@@ -611,7 +611,7 @@ gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang,
return EXT_LANG_RC_NOP;
scoped_restore set_options = make_scoped_restore (&gdbpy_current_print_options,
- options);
+ &options);
/* If we are printing a map, we want some special formatting. */
gdb::unique_xmalloc_ptr<char> hint (gdbpy_get_display_hint (printer.get ()));
@@ -642,10 +642,10 @@ gdbpy_ref<>
apply_varobj_pretty_printer (PyObject *printer_obj,
struct value **replacement,
struct ui_file *stream,
- const value_print_options *opts)
+ const value_print_options &opts)
{
scoped_restore set_options = make_scoped_restore (&gdbpy_current_print_options,
- opts);
+ &opts);
*replacement = NULL;
gdbpy_ref<> py_str = pretty_print_one_value (printer_obj, replacement);
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index ec682c34ebc..022526b85f4 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -222,7 +222,7 @@ unwind_infopy_str (PyObject *self)
{
try
{
- value_print (value, &stb, &opts);
+ value_print (value, &stb, opts);
stb.puts (")");
}
catch (const gdb_exception &except)
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index a63af395e2c..9d5986d3767 100644
--- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c
@@ -789,7 +789,7 @@ valpy_format_string (PyObject *self, PyObject *args, PyObject *kw)
try
{
common_val_print (((value_object *) self)->value, &stb, 0,
- &opts, current_language);
+ opts, current_language);
}
catch (const gdb_exception &except)
{
@@ -1255,7 +1255,7 @@ valpy_str (PyObject *self)
try
{
common_val_print (((value_object *) self)->value, &stb, 0,
- &opts, current_language);
+ opts, current_language);
}
catch (const gdb_exception &except)
{
diff --git a/gdb/python/py-varobj.c b/gdb/python/py-varobj.c
index b307dd1eb7e..e133c1c252b 100644
--- a/gdb/python/py-varobj.c
+++ b/gdb/python/py-varobj.c
@@ -24,7 +24,7 @@
struct py_varobj_iter : public varobj_iter
{
py_varobj_iter (struct varobj *var, gdbpy_ref<> &&pyiter,
- const value_print_options *opts);
+ const value_print_options &opts);
~py_varobj_iter () override;
std::unique_ptr<varobj_item> next () override;
@@ -132,10 +132,10 @@ py_varobj_iter::next ()
python iterator actually responsible for the iteration. */
py_varobj_iter::py_varobj_iter (struct varobj *var, gdbpy_ref<> &&pyiter,
- const value_print_options *opts)
+ const value_print_options &opts)
: m_var (var),
m_iter (pyiter.release ()),
- m_opts (*opts)
+ m_opts (opts)
{
}
@@ -144,7 +144,7 @@ py_varobj_iter::py_varobj_iter (struct varobj *var, gdbpy_ref<> &&pyiter,
std::unique_ptr<varobj_iter>
py_varobj_get_iterator (struct varobj *var, PyObject *printer,
- const value_print_options *opts)
+ const value_print_options &opts)
{
gdbpy_enter_varobj enter_py (var);
@@ -152,7 +152,7 @@ py_varobj_get_iterator (struct varobj *var, PyObject *printer,
return NULL;
scoped_restore set_options = make_scoped_restore (&gdbpy_current_print_options,
- opts);
+ &opts);
gdbpy_ref<> children (PyObject_CallMethodObjArgs (printer, gdbpy_children_cst,
NULL));
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index d7acd873f0f..3f9ccaa3132 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -435,7 +435,7 @@ extern enum ext_lang_rc gdbpy_apply_val_pretty_printer
(const struct extension_language_defn *,
struct value *value,
struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
const struct language_defn *language);
extern void gdbpy_load_ptwrite_filter
(const struct extension_language_defn *extlang,
@@ -968,7 +968,7 @@ int gdbpy_is_value_object (PyObject *obj);
gdbpy_ref<> apply_varobj_pretty_printer (PyObject *print_obj,
struct value **replacement,
struct ui_file *stream,
- const value_print_options *opts);
+ const value_print_options &opts);
gdbpy_ref<> gdbpy_get_varobj_pretty_printer (struct value *value);
gdb::unique_xmalloc_ptr<char> gdbpy_get_display_hint (PyObject *printer);
PyObject *gdbpy_default_visualizer (PyObject *self, PyObject *args);
@@ -1034,7 +1034,7 @@ struct varobj;
std::unique_ptr<varobj_iter> py_varobj_get_iterator
(struct varobj *var,
PyObject *printer,
- const value_print_options *opts);
+ const value_print_options &opts);
/* Deleter for Py_buffer unique_ptr specialization. */
diff --git a/gdb/record-full.c b/gdb/record-full.c
index c843236e5fe..63de543b87d 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -2821,7 +2821,7 @@ maintenance_print_record_instruction (const char *args, int from_tty)
entry.get_loc ());
gdb_printf ("Register %s changed: ",
gdbarch_register_name (arch, entry.reg ().num));
- value_print (val, gdb_stdout, &opts);
+ value_print (val, gdb_stdout, opts);
gdb_printf ("\n");
break;
}
@@ -2843,7 +2843,7 @@ maintenance_print_record_instruction (const char *args, int from_tty)
value *val = value_from_contents (regtype, to_print->pc.get_loc ());
gdb_printf ("Register %s changed: ",
gdbarch_register_name (arch, to_print->pc.num));
- value_print (val, gdb_stdout, &opts);
+ value_print (val, gdb_stdout, opts);
gdb_printf ("\n");
}
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index d98d3f33fed..100a44cddf3 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -1186,7 +1186,7 @@ riscv_print_one_register_info (struct gdbarch *gdbarch,
value_print_options opts = get_user_print_options ();
opts.deref_ref = true;
- common_val_print (val, file, 0, &opts, current_language);
+ common_val_print (val, file, 0, opts, current_language);
if (print_raw_format)
{
@@ -1203,7 +1203,7 @@ riscv_print_one_register_info (struct gdbarch *gdbarch,
/* Print the register in hex. */
value_print_options opts = get_formatted_print_options ('x');
opts.deref_ref = true;
- common_val_print (val, file, 0, &opts, current_language);
+ common_val_print (val, file, 0, opts, current_language);
if (print_raw_format)
{
@@ -1339,7 +1339,7 @@ riscv_print_one_register_info (struct gdbarch *gdbarch,
opts = get_user_print_options ();
opts.deref_ref = true;
gdb_printf (file, "\t");
- common_val_print (val, file, 0, &opts, current_language);
+ common_val_print (val, file, 0, opts, current_language);
}
}
}
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index a4614e9874a..2d453bf22a9 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -461,7 +461,7 @@ void
rust_language::printstr (struct ui_file *stream, struct type *type,
const gdb_byte *string, unsigned int length,
const char *user_encoding, int force_ellipses,
- const value_print_options *options) const
+ const value_print_options &options) const
{
/* Rust always uses UTF-8, but let the caller override this if need
be. */
@@ -518,7 +518,7 @@ rust_slice_to_array (struct value *val)
void
rust_language::val_print_slice
(struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options) const
+ const value_print_options &options) const
{
struct type *orig_type = check_typedef (val->type ());
@@ -558,7 +558,7 @@ rust_language::val_print_slice
void
rust_language::val_print_struct
(struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options) const
+ const value_print_options &options) const
{
int first_field;
struct type *type = check_typedef (val->type ());
@@ -590,7 +590,7 @@ rust_language::val_print_struct
else
gdb_puts ("{", stream);
- opts = *options;
+ opts = options;
opts.deref_ref = false;
first_field = 1;
@@ -602,7 +602,7 @@ rust_language::val_print_struct
if (!first_field)
gdb_puts (",", stream);
- if (options->prettyformat)
+ if (options.prettyformat)
{
gdb_puts ("\n", stream);
print_spaces (2 + 2 * recurse, stream);
@@ -619,11 +619,11 @@ rust_language::val_print_struct
gdb_puts (": ", stream);
}
- common_val_print (val->field (i), stream, recurse + 1, &opts,
+ common_val_print (val->field (i), stream, recurse + 1, opts,
this);
}
- if (options->prettyformat)
+ if (options.prettyformat)
{
gdb_puts ("\n", stream);
print_spaces (2 * recurse, stream);
@@ -640,9 +640,9 @@ rust_language::val_print_struct
void
rust_language::print_enum (struct value *val, struct ui_file *stream,
int recurse,
- const value_print_options *options) const
+ const value_print_options &options) const
{
- value_print_options opts = *options;
+ value_print_options opts = options;
struct type *type = check_typedef (val->type ());
opts.deref_ref = false;
@@ -699,7 +699,7 @@ rust_language::print_enum (struct value *val, struct ui_file *stream,
styled_string (variable_name_style.style (),
variant_type->field (j).name ()));
- common_val_print (val->field (j), stream, recurse + 1, &opts,
+ common_val_print (val->field (j), stream, recurse + 1, opts,
this);
}
@@ -714,9 +714,9 @@ rust_language::print_enum (struct value *val, struct ui_file *stream,
void
rust_language::value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options) const
+ const value_print_options &options) const
{
- value_print_options opts = *options;
+ value_print_options opts = options;
opts.deref_ref = true;
if (opts.prettyformat == Val_prettyformat_default)
@@ -751,7 +751,7 @@ rust_language::value_print_inner
gdb_puts ("b", stream);
val_print_string (elttype->target_type (), "ASCII", addr,
high_bound - low_bound + 1, stream,
- &opts);
+ opts);
break;
}
}
@@ -782,7 +782,7 @@ rust_language::value_print_inner
gdb_puts ("b", stream);
printstr (stream, type->target_type (),
val->contents_for_printing ().data (),
- high_bound - low_bound + 1, "ASCII", 0, &opts);
+ high_bound - low_bound + 1, "ASCII", 0, opts);
}
break;
@@ -804,20 +804,20 @@ rust_language::value_print_inner
for printing a union is same as that for a struct, the only
difference is that the input type will have overlapping
fields. */
- val_print_struct (val, stream, recurse, &opts);
+ val_print_struct (val, stream, recurse, opts);
break;
case TYPE_CODE_STRUCT:
if (rust_enum_p (type))
- print_enum (val, stream, recurse, &opts);
+ print_enum (val, stream, recurse, opts);
else
- val_print_struct (val, stream, recurse, &opts);
+ val_print_struct (val, stream, recurse, opts);
break;
default:
generic_print:
/* Nothing special yet. */
- generic_value_print (val, stream, recurse, &opts, &rust_decorations);
+ generic_value_print (val, stream, recurse, opts, &rust_decorations);
}
}
@@ -826,9 +826,9 @@ rust_language::value_print_inner
void
rust_language::value_print
(struct value *val, struct ui_file *stream,
- const value_print_options *options) const
+ const value_print_options &options) const
{
- value_print_options opts = *options;
+ value_print_options opts = options;
opts.deref_ref = true;
struct type *type = check_typedef (val->type ());
@@ -839,7 +839,7 @@ rust_language::value_print
gdb_printf (stream, ") ");
}
- return common_val_print (val, stream, 0, &opts, this);
+ return common_val_print (val, stream, 0, opts, this);
}
\f
diff --git a/gdb/rust-lang.h b/gdb/rust-lang.h
index 8e20d352394..ad8214710ff 100644
--- a/gdb/rust-lang.h
+++ b/gdb/rust-lang.h
@@ -137,12 +137,12 @@ class rust_language : public language_defn
void value_print_inner
(struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options) const override;
+ const value_print_options &options) const override;
/* See language.h. */
void value_print (struct value *val, struct ui_file *stream,
- const value_print_options *options) const override;
+ const value_print_options &options) const override;
/* See language.h. */
@@ -164,7 +164,7 @@ class rust_language : public language_defn
void printstr (struct ui_file *stream, struct type *elttype,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
- const value_print_options *options) const override;
+ const value_print_options &options) const override;
/* See language.h. */
@@ -202,20 +202,20 @@ class rust_language : public language_defn
void val_print_slice (struct value *val, struct ui_file *stream,
int recurse,
- const value_print_options *options) const;
+ const value_print_options &options) const;
/* Helper for value_print_inner, arguments are as for that function.
Prints structs and untagged unions. */
void val_print_struct (struct value *val, struct ui_file *stream,
int recurse,
- const value_print_options *options) const;
+ const value_print_options &options) const;
/* Helper for value_print_inner, arguments are as for that function.
Prints discriminated unions (Rust enums). */
void print_enum (struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options) const;
+ const value_print_options &options) const;
};
#endif /* GDB_RUST_LANG_H */
diff --git a/gdb/stack.c b/gdb/stack.c
index 4ebecfc36c3..06494281fdd 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -480,7 +480,7 @@ print_frame_arg (const frame_print_options &fp_opts,
vp_opts.summary
= fp_opts.print_frame_arguments == print_frame_arguments_scalars;
- common_val_print_checked (arg->val, &stb, 2, &vp_opts, language);
+ common_val_print_checked (arg->val, &stb, 2, vp_opts, language);
}
catch (const gdb_exception_error &except)
{
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 18b678afd52..377191e2591 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -540,7 +540,7 @@ decode_agent_options (const char *exp, int *trace_string)
/* Allow an optional decimal number giving an explicit maximum
string length, defaulting it to the "print characters" value;
so "collect/s80 mystr" gets at most 80 bytes of string. */
- *trace_string = get_print_max_chars (&opts);
+ *trace_string = get_print_max_chars (opts);
exp++;
if (*exp >= '0' && *exp <= '9')
*trace_string = atoi (exp);
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 1873b5d58b3..f7c8f517890 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -409,7 +409,7 @@ val_print_invalid_address (struct ui_file *stream)
static void
print_unpacked_pointer (struct type *type, struct type *elttype,
CORE_ADDR address, struct ui_file *stream,
- const value_print_options *options)
+ const value_print_options &options)
{
struct gdbarch *gdbarch = type->arch ();
@@ -420,9 +420,9 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
return;
}
- if (options->symbol_print)
+ if (options.symbol_print)
print_address_demangle (options, gdbarch, address, stream, demangle);
- else if (options->addressprint)
+ else if (options.addressprint)
fputs_styled (paddress (gdbarch, address), address_style.style (),
stream);
}
@@ -432,7 +432,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
static void
generic_val_print_array (struct value *val,
struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
const struct
generic_val_print_decorations *decorations)
{
@@ -465,7 +465,7 @@ generic_val_print_array (struct value *val,
static void
generic_val_print_string (struct value *val,
struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
const struct generic_val_print_decorations
*decorations)
{
@@ -490,7 +490,7 @@ generic_val_print_string (struct value *val,
/* If requested, look for the first null char and only
print elements up to it. */
- if (options->stop_print_at_null)
+ if (options.stop_print_at_null)
{
unsigned int print_max_chars = get_print_max_chars (options);
unsigned int temp_len;
@@ -534,10 +534,10 @@ generic_val_print_string (struct value *val,
static void
generic_value_print_ptr (struct value *val, struct ui_file *stream,
- const value_print_options *options)
+ const value_print_options &options)
{
- if (options->format && options->format != 's')
+ if (options.format && options.format != 's')
value_print_scalar_formatted (val, options, 0, stream);
else
{
@@ -593,15 +593,15 @@ static void
generic_val_print_ref (struct type *type,
struct ui_file *stream, int recurse,
struct value *original_value,
- const value_print_options *options)
+ const value_print_options &options)
{
struct type *elttype = check_typedef (type->target_type ());
struct value *deref_val = NULL;
const bool value_is_synthetic
= original_value->bits_synthetic_pointer (0, (TARGET_CHAR_BIT
* type->length ()));
- const bool must_coerce_ref = ((options->addressprint && value_is_synthetic)
- || options->deref_ref);
+ const bool must_coerce_ref = ((options.addressprint && value_is_synthetic)
+ || options.deref_ref);
const bool type_is_defined = elttype->code () != TYPE_CODE_UNDEF;
const gdb_byte *valaddr = original_value->contents_for_printing ().data ();
@@ -619,13 +619,13 @@ generic_val_print_ref (struct type *type,
Notice that for references to TYPE_CODE_STRUCT, 'set print object on' will
cause original_value to be a not_lval instead of an lval_computed,
which will make value_bits_synthetic_pointer return false.
- This happens because if options->objectprint is true, c_value_print will
+ This happens because if options.objectprint is true, c_value_print will
overwrite original_value's contents with the result of coercing
the reference through value_addr, and then set its type back to
TYPE_CODE_REF. In that case we don't have to coerce the reference again;
we can simply treat it as non-synthetic and move on. */
- if (options->addressprint)
+ if (options.addressprint)
{
const gdb_byte *address = (value_is_synthetic && type_is_defined
? get_value_addr_contents (deref_val)
@@ -633,11 +633,11 @@ generic_val_print_ref (struct type *type,
print_ref_address (type, address, stream);
- if (options->deref_ref)
+ if (options.deref_ref)
gdb_puts (": ", stream);
}
- if (options->deref_ref)
+ if (options.deref_ref)
{
if (type_is_defined)
common_val_print (deref_val, stream, recurse, options,
@@ -737,9 +737,9 @@ generic_val_print_enum_1 (struct type *type, LONGEST val,
static void
generic_val_print_enum (struct type *type, struct ui_file *stream,
struct value *original_value,
- const value_print_options *options)
+ const value_print_options &options)
{
- gdb_assert (!options->format);
+ gdb_assert (!options.format);
const gdb_byte *valaddr = original_value->contents_for_printing ().data ();
@@ -754,11 +754,11 @@ static void
generic_val_print_func (struct type *type, CORE_ADDR address,
struct ui_file *stream,
struct value *original_value,
- const value_print_options *options)
+ const value_print_options &options)
{
struct gdbarch *gdbarch = type->arch ();
- gdb_assert (!options->format);
+ gdb_assert (!options.format);
/* FIXME, we should consider, at least for ANSI C language,
eliminating the distinction made between FUNCs and POINTERs to
@@ -775,15 +775,15 @@ generic_val_print_func (struct type *type, CORE_ADDR address,
static void
generic_value_print_bool
(struct value *value, struct ui_file *stream,
- const value_print_options *options,
+ const value_print_options &options,
const struct generic_val_print_decorations *decorations)
{
- if (options->format || options->output_format)
+ if (options.format || options.output_format)
{
- value_print_options opts = *options;
- opts.format = (options->format ? options->format
- : options->output_format);
- value_print_scalar_formatted (value, &opts, 0, stream);
+ value_print_options opts = options;
+ opts.format = (options.format ? options.format
+ : options.output_format);
+ value_print_scalar_formatted (value, opts, 0, stream);
}
else
{
@@ -803,28 +803,28 @@ generic_value_print_bool
static void
generic_value_print_int (struct value *val, struct ui_file *stream,
- const value_print_options *options)
+ const value_print_options &options)
{
- value_print_options opts = *options;
+ value_print_options opts = options;
- opts.format = (options->format ? options->format
- : options->output_format);
- value_print_scalar_formatted (val, &opts, 0, stream);
+ opts.format = (options.format ? options.format
+ : options.output_format);
+ value_print_scalar_formatted (val, opts, 0, stream);
}
/* generic_value_print helper for TYPE_CODE_CHAR. */
static void
generic_value_print_char (struct value *value, struct ui_file *stream,
- const value_print_options *options)
+ const value_print_options &options)
{
- if (options->format || options->output_format)
+ if (options.format || options.output_format)
{
- value_print_options opts = *options;
+ value_print_options opts = options;
- opts.format = (options->format ? options->format
- : options->output_format);
- value_print_scalar_formatted (value, &opts, 0, stream);
+ opts.format = (options.format ? options.format
+ : options.output_format);
+ value_print_scalar_formatted (value, opts, 0, stream);
}
else
{
@@ -847,9 +847,9 @@ generic_value_print_char (struct value *value, struct ui_file *stream,
static void
generic_val_print_float (struct type *type, struct ui_file *stream,
struct value *original_value,
- const value_print_options *options)
+ const value_print_options &options)
{
- gdb_assert (!options->format);
+ gdb_assert (!options.format);
const gdb_byte *valaddr = original_value->contents_for_printing ().data ();
@@ -860,9 +860,9 @@ generic_val_print_float (struct type *type, struct ui_file *stream,
static void
generic_val_print_fixed_point (struct value *val, struct ui_file *stream,
- const value_print_options *options)
+ const value_print_options &options)
{
- if (options->format)
+ if (options.format)
value_print_scalar_formatted (val, options, 0, stream);
else
{
@@ -885,7 +885,7 @@ generic_val_print_fixed_point (struct value *val, struct ui_file *stream,
static void
generic_value_print_complex (struct value *val, struct ui_file *stream,
- const value_print_options *options,
+ const value_print_options &options,
const struct generic_val_print_decorations
*decorations)
{
@@ -906,10 +906,10 @@ static void
generic_value_print_memberptr
(struct value *val, struct ui_file *stream,
int recurse,
- const value_print_options *options,
+ const value_print_options &options,
const struct generic_val_print_decorations *decorations)
{
- if (!options->format)
+ if (!options.format)
{
/* Member pointers are essentially specific to C++, and so if we
encounter one, we should print it according to C++ rules. */
@@ -923,7 +923,7 @@ generic_value_print_memberptr
void
generic_value_print (struct value *val, struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
const struct generic_val_print_decorations *decorations)
{
struct type *type = val->type ();
@@ -967,14 +967,14 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse,
break;
case TYPE_CODE_ENUM:
- if (options->format)
+ if (options.format)
value_print_scalar_formatted (val, options, 0, stream);
else
generic_val_print_enum (type, stream, val, options);
break;
case TYPE_CODE_FLAGS:
- if (options->format)
+ if (options.format)
value_print_scalar_formatted (val, options, 0, stream);
else
val_print_type_code_flags (type, val, stream);
@@ -982,7 +982,7 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse,
case TYPE_CODE_FUNC:
case TYPE_CODE_METHOD:
- if (options->format)
+ if (options.format)
value_print_scalar_formatted (val, options, 0, stream);
else
generic_val_print_func (type, val->address (), stream,
@@ -1003,7 +1003,7 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse,
case TYPE_CODE_FLT:
case TYPE_CODE_DECFLOAT:
- if (options->format)
+ if (options.format)
value_print_scalar_formatted (val, options, 0, stream);
else
generic_val_print_float (type, stream, val, options);
@@ -1053,7 +1053,7 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse,
void
common_val_print (struct value *value, struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
const struct language_defn *language)
{
if (language->la_language == language_ada)
@@ -1066,7 +1066,7 @@ common_val_print (struct value *value, struct ui_file *stream, int recurse,
if (value->lazy ())
value->fetch_lazy ();
- value_print_options local_opts = *options;
+ value_print_options local_opts = options;
struct type *type = value->type ();
struct type *real_type = check_typedef (type);
@@ -1079,7 +1079,7 @@ common_val_print (struct value *value, struct ui_file *stream, int recurse,
if (!valprint_check_validity (stream, real_type, 0, value))
return;
- if (!options->raw)
+ if (!options.raw)
{
if (apply_ext_lang_val_pretty_printer (value, stream, recurse, options,
language))
@@ -1098,7 +1098,7 @@ common_val_print (struct value *value, struct ui_file *stream, int recurse,
/* Handle summary mode. If the value is a scalar, print it;
otherwise, print an ellipsis. */
- if (options->summary && !val_print_scalar_type_p (type))
+ if (options.summary && !val_print_scalar_type_p (type))
{
gdb_printf (stream, "...");
return;
@@ -1111,7 +1111,7 @@ common_val_print (struct value *value, struct ui_file *stream, int recurse,
try
{
- language->value_print_inner (value, stream, recurse, &local_opts);
+ language->value_print_inner (value, stream, recurse, local_opts);
}
catch (const gdb_exception_error &except)
{
@@ -1124,10 +1124,10 @@ common_val_print (struct value *value, struct ui_file *stream, int recurse,
bool
val_print_check_max_depth (struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
const struct language_defn *language)
{
- if (options->max_depth > -1 && recurse >= options->max_depth)
+ if (options.max_depth > -1 && recurse >= options.max_depth)
{
gdb_assert (language->struct_too_deep_ellipsis () != NULL);
gdb_puts (language->struct_too_deep_ellipsis (), stream);
@@ -1143,7 +1143,7 @@ val_print_check_max_depth (struct ui_file *stream, int recurse,
static bool
value_check_printable (struct value *val, struct ui_file *stream,
- const value_print_options *options)
+ const value_print_options &options)
{
if (val == 0)
{
@@ -1154,7 +1154,7 @@ value_check_printable (struct value *val, struct ui_file *stream,
if (val->entirely_optimized_out ())
{
- if (options->summary && !val_print_scalar_type_p (val->type ()))
+ if (options.summary && !val_print_scalar_type_p (val->type ()))
gdb_printf (stream, "...");
else
val_print_optimized_out (val, stream);
@@ -1163,7 +1163,7 @@ value_check_printable (struct value *val, struct ui_file *stream,
if (val->entirely_unavailable ())
{
- if (options->summary && !val_print_scalar_type_p (val->type ()))
+ if (options.summary && !val_print_scalar_type_p (val->type ()))
gdb_printf (stream, "...");
else
val_print_unavailable (stream);
@@ -1192,7 +1192,7 @@ value_check_printable (struct value *val, struct ui_file *stream,
void
common_val_print_checked (struct value *val, struct ui_file *stream,
int recurse,
- const value_print_options *options,
+ const value_print_options &options,
const struct language_defn *language)
{
if (!value_check_printable (val, stream, options))
@@ -1205,14 +1205,14 @@ common_val_print_checked (struct value *val, struct ui_file *stream,
void
value_print (struct value *val, struct ui_file *stream,
- const value_print_options *options)
+ const value_print_options &options)
{
scoped_value_mark free_values;
if (!value_check_printable (val, stream, options))
return;
- if (!options->raw)
+ if (!options.raw)
{
int r
= apply_ext_lang_val_pretty_printer (val, stream, 0, options,
@@ -1233,7 +1233,7 @@ extern void ATTRIBUTE_UNUSED debug_val (struct value *val);
void ATTRIBUTE_UNUSED
debug_val (struct value *val)
{
- value_print (val, gdb_stdlog, &user_print_options);
+ value_print (val, gdb_stdlog, user_print_options);
gdb_flush (gdb_stdlog);
}
@@ -1291,7 +1291,7 @@ val_print_type_code_flags (struct type *type, struct value *original_value,
void
value_print_scalar_formatted (struct value *val,
- const value_print_options *options,
+ const value_print_options &options,
int size,
struct ui_file *stream)
{
@@ -1302,12 +1302,12 @@ value_print_scalar_formatted (struct value *val,
/* If we get here with a string format, try again without it. Go
all the way back to the language printers, which may call us
again. */
- if (options->format == 's')
+ if (options.format == 's')
{
- value_print_options opts = *options;
+ value_print_options opts = options;
opts.format = 0;
opts.deref_ref = false;
- common_val_print (val, stream, 0, &opts, current_language);
+ common_val_print (val, stream, 0, opts, current_language);
return;
}
@@ -1414,7 +1414,7 @@ print_floating (const gdb_byte *valaddr, struct type *type,
void
print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
unsigned len, enum bfd_endian byte_order, bool zero_pad,
- const value_print_options *options)
+ const value_print_options &options)
{
const gdb_byte *p;
unsigned int i;
@@ -1427,7 +1427,7 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
const int mask = 0x080;
- if (options->nibblesprint)
+ if (options.nibblesprint)
digit_separator = current_language->get_digit_separator();
if (byte_order == BFD_ENDIAN_BIG)
@@ -1441,7 +1441,7 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
for (i = 0; i < (HOST_CHAR_BIT * sizeof (*p)); i++)
{
- if (options->nibblesprint && seen_a_one && i % 4 == 0)
+ if (options.nibblesprint && seen_a_one && i % 4 == 0)
gdb_putc (*digit_separator, stream);
if (*p & (mask >> i))
@@ -1451,7 +1451,7 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
if (zero_pad || seen_a_one || b == '1')
gdb_putc (b, stream);
- else if (options->nibblesprint)
+ else if (options.nibblesprint)
{
if ((0xf0 & (mask >> i) && (*p & 0xf0))
|| (0x0f & (mask >> i) && (*p & 0x0f)))
@@ -1471,7 +1471,7 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
{
for (i = 0; i < (HOST_CHAR_BIT * sizeof (*p)); i++)
{
- if (options->nibblesprint && seen_a_one && i % 4 == 0)
+ if (options.nibblesprint && seen_a_one && i % 4 == 0)
gdb_putc (*digit_separator, stream);
if (*p & (mask >> i))
@@ -1481,7 +1481,7 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
if (zero_pad || seen_a_one || b == '1')
gdb_putc (b, stream);
- else if (options->nibblesprint)
+ else if (options.nibblesprint)
{
if ((0xf0 & (mask >> i) && (*p & 0xf0))
|| (0x0f & (mask >> i) && (*p & 0x0f)))
@@ -1916,7 +1916,7 @@ print_hex_chars (struct ui_file *stream, const gdb_byte *valaddr,
stream STREAM. */
void
-print_function_pointer_address (const value_print_options *options,
+print_function_pointer_address (const value_print_options &options,
struct gdbarch *gdbarch,
CORE_ADDR address,
struct ui_file *stream)
@@ -1926,7 +1926,7 @@ print_function_pointer_address (const value_print_options *options,
/* If the function pointer is represented by a description, print
the address of the description. */
- if (options->addressprint && func_addr != address)
+ if (options.addressprint && func_addr != address)
{
gdb_puts ("@", stream);
fputs_styled (paddress (gdbarch, address), address_style.style (),
@@ -1943,9 +1943,9 @@ print_function_pointer_address (const value_print_options *options,
void
maybe_print_array_index (struct type *index_type, LONGEST index,
struct ui_file *stream,
- const value_print_options *options)
+ const value_print_options &options)
{
- if (!options->print_array_indexes)
+ if (!options.print_array_indexes)
return;
current_language->print_array_index (index_type, index, stream, options);
@@ -1956,7 +1956,7 @@ maybe_print_array_index (struct type *index_type, LONGEST index,
void
value_print_array_elements (struct value *val, struct ui_file *stream,
int recurse,
- const value_print_options *options,
+ const value_print_options &options,
unsigned int i)
{
unsigned int things_printed = 0;
@@ -2000,13 +2000,13 @@ value_print_array_elements (struct value *val, struct ui_file *stream,
annotate_array_section_begin (i, elttype);
- for (; i < len && things_printed < options->print_max; i++)
+ for (; i < len && things_printed < options.print_max; i++)
{
scoped_value_mark free_values;
if (i != 0)
{
- if (options->prettyformat_arrays)
+ if (options.prettyformat_arrays)
{
gdb_printf (stream, ",\n");
print_spaces (2 + 2 * recurse, stream);
@@ -2014,7 +2014,7 @@ value_print_array_elements (struct value *val, struct ui_file *stream,
else
gdb_printf (stream, ", ");
}
- else if (options->prettyformat_arrays)
+ else if (options.prettyformat_arrays)
{
gdb_printf (stream, "\n");
print_spaces (2 + 2 * recurse, stream);
@@ -2030,7 +2030,7 @@ value_print_array_elements (struct value *val, struct ui_file *stream,
reps = 1;
/* Only check for reps if repeat_count_threshold is not set to
UINT_MAX (unlimited). */
- if (options->repeat_count_threshold < UINT_MAX)
+ if (options.repeat_count_threshold < UINT_MAX)
{
bool unavailable = element->entirely_unavailable ();
bool available = element->entirely_available ();
@@ -2060,7 +2060,7 @@ value_print_array_elements (struct value *val, struct ui_file *stream,
common_val_print (element, stream, recurse + 1, options,
current_language);
- if (reps > options->repeat_count_threshold)
+ if (reps > options.repeat_count_threshold)
{
annotate_elt_rep (reps);
gdb_printf (stream, " %p[<repeats %u times>%p]",
@@ -2068,7 +2068,7 @@ value_print_array_elements (struct value *val, struct ui_file *stream,
annotate_elt_rep_end ();
i = rep1 - 1;
- things_printed += options->repeat_count_threshold;
+ things_printed += options.repeat_count_threshold;
}
else
{
@@ -2079,7 +2079,7 @@ value_print_array_elements (struct value *val, struct ui_file *stream,
annotate_array_section_end ();
if (i < len)
gdb_printf (stream, "...");
- if (options->prettyformat_arrays)
+ if (options.prettyformat_arrays)
{
gdb_printf (stream, "\n");
print_spaces (2 * recurse, stream);
@@ -2112,7 +2112,7 @@ generic_printstr (struct ui_file *stream, struct type *type,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
int quote_char, int c_style_terminator,
- const value_print_options *options)
+ const value_print_options &options)
{
wchar_printer printer (type, quote_char, encoding);
printer.print (stream, string, length, force_ellipses,
@@ -2131,7 +2131,7 @@ int
val_print_string (struct type *elttype, const char *encoding,
CORE_ADDR addr, int len,
struct ui_file *stream,
- const value_print_options *options)
+ const value_print_options &options)
{
int force_ellipsis = 0; /* Force ellipsis to be printed if nonzero. */
int err; /* Non-zero if we got a bad read. */
diff --git a/gdb/valprint.h b/gdb/valprint.h
index 8c4c601b16d..13bfcf98add 100644
--- a/gdb/valprint.h
+++ b/gdb/valprint.h
@@ -128,10 +128,10 @@ struct value_print_options
/* Return the character count limit for printing strings. */
static inline unsigned int
-get_print_max_chars (const value_print_options *options)
+get_print_max_chars (const value_print_options &options)
{
- return (options->print_max_chars != PRINT_MAX_CHARS_ELEMENTS
- ? options->print_max_chars : options->print_max);
+ return (options.print_max_chars != PRINT_MAX_CHARS_ELEMENTS
+ ? options.print_max_chars : options.print_max);
}
/* Create an option_def_group for the value_print options, with OPTS
@@ -163,13 +163,13 @@ extern value_print_options get_formatted_print_options (char format);
extern void maybe_print_array_index (struct type *index_type, LONGEST index,
struct ui_file *stream,
- const value_print_options *);
+ const value_print_options &);
/* Print elements of an array. */
extern void value_print_array_elements (struct value *, struct ui_file *, int,
- const value_print_options *,
+ const value_print_options &,
unsigned int);
/* Print a scalar according to OPTIONS and SIZE on STREAM. Format 'i'
@@ -179,12 +179,12 @@ extern void value_print_array_elements (struct value *, struct ui_file *, int,
with a format. */
extern void value_print_scalar_formatted
- (struct value *val, const value_print_options *options,
+ (struct value *val, const value_print_options &options,
int size, struct ui_file *stream);
extern void print_binary_chars (struct ui_file *, const gdb_byte *,
unsigned int, enum bfd_endian, bool,
- const value_print_options *options);
+ const value_print_options &options);
extern void print_octal_chars (struct ui_file *, const gdb_byte *,
unsigned int, enum bfd_endian);
@@ -195,7 +195,7 @@ extern void print_decimal_chars (struct ui_file *, const gdb_byte *,
extern void print_hex_chars (struct ui_file *, const gdb_byte *,
unsigned int, enum bfd_endian, bool);
-extern void print_function_pointer_address (const value_print_options *options,
+extern void print_function_pointer_address (const value_print_options &options,
struct gdbarch *gdbarch,
CORE_ADDR address,
struct ui_file *stream);
@@ -259,7 +259,7 @@ struct generic_val_print_decorations
extern void generic_value_print (struct value *val, struct ui_file *stream,
int recurse,
- const value_print_options *options,
+ const value_print_options &options,
const struct generic_val_print_decorations *d);
extern void generic_emit_char (int c, struct type *type, struct ui_file *stream,
@@ -269,7 +269,7 @@ extern void generic_printstr (struct ui_file *stream, struct type *type,
const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
int quote_char, int c_style_terminator,
- const value_print_options *options);
+ const value_print_options &options);
/* Run the "output" command. ARGS and FROM_TTY are the usual
arguments passed to all command implementations, except ARGS is
@@ -296,7 +296,7 @@ struct format_data
};
extern void print_command_parse_format (const char **expp, const char *cmdname,
- value_print_options *opts);
+ value_print_options &opts);
/* Print VAL to console according to OPTS, including recording it to
the history. */
@@ -335,7 +335,7 @@ extern int build_address_symbolic (struct gdbarch *,
LANGUAGE determines what type of ellipsis expression is printed. */
extern bool val_print_check_max_depth (struct ui_file *stream, int recurse,
- const value_print_options *opts,
+ const value_print_options &opts,
const struct language_defn *language);
/* Like common_val_print, but call value_check_printable first. */
@@ -343,7 +343,7 @@ extern bool val_print_check_max_depth (struct ui_file *stream, int recurse,
extern void common_val_print_checked
(struct value *val,
struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
const struct language_defn *language);
#endif /* GDB_VALPRINT_H */
diff --git a/gdb/value.c b/gdb/value.c
index e9c22cbc9da..34207cb1956 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1787,7 +1787,7 @@ show_values (const char *num_exp, int from_tty)
val = access_value_history (i);
gdb_printf (("$%d = "), i);
const value_print_options &opts = get_user_print_options ();
- value_print (val, gdb_stdout, &opts);
+ value_print (val, gdb_stdout, opts);
gdb_printf (("\n"));
}
@@ -2577,7 +2577,7 @@ show_convenience (const char *ignore, int from_tty)
struct value *val;
val = value_of_internalvar (gdbarch, &var);
- value_print (val, gdb_stdout, &opts);
+ value_print (val, gdb_stdout, opts);
}
catch (const gdb_exception_error &ex)
{
diff --git a/gdb/value.h b/gdb/value.h
index 3651a089fd2..d4746449e70 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -1051,7 +1051,7 @@ struct value *value_vector_widen (struct value *scalar_value,
class frame_info_ptr;
struct fn_field;
-extern int print_address_demangle (const value_print_options *,
+extern int print_address_demangle (const value_print_options &,
struct gdbarch *, CORE_ADDR,
struct ui_file *, int);
@@ -1557,7 +1557,7 @@ extern void print_floating (const gdb_byte *valaddr, struct type *type,
struct ui_file *stream);
extern void value_print (struct value *val, struct ui_file *stream,
- const value_print_options *options);
+ const value_print_options &options);
/* Release values from the value chain and return them. Values
created after MARK are released. If MARK is nullptr, or if MARK is
@@ -1570,13 +1570,13 @@ extern std::vector<value_ref_ptr> value_release_to_mark
extern void common_val_print (struct value *val,
struct ui_file *stream, int recurse,
- const value_print_options *options,
+ const value_print_options &options,
const struct language_defn *language);
extern int val_print_string (struct type *elttype, const char *encoding,
CORE_ADDR addr, int len,
struct ui_file *stream,
- const value_print_options *options);
+ const value_print_options &options);
/* Print the value in stack frame FRAME of a variable specified by a
struct symbol. STREAM is the ui_file on which to print the value.
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 14eae8d920f..389e96c4735 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -643,7 +643,7 @@ varobj_get_iterator (struct varobj *var)
if (var->dynamic->pretty_printer)
{
value_print_options opts = varobj_formatted_print_options (var->format);
- return py_varobj_get_iterator (var, var->dynamic->pretty_printer, &opts);
+ return py_varobj_get_iterator (var, var->dynamic->pretty_printer, opts);
}
#endif
@@ -2145,7 +2145,7 @@ varobj_value_get_print_value (struct value *value,
gdbpy_ref<> output = apply_varobj_pretty_printer (value_formatter,
&replacement,
&stb,
- &opts);
+ opts);
/* If we have string like output ... */
if (output != nullptr && output != Py_None)
@@ -2220,14 +2220,14 @@ varobj_value_get_print_value (struct value *value,
/* If the THEVALUE has contents, it is a regular string. */
if (!thevalue.empty ())
current_language->printstr (&stb, type, (gdb_byte *) thevalue.c_str (),
- len, encoding.get (), 0, &opts);
+ len, encoding.get (), 0, opts);
else if (string_print)
/* Otherwise, if string_print is set, and it is not a regular
string, it is a lazy string. */
- val_print_string (type, encoding.get (), str_addr, len, &stb, &opts);
+ val_print_string (type, encoding.get (), str_addr, len, &stb, opts);
else
/* All other cases. */
- common_val_print (value, &stb, 0, &opts, current_language);
+ common_val_print (value, &stb, 0, opts, current_language);
return stb.release ();
}
--
2.49.0
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-07-04 22:08 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-04 22:05 [PATCH 0/9] Some cleanups and C++-ification of value_print_options Tom Tromey
2026-07-04 22:05 ` [PATCH 1/9] Return value_print_options from get_formatted_print_options Tom Tromey
2026-07-04 22:05 ` [PATCH 2/9] Return value_print_options from get_no_prettyformat_print_options Tom Tromey
2026-07-04 22:05 ` [PATCH 3/9] Convert get_user_print_options Tom Tromey
2026-07-04 22:05 ` [PATCH 4/9] Return a const reference from gdbpy_get_print_options Tom Tromey
2026-07-04 22:05 ` [PATCH 5/9] Return value_print_options from varobj_formatted_print_options Tom Tromey
2026-07-04 22:05 ` [PATCH 6/9] Use 'const' with some value_print_options Tom Tromey
2026-07-04 22:05 ` [PATCH 7/9] Don't use 'struct' keyword with value_print_options Tom Tromey
2026-07-04 22:05 ` [PATCH 8/9] Use std::forward in fortran_array_walker Tom Tromey
2026-07-04 22:05 ` [PATCH 9/9] Use references for value_print_options Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox