public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Tom de Vries <tdevries@suse.de>,
	Simon Marchi <simon.marchi@efficios.com>
Subject: [RFC PATCH] gdb/testsuite: fix gdb.base/info-types*.exp when no libc debug info
Date: Tue, 22 Jun 2021 13:24:47 -0400	[thread overview]
Message-ID: <20210622172447.1862794-1-simon.marchi@efficios.com> (raw)

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


             reply	other threads:[~2021-06-22 17:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22 17:24 Simon Marchi [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210622172447.1862794-1-simon.marchi@efficios.com \
    --to=simon.marchi@efficios.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).