public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFC PATCH] gdb/testsuite: fix gdb.base/info-types*.exp when no libc debug info
@ 2021-06-22 17:24 Simon Marchi
  2021-06-22 21:52 ` Andrew Burgess
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Simon Marchi @ 2021-06-22 17:24 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom de Vries, Simon Marchi

On Ubuntu 20.04, when the debug info package for libc is not installed,
I get:

    FAIL: gdb.base/info-types-c++.exp: info types
    FAIL: gdb.base/info-types-c.exp: info types

The reason is that the output of info types is exactly:

    (gdb) info types
    All defined types:

    File /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/info-types.c:
    52:     typedef enum {...} anon_enum_t;
    45:     typedef struct {...} anon_struct_t;
    68:     typedef union {...} anon_union_t;
    28:     typedef struct baz_t baz;
    31:     typedef struct baz_t * baz_ptr;
    21:     struct baz_t;
            double
    33:     enum enum_t;
            float
            int
    38:     typedef enum enum_t my_enum_t;
    17:     typedef float my_float_t;
    16:     typedef int my_int_t;
    54:     typedef enum {...} nested_anon_enum_t;
    47:     typedef struct {...} nested_anon_struct_t;
    70:     typedef union {...} nested_anon_union_t;
    30:     typedef struct baz_t nested_baz;
    29:     typedef struct baz_t nested_baz_t;
    39:     typedef enum enum_t nested_enum_t;
    19:     typedef float nested_float_t;
    18:     typedef int nested_int_t;
    62:     typedef union union_t nested_union_t;
    56:     union union_t;
            unsigned int
    (gdb)

The lines we expect in the test contain an empty line at the end:

    ...
    "18:\[\t \]+typedef int nested_int_t;" \
    "62:\[\t \]+typedef union_t nested_union_t;" \
    "--optional" "\[\t \]+unsigned int" \
    ""]

This is written with the supposition that other files will be listed, so
an empty line will be included to separate the symbols from this file
from the next one.  This empty line is not included when info-types.c is
the only file listed.

This patch fixes the issue by not requiring an empty line.  I don't
think it's a very good solution, however: the empty line ensures that
there is no additional unexpected items after "unsigned int".

I don't think that making the empty line optional (with --optional)
would achieve anything, since the lines would still match if there was
some unexpected output.

So, I'll think about it a bit more, but any suggestions are appreciated.

gdb/testsuite/ChangeLog:

	* gdb.base/info-types.exp.tcl (run_test): Remove empty line at
	end of expected regexps.

Change-Id: I078127e271e2eb628b4805129bdb6f3f9c795629
---
 gdb/testsuite/gdb.base/info-types.exp.tcl | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/gdb.base/info-types.exp.tcl b/gdb/testsuite/gdb.base/info-types.exp.tcl
index c820adc4ac1..a24899c243d 100644
--- a/gdb/testsuite/gdb.base/info-types.exp.tcl
+++ b/gdb/testsuite/gdb.base/info-types.exp.tcl
@@ -75,8 +75,7 @@ proc run_test { lang } {
 		 "19:\[\t \]+typedef float nested_float_t;" \
 		 "18:\[\t \]+typedef int nested_int_t;" \
 		 "62:\[\t \]+typedef union_t nested_union_t;" \
-		 "--optional" "\[\t \]+unsigned int" \
-		 ""]
+		 "--optional" "\[\t \]+unsigned int"]
     } else {
 	set output_lines \
 	    [list \
@@ -106,8 +105,7 @@ proc run_test { lang } {
 		 "18:\[\t \]+typedef int nested_int_t;" \
 		 "62:\[\t \]+typedef union union_t nested_union_t;" \
 		 "56:\[\t \]+union union_t;" \
-		 "--optional" "\[\t \]+unsigned int" \
-		 ""]
+		 "--optional" "\[\t \]+unsigned int"]
     }
 
     gdb_test_lines "info types" "" $output_lines
-- 
2.31.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-06-23 21:51 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22 17:24 [RFC PATCH] gdb/testsuite: fix gdb.base/info-types*.exp when no libc debug info Simon Marchi
2021-06-22 21:52 ` Andrew Burgess
2021-06-23 11:35   ` Andrew Burgess
2021-06-23 12:04   ` Tom de Vries
2021-06-23 12:21     ` Andrew Burgess
2021-06-23 12:37       ` Tom de Vries
2021-06-23 11:33 ` Tom de Vries
2021-06-23 15:36   ` Simon Marchi
2021-06-23 21:51     ` Tom de Vries
2021-06-23 11:39 ` [PATCHv2 0/3] gdb: fix regression in evaluate_funcall for non C++ like cases Andrew Burgess
2021-06-23 11:39   ` [PATCHv2 1/3] " Andrew Burgess
2021-06-23 11:39   ` [PATCHv2 2/3] gdb: replace NULL terminated array with array_view Andrew Burgess
2021-06-23 11:39   ` [PATCHv2 3/3] gdb: use gdb::optional instead of passing a pointer to gdb::array_view Andrew Burgess
2021-06-23 12:22   ` [PATCHv2 0/3] gdb: fix regression in evaluate_funcall for non C++ like cases Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).