[committed][gdb/testsuite] Accept new complex print style in mixed-lang-stack.exp

Tom de Vries
2020-04-02T06:42:06Z

[-- Attachment #1: Type: text/plain, Size: 2127 bytes --]

[ was: Re: [PATCH v2 3/7] Change how complex types are printed in C ]

On 20-03-2020 22:53, Tom Tromey wrote:
> GCC accepts the "i" suffix for complex numbers. I think this is nicer
> to read than the current output, so this patch changes the C code to
> print complex numbers this way.
>
> gdb/ChangeLog
> 2020-03-20 Tom Tromey <tom@tromey.com>
>
> * c-valprint.c (c_decorations): Change complex suffix to "i".
>
> gdb/testsuite/ChangeLog
> 2020-03-20 Tom Tromey <tom@tromey.com>
>
> * gdb.compile/compile.exp: Update.
> * gdb.compile/compile-cplus.exp: Update.
> * gdb.base/varargs.exp: Update.
> * gdb.base/floatn.exp: Update.
> * gdb.base/endianity.exp: Update.
> * gdb.base/callfuncs.exp (do_function_calls): Update.
> * gdb.base/funcargs.exp (complex_args, complex_integral_args)
> (complex_float_integral_args): Update.
> * gdb.base/complex.exp: Update.
> * gdb.base/complex-parts.exp: Update.
> ---
> gdb/ChangeLog | 4 ++++
> gdb/c-valprint.c | 2 +-
> gdb/testsuite/ChangeLog | 13 +++++++++++++
> gdb/testsuite/gdb.base/callfuncs.exp | 6 +++---
> gdb/testsuite/gdb.base/complex-parts.exp | 6 +++---
> gdb/testsuite/gdb.base/complex.exp | 4 ++--
> gdb/testsuite/gdb.base/endianity.exp | 4 ++--
> gdb/testsuite/gdb.base/floatn.exp | 13 +++++--------
> gdb/testsuite/gdb.base/funcargs.exp | 20 ++++++++++----------
> gdb/testsuite/gdb.base/varargs.exp | 6 +++---
> gdb/testsuite/gdb.compile/compile-cplus.exp | 2 +-
> gdb/testsuite/gdb.compile/compile.exp | 2 +-
> 12 files changed, 48 insertions(+), 34 deletions(-)
>
> diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
> index 76a86faea6a..bde9c6cc883 100644
> --- a/gdb/c-valprint.c
> +++ b/gdb/c-valprint.c
> @@ -121,7 +121,7 @@ static const struct generic_val_print_decorations c_decorations =
> {
> "",
> " + ",
> - " * I",
> + "i",
> "true",
> "false",
> "void",

This broke gdb.fortran/mixed-lang-stack.exp, fixed in patch below.

Committed as obvious.

Thanks,
- Tom

[-- Attachment #2: 0001-gdb-testsuite-Accept-new-complex-print-style-in-mixed-lang-stack.exp.patch --]
[-- Type: text/x-patch, Size: 1785 bytes --]

[gdb/testsuite] Accept new complex print style in mixed-lang-stack.exp

Since commit 981c08ce72 "Change how complex types are printed in C", we see
these FAILs:
...
FAIL: gdb.fortran/mixed-lang-stack.exp: lang=auto: info args in frame #6
FAIL: gdb.fortran/mixed-lang-stack.exp: lang=c: info args in frame #6
FAIL: gdb.fortran/mixed-lang-stack.exp: lang=c: info args in frame #7
FAIL: gdb.fortran/mixed-lang-stack.exp: lang=c++: info args in frame #6
FAIL: gdb.fortran/mixed-lang-stack.exp: lang=c++: info args in frame #7
...

The problem is that printing of complex types has changed from:
...
d = 4 + 5 * I
...
to:
...
d = 4 + 5i
...
but the test-case still checks for the old printing style.

Fix this by updating the test-case to check for the new style.

gdb/testsuite/ChangeLog:

2020-04-02 Tom de Vries <tdevries@suse.de>

* gdb.fortran/mixed-lang-stack.exp: Accept new complex printing style.

---
gdb/testsuite/gdb.fortran/mixed-lang-stack.exp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp
index c0531c3fd9..793318626d 100644
--- a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp
+++ b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp
@@ -106,7 +106,7 @@ proc run_tests { lang } {
set d_pattern "\\(4,5\\)"
set f_pattern "$hex 'abcdef\\\\000'"
} else {
- set d_pattern "4 \\+ 5 \\* I"
+ set d_pattern "4 \\+ 5i"
set f_pattern "$hex \"abcdef\""
}

@@ -134,7 +134,7 @@ proc run_tests { lang } {
"info frame in frame #7"

if { $lang == "c" || $lang == "c++" } {
- set d_pattern "4 \\+ 5 \\* I"
+ set d_pattern "4 \\+ 5i"
set e_pattern "\"abcdef\""
set g_pattern "\{a = 1.5, b = 2.5\}"
} else {