New FAIL on gdb.base/printcmds.exp (was: Re: [RFA] Ensure GDB printf command can print convenience var strings without a target.)
Commit Message
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?
@@ -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"
}
}
}