public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/31064] New: [gdb/testsuite] FAIL: gdb.base/examine-backward.exp: char-width=1, print-max=20: take 6 strings backward (pattern 1)
@ 2023-11-13 15:05 vries at gcc dot gnu.org
  2023-11-14 11:15 ` [Bug testsuite/31064] " vries at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-11-13 15:05 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31064

            Bug ID: 31064
           Summary: [gdb/testsuite] FAIL: gdb.base/examine-backward.exp:
                    char-width=1, print-max=20: take 6 strings backward
                    (pattern 1)
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: testsuite
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

On a pinebook I run into:
...
(gdb) PASS: gdb.base/examine-backward.exp: char-width=1, print-max=20: take 1
char backward
gdb_expect_list pattern: /"ABCDEFGHIJKLMNOPQRST".../
x/-6s^M
0xaaabb03c:     "<\260\253\252ABCDEFGHIJKLMNOP"...^M
0xaaabb050 <TestStrings+16>:    "QRSTUVWXYZ"^M
0xaaabb05b <TestStrings+27>:    ""^M
0xaaabb05c <TestStrings+28>:    ""^M
0xaaabb05d <TestStrings+29>:   
"\343\201\273\343\201\222\343\201\273\343\201\222"^M
0xaaabb06a <TestStrings+42>:    "01234567890123456789"...^M
(gdb) FAIL: gdb.base/examine-backward.exp: char-width=1, print-max=20: take 6
strings backward (pattern 1)
...

It's clear that this:
...
/* This is here just to ensure we have a null character before                  
   TestStrings, to avoid showing garbage when we look for strings               
   backwards from TestStrings.  */

unsigned char Barrier[] = {
  0x00,
};
...
is not working:
...
$ nm outputs/gdb.base/examine-backward/examine-backward | egrep
"TestStrings|Barrier"
00011250 B Barrier
00011040 D TestStrings
00011094 D TestStringsH
00011128 D TestStringsW
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug testsuite/31064] [gdb/testsuite] FAIL: gdb.base/examine-backward.exp: char-width=1, print-max=20: take 6 strings backward (pattern 1)
  2023-11-13 15:05 [Bug testsuite/31064] New: [gdb/testsuite] FAIL: gdb.base/examine-backward.exp: char-width=1, print-max=20: take 6 strings backward (pattern 1) vries at gcc dot gnu.org
@ 2023-11-14 11:15 ` vries at gcc dot gnu.org
  2023-11-21 12:13 ` cvs-commit at gcc dot gnu.org
  2023-11-21 12:14 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-11-14 11:15 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31064

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2023-November/204106.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug testsuite/31064] [gdb/testsuite] FAIL: gdb.base/examine-backward.exp: char-width=1, print-max=20: take 6 strings backward (pattern 1)
  2023-11-13 15:05 [Bug testsuite/31064] New: [gdb/testsuite] FAIL: gdb.base/examine-backward.exp: char-width=1, print-max=20: take 6 strings backward (pattern 1) vries at gcc dot gnu.org
  2023-11-14 11:15 ` [Bug testsuite/31064] " vries at gcc dot gnu.org
@ 2023-11-21 12:13 ` cvs-commit at gcc dot gnu.org
  2023-11-21 12:14 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-21 12:13 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31064

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=42ffc15774fc791f2ac9a719e81589c8e91bdb98

commit 42ffc15774fc791f2ac9a719e81589c8e91bdb98
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Nov 21 13:15:29 2023 +0100

    [gdb/testsuite] Fix spurious FAILs with examine-backward.exp, again

    Commit 59a561480d5 ("Fix spurious FAILs with examine-backward.exp")
describes
    the problem that:
    ...
    The test case examine-backward.exp issues the command "x/-s" after the end
    of the first string in TestStrings, but without making sure that this
    string is preceded by a string terminator.  Thus GDB may spuriously print
    some random characters from before that string, and then the test fails.
    ...

    The commit fixes the problem by adding a Barrier variable before the
TestStrings
    variable:
    ...
    +const char Barrier[] = { 0x0 };
     const char TestStrings[] = {
    ...

    There is however no guarantee that Barrier is placed immediately before
    TestStrings.

    Before recent commit 169fe7ab54b ("Change gdb.base/examine-backwards.exp
for
    AIX.") on x86_64-linux, I see:
    ...
    0000000000400660 R Barrier
    0000000000400680 R TestStrings
    ...

    So while the Barrier variable is the first before the TestStrings variable,
    it's not immediately preceding TestStrings.

    After commit 169fe7ab54b:
    ...
    0000000000402259 B Barrier
    0000000000402020 D TestStrings
    ...
    they're not even in the same section anymore.

    Fix this reliably by adding the zero in the array itself:
    ...
    char TestStringsBase[] = {
      0x0,
      ...
    };
    char *TestStrings = &TestStringsBase[1];
    ...
    and do likewise for TestStringsH and TestStringsW.

    Tested on x86_64-linux.

    PR testsuite/31064
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31064

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug testsuite/31064] [gdb/testsuite] FAIL: gdb.base/examine-backward.exp: char-width=1, print-max=20: take 6 strings backward (pattern 1)
  2023-11-13 15:05 [Bug testsuite/31064] New: [gdb/testsuite] FAIL: gdb.base/examine-backward.exp: char-width=1, print-max=20: take 6 strings backward (pattern 1) vries at gcc dot gnu.org
  2023-11-14 11:15 ` [Bug testsuite/31064] " vries at gcc dot gnu.org
  2023-11-21 12:13 ` cvs-commit at gcc dot gnu.org
@ 2023-11-21 12:14 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-11-21 12:14 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31064

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |15.1
         Resolution|---                         |FIXED

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-21 12:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-13 15:05 [Bug testsuite/31064] New: [gdb/testsuite] FAIL: gdb.base/examine-backward.exp: char-width=1, print-max=20: take 6 strings backward (pattern 1) vries at gcc dot gnu.org
2023-11-14 11:15 ` [Bug testsuite/31064] " vries at gcc dot gnu.org
2023-11-21 12:13 ` cvs-commit at gcc dot gnu.org
2023-11-21 12:14 ` vries at gcc dot gnu.org

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).