aboutsummaryrefslogtreecommitdiff
path: root/gdb/valprint.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-03-13 17:39:52 -0600
committerTom Tromey <tom@tromey.com>2020-03-13 18:03:41 -0600
commit4112d2e602fed7157ce6bb30f46969129633d0f2 (patch)
tree057115627dd6ba7041fa391da9ccf02c9073b4ca /gdb/valprint.c
parent65786af6265044c67b25db23267f942c73b6fc20 (diff)
downloadgdb-4112d2e602fed7157ce6bb30f46969129633d0f2.zip
gdb-4112d2e602fed7157ce6bb30f46969129633d0f2.tar.gz
gdb-4112d2e602fed7157ce6bb30f46969129633d0f2.tar.bz2
Simplify generic_val_print_func
This removes the call to val_print_scalar_formatted from generic_val_print_func, allowing generic_value_print to call the value-based variant instead. gdb/ChangeLog 2020-03-13 Tom Tromey <tom@tromey.com> * valprint.c (generic_val_print_func): Simplify. (generic_val_print, generic_value_print): Update.
Diffstat (limited to 'gdb/valprint.c')
-rw-r--r--gdb/valprint.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 499d03f..0517bf0 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -742,22 +742,16 @@ generic_val_print_func (struct type *type,
{
struct gdbarch *gdbarch = get_type_arch (type);
- if (options->format)
- {
- val_print_scalar_formatted (type, embedded_offset,
- original_value, options, 0, stream);
- }
- else
- {
- /* FIXME, we should consider, at least for ANSI C language,
- eliminating the distinction made between FUNCs and POINTERs
- to FUNCs. */
- fprintf_filtered (stream, "{");
- type_print (type, "", stream, -1);
- fprintf_filtered (stream, "} ");
- /* Try to print what function it points to, and its address. */
- print_address_demangle (options, gdbarch, address, stream, demangle);
- }
+ gdb_assert (!options->format);
+
+ /* FIXME, we should consider, at least for ANSI C language,
+ eliminating the distinction made between FUNCs and POINTERs to
+ FUNCs. */
+ fprintf_filtered (stream, "{");
+ type_print (type, "", stream, -1);
+ fprintf_filtered (stream, "} ");
+ /* Try to print what function it points to, and its address. */
+ print_address_demangle (options, gdbarch, address, stream, demangle);
}
/* generic_val_print helper for TYPE_CODE_BOOL. */
@@ -971,8 +965,12 @@ generic_val_print (struct type *type,
case TYPE_CODE_FUNC:
case TYPE_CODE_METHOD:
- generic_val_print_func (type, embedded_offset, address, stream,
- original_value, options);
+ if (options->format)
+ val_print_scalar_formatted (type, embedded_offset,
+ original_value, options, 0, stream);
+ else
+ generic_val_print_func (type, embedded_offset, address, stream,
+ original_value, options);
break;
case TYPE_CODE_BOOL:
@@ -1084,8 +1082,11 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse,
case TYPE_CODE_FUNC:
case TYPE_CODE_METHOD:
- generic_val_print_func (type, 0, value_address (val), stream,
- val, options);
+ if (options->format)
+ value_print_scalar_formatted (val, options, 0, stream);
+ else
+ generic_val_print_func (type, 0, value_address (val), stream,
+ val, options);
break;
case TYPE_CODE_BOOL: