[gdb/exp] Enable complex decimal float --- gdb/gdbtypes.c | 2 +- gdb/testsuite/gdb.base/complex-parts.exp | 3 ++- gdb/valprint.c | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index c736dff2ca8..b618016d427 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3419,7 +3419,7 @@ bool can_create_complex_type (struct type *target_type) { return (target_type->code () == TYPE_CODE_INT - || target_type->code () == TYPE_CODE_FLT); + || is_floating_type (target_type)); } /* Allocate a TYPE_CODE_COMPLEX type structure. NAME is the type diff --git a/gdb/testsuite/gdb.base/complex-parts.exp b/gdb/testsuite/gdb.base/complex-parts.exp index 6385752a2f0..188fbfeab80 100644 --- a/gdb/testsuite/gdb.base/complex-parts.exp +++ b/gdb/testsuite/gdb.base/complex-parts.exp @@ -106,7 +106,8 @@ gdb_test "print (_Complex int) (23.75 + 8.88i)" " = 23 \\+ 8i" set re_reject_arg "Argument to complex arithmetic operation not supported\\." gdb_test "print (void *)0 + 5i" $re_reject_arg -gdb_test "print (_Decimal32)0 + 5i" $re_reject_arg + +gdb_test "print (_Decimal32)0 + 5i" "= 0 \\+ 5.000000i" # Set language to c++. Avoid warning by not having current frame. clean_restart diff --git a/gdb/valprint.c b/gdb/valprint.c index 340a329f9d0..36d66058ee7 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -830,11 +830,11 @@ generic_value_print_complex (struct value *val, struct ui_file *stream, fprintf_filtered (stream, "%s", decorations->complex_prefix); struct value *real_part = value_real_part (val); - value_print_scalar_formatted (real_part, options, 0, stream); + generic_value_print (real_part, stream, 0, options, decorations); fprintf_filtered (stream, "%s", decorations->complex_infix); struct value *imag_part = value_imaginary_part (val); - value_print_scalar_formatted (imag_part, options, 0, stream); + generic_value_print (imag_part, stream, 0, options, decorations); fprintf_filtered (stream, "%s", decorations->complex_suffix); }