Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Cc: Pedro Alves <palves@redhat.com>,  gdb-patches@sourceware.org
Subject: New FAIL on gdb.base/printcmds.exp (was: Re: [RFA] Ensure GDB printf command can print convenience var strings without a target.)
Date: Tue, 09 Jul 2019 04:36:00 -0000	[thread overview]
Message-ID: <87lfx7vn7p.fsf_-_@redhat.com> (raw)
In-Reply-To: <1562625697.1521.5.camel@skynet.be> (Philippe Waroquiers's	message of "Tue, 09 Jul 2019 00:41:37 +0200")

On Monday, July 08 2019, Philippe Waroquiers wrote:

> On Mon, 2019-07-08 at 19:12 +0100, Pedro Alves wrote:
>> Looks fine to me, with the nits below fixed.
> Thanks.  I have applied all the suggested changes (except one)
> and pushed the below patch as a result.
>
> I kept 
>   gdb_test "set language ada" ".*" "set language ada"
> and clarified why with:
> +	# Without a target, the below produces no output
> +	# but with a target, it gives a warning.
> +	# So, use gdb_test expecting ".*" instead of gdb_test_no_output.
> +	gdb_test "set language ada" ".*" "set language ada"

Hi Philippe,

I'm seeing new FAILures on gdb.base/printcmds.exp:

  new FAIL: gdb.base/printcmds.exp: conv var: with target, may-call-functions off: printf $wstr
  new FAIL: gdb.base/printcmds.exp: conv var: with target, may-call-functions off: set $wstr
  new FAIL: gdb.base/printcmds.exp: conv var: with target: printf $wstr
  new FAIL: gdb.base/printcmds.exp: conv var: with target: set $wstr

The BuildBot has caught them:

  https://sourceware.org/ml/gdb-testers/2019-q3/msg00361.html

The problem happens because GDB can't identify the wchar_t type:

  set var $wstr = L"facile"
  No type named wchar_t.
  (gdb) FAIL: gdb.base/printcmds.exp: conv var: with target: set $wstr

The patch below fixes the problem for me.  wchar_t is built-in on C++,
so the trick is to set the language to "c++" before dealing with it (and
restore the language back to "auto" later).  WDYT?

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

gdb/testsuite/ChangeLog:
2019-07-09  Sergio Durigan Junior  <sergiodj@redhat.com>

	* gdb.base/printcmds.exp (test_printf_convenience_var): Set
	language to "c++" before dealing with wchar_t.

diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp
index 0e3126bcf2..aaa4d8d07d 100644
--- a/gdb/testsuite/gdb.base/printcmds.exp
+++ b/gdb/testsuite/gdb.base/printcmds.exp
@@ -959,10 +959,12 @@ proc test_printf_convenience_var {prefix do_wstring} {
 	gdb_test "printf \"astr val = %s\\n\", \$astr" "astr val = fghij" \
 	    "printf \$astr, auto language"
 	if {$do_wstring} {
+	    gdb_test_no_output "set language c++"
 	    gdb_test_no_output "set var \$wstr = L\"facile\"" \
 		"set \$wstr"
 	    gdb_test "printf \"wstr val = %ls\\n\", \$wstr" \
 		"wstr val = facile" "printf \$wstr"
+	    gdb_test_no_output "set language auto"
 	}
     }
 }


  reply	other threads:[~2019-07-09  4:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-10 21:16 [RFA] Ensure GDB printf command can print convenience var strings without a target Philippe Waroquiers
2019-06-11  2:29 ` Eli Zaretskii
2019-07-05 20:01 ` PING " Philippe Waroquiers
2019-07-08 18:13 ` Pedro Alves
2019-07-08 22:41   ` Philippe Waroquiers
2019-07-09  4:36     ` Sergio Durigan Junior [this message]
2020-03-02  2:46 ` [PATCH] Fix printf of a convenience variable holding an inferior address Sergio Durigan Junior
2020-03-03 13:39   ` Andrew Burgess
2020-03-03 16:29     ` Sergio Durigan Junior
2020-03-03 16:49       ` Sergio Durigan Junior
2020-03-04 10:53         ` Joel Brobecker
     [not found]           ` <8736al5d8s.fsf@redhat.com>
2020-03-07 11:58             ` Joel Brobecker
2020-03-09 22:56               ` Sergio Durigan Junior
2020-03-10 22:37                 ` Joel Brobecker
2020-03-10 22:57                   ` Sergio Durigan Junior
2020-03-10 23:13                     ` Andreas Schwab
2020-03-10 23:38                       ` Sergio Durigan Junior
2020-03-11 16:34                   ` Sergio Durigan Junior

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=87lfx7vn7p.fsf_-_@redhat.com \
    --to=sergiodj@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=philippe.waroquiers@skynet.be \
    /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