public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Tom Tromey <tromey@adacore.com>, Simon Marchi <simark@simark.ca>
Cc: Tom Tromey <tromey@adacore.com>,
	Tom Tromey via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Do not record a rejected target description
Date: Fri, 17 Feb 2023 10:19:40 +0000	[thread overview]
Message-ID: <87o7pslhkz.fsf@redhat.com> (raw)
In-Reply-To: <87zg9do1s6.fsf@tromey.com>

Tom Tromey <tromey@adacore.com> writes:

> Simon> I see:
>
> Simon>   maint print c-tdesc^M
> Simon>   There is no target description to print.^M
> Simon>   (gdb) FAIL: gdb.xml/maint_print_struct.exp: printing tdesc with a structure and a bitfield
>
> Here's a patch that avoids this problem.
> Let me know what you think.
>
> Tom
>
> commit a12897d22ccc1d927960fa411b99723d76620af0
> Author: Tom Tromey <tromey@adacore.com>
> Date:   Thu Feb 16 12:17:50 2023 -0700
>
>     Fix regression in maint_print_struct.exp
>     
>     An earlier patch of mine caused a regression in
>     maint_print_struct.exp.  This patch fixes it by modifying the test so
>     that it does not rely on the erroneous target description being
>     available.
>
> diff --git a/gdb/testsuite/gdb.xml/maint_print_struct.exp b/gdb/testsuite/gdb.xml/maint_print_struct.exp
> index 6f411895501..5b7c1489d3e 100644
> --- a/gdb/testsuite/gdb.xml/maint_print_struct.exp
> +++ b/gdb/testsuite/gdb.xml/maint_print_struct.exp
> @@ -21,12 +21,7 @@ require allow_xml_test
>  
>  gdb_start
>  
> -# Required registers are not present so it is expected a warning.
> -#
> -gdb_test "set tdesc filename $srcdir/$subdir/maint_print_struct.xml" "
> -warning:.*" "setting a new tdesc having only a structure"

Haven't you just deleted a test for a warning here?

> -
> -gdb_test "maint print c-tdesc" "

This test (without the filename) actually tests for the change in your
original patch - if we just update the expected output...

> +gdb_test "maint print c-tdesc $srcdir/$subdir/maint_print_struct.xml" "

This should probably be as well as retaining the above tests.

I'd propose the patch below.

thanks,
Andrew


>  .*tdesc_create_reg \\(feature, \"bad_reg1\", \[0-9\]+, 1, NULL, 128, \"two_fielded\"\\);\r
>  .*tdesc_create_reg \\(feature, \"bad_reg2\", \[0-9\]+, 1, NULL, 64, \"bitfield\"\\);\r
>  .*" "printing tdesc with a structure and a bitfield"


---

commit 416465d0331d3347bebf4c72c544d7d3ecb926e7
Author: Andrew Burgess <aburgess@redhat.com>
Date:   Fri Feb 17 10:15:27 2023 +0000

    gdb: fix regression in gdb.xml/maint_print_struct.exp
    
    A regression in gdb.xml/maint_print_struct.exp was introduced with
    commit:
    
      commit 81b86eced24f905545b58aa6c27478104c364976
      Date:   Fri Jan 6 09:30:40 2023 -0700
    
          Do not record a rejected target description
    
    The test relied on an invalid target description being stored within
    the tdesc_info of the current inferior, the above commit stopped this
    behaviour.
    
    Update the test to check that the invalid architecture is NOT stored,
    and then check printing the target description directly from the
    file.

diff --git a/gdb/testsuite/gdb.xml/maint_print_struct.exp b/gdb/testsuite/gdb.xml/maint_print_struct.exp
index 6f411895501..fbb16aeb8f5 100644
--- a/gdb/testsuite/gdb.xml/maint_print_struct.exp
+++ b/gdb/testsuite/gdb.xml/maint_print_struct.exp
@@ -21,12 +21,17 @@ require allow_xml_test
 
 gdb_start
 
+set xml_file "$srcdir/$subdir/maint_print_struct.xml"
+
 # Required registers are not present so it is expected a warning.
 #
-gdb_test "set tdesc filename $srcdir/$subdir/maint_print_struct.xml" "
+gdb_test "set tdesc filename $xml_file" "
 warning:.*" "setting a new tdesc having only a structure"
 
-gdb_test "maint print c-tdesc" "
+gdb_test "maint print c-tdesc" \
+    "There is no target description to print\\."
+
+gdb_test "maint print c-tdesc $xml_file" "
 .*tdesc_create_reg \\(feature, \"bad_reg1\", \[0-9\]+, 1, NULL, 128, \"two_fielded\"\\);\r
 .*tdesc_create_reg \\(feature, \"bad_reg2\", \[0-9\]+, 1, NULL, 64, \"bitfield\"\\);\r
 .*" "printing tdesc with a structure and a bitfield"


  parent reply	other threads:[~2023-02-17 10:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-12 19:33 Tom Tromey
2023-02-14 15:16 ` Tom Tromey
2023-02-14 15:48 ` Andrew Burgess
2023-02-14 17:27   ` Tom Tromey
2023-02-15 12:56     ` Andrew Burgess
2023-02-15 15:59       ` Tom Tromey
2023-02-15 21:19         ` Simon Marchi
2023-02-15 21:38           ` Tom Tromey
2023-02-16 19:20           ` Tom Tromey
2023-02-16 19:33             ` Simon Marchi
2023-02-17 10:19             ` Andrew Burgess [this message]
2023-02-17 14:09               ` Tom Tromey
2023-02-17 22:29                 ` 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=87o7pslhkz.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    --cc=tromey@adacore.com \
    /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).