]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/testsuite/ChangeLog-2014-2021
[testsuite] Set target-charset to ascii
authorYao Qi <yao@codesourcery.com>
Mon, 24 Mar 2014 03:26:06 +0000 (11:26 +0800)
committerYao Qi <yao@codesourcery.com>
Thu, 17 Apr 2014 02:33:19 +0000 (10:33 +0800)
commit389b98f7d880c8551bec64f9e7fb0b05fa941de6
tree92ef4e6322d91e59ae90f31b98b3ef7dd2340e4f
parent71e50e8314af251f153207192194eaffdf638f5e
[testsuite] Set target-charset to ascii

Hi,
We find gdb.base/printcmds.exp fails a lot on windows host, like this,

 p ctable1[163]
 $204 = 163 '£'
 (gdb) FAIL: gdb.base/printcmds.exp: p ctable1[163]

however, on linux host,

 p ctable1[163]
 $205 = 163 '\243'
 (gdb) PASS: gdb.base/printcmds.exp: p ctable1[163]

The printing related code is in valprint.c:print_wchar,

  if (gdb_iswprint (w) && (!need_escape || (!gdb_iswdigit (w)
    && w != LCST ('8')
    && w != LCST ('9'))))
    {
      gdb_wchar_t wchar = w;

      if (w == gdb_btowc (quoter) || w == LCST ('\\'))
obstack_grow_wstr (output, LCST ("\\"));
      obstack_grow (output, &wchar, sizeof (gdb_wchar_t));
    }
  else
   {
      // print W in hex or octal digits
   }

When I debug gdb on different hosts, I find
on windows host, gdb_iswprint (iswprint) returns true if 'w' is 163.
However, on linux host, iswprint returns false if 'w' is 163.  Looks
this difference is caused by the charset.  On Linux host,
the target-charset is ANSI_X3.4-1968, while on windows host, the
target-charset is CP1252.

We can see how target-charset affects the output.  On linux host,

 (gdb) set target-charset ASCII
 (gdb) p ctable1[163]
 $1 = 163 '\243'
 (gdb) set target-charset CP1252
 (gdb) p ctable1[163]
 $2 = 163 '£'

we can print the pound sign too, and it shows target-charset does
affect the output.

This patch is to set target-charset temporarily to ASCII for some
charset-sensitive tests.  Tested on arm-none-eabi and
powerpc-linux-gnu on mingw32 host.  More than one hundred fails are
fixed.

gdb/testsuite:

2014-04-17  Yao Qi  <yao@codesourcery.com>

* lib/gdb.exp (with_target_charset): New proc.
* gdb.base/printcmds.exp (test_print_all_chars): Wrap tests with
with_target_charset.
(test_print_strings): Likewise.
(test_repeat_bytes): Likewise.
* gdb.base/setvar.exp: Set target-charset to ASCII temporarily
for some tests.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/printcmds.exp
gdb/testsuite/gdb.base/setvar.exp
gdb/testsuite/lib/gdb.exp