public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug cli/30288] New: [gdb/cli, editing off] FAIL: gdb.base/trace-commands.exp: nested trace-commands test (pattern 2)
@ 2023-03-29 16:45 vries at gcc dot gnu.org
  2023-03-30  4:14 ` [Bug cli/30288] " vries at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2023-03-29 16:45 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30288
           Summary: [gdb/cli, editing off] FAIL:
                    gdb.base/trace-commands.exp: nested trace-commands
                    test (pattern 2)
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: cli
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

I wrote a target board that sets editing to off by default, and ran the
testsuite.

With test-case gdb.base/trace-commands.exp, I ran into trouble, with tests that
send several commands at a time, using gdb_test_sequence to match the output.

I did this to get a clear look at what happens (because the output of
gdb_test_sequence confuses me):
...
 # Nested test
+send_gdb "if 1\nset \$i = 0\nwhile \$i < 5\nfunc \$i\nset \$i +=
1\nend\nend\n"
+gdb_test "" ".*" "test"
+exit
+
...

With the default, editing on, I get:
...
(gdb) PASS: gdb.base/trace-commands.exp: simple trace-commands test
if 1
+if 1
 >set $i = 0
 >while $i < 5
  >func $i
  >set $i += 1
  >end
 >end
++set $i = 0
++while $i < 5
+++func $i
++++echo in func $i\n
in func $i
+++set $i += 1
+++func $i
++++echo in func $i\n
in func $i
+++set $i += 1
+++func $i
++++echo in func $i\n
in func $i
+++set $i += 1
+++func $i
++++echo in func $i\n
in func $i
+++set $i += 1
+++func $i
++++echo in func $i\n
in func $i
+++set $i += 1
(gdb) PASS: gdb.base/trace-commands.exp: test
...

With editing off, I get instead:
...
(gdb) PASS: gdb.base/trace-commands.exp: simple trace-commands test
if 1
set $i = 0
while $i < 5
func $i
set $i += 1
end
end
+if 1
 > >  >  >  > >++set $i = 0
++while $i < 5
+++func $i
++++echo in func $i\n
in func $i
+++set $i += 1
+++func $i
++++echo in func $i\n
in func $i
+++set $i += 1
+++func $i
++++echo in func $i\n
in func $i
+++set $i += 1
+++func $i
++++echo in func $i\n
in func $i
+++set $i += 1
+++func $i
++++echo in func $i\n
in func $i
+++set $i += 1
(gdb) PASS: gdb.base/trace-commands.exp: test
...

If I do an interactive session with editing set to off, and issue one command
at a time, I do see the expected output.

Tentatively marking this as component cli, but perhaps this is a testsuite
issue.

If it's a testsuite issue, we should error out in send_gdb if the command
string contains more than one "\n".

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

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

* [Bug cli/30288] [gdb/cli, editing off] FAIL: gdb.base/trace-commands.exp: nested trace-commands test (pattern 2)
  2023-03-29 16:45 [Bug cli/30288] New: [gdb/cli, editing off] FAIL: gdb.base/trace-commands.exp: nested trace-commands test (pattern 2) vries at gcc dot gnu.org
@ 2023-03-30  4:14 ` vries at gcc dot gnu.org
  2023-03-31 14:05 ` [Bug testsuite/30288] " vries at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2023-03-30  4:14 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
This looks like a similar issue:
...
(gdb) PASS: gdb.threads/threadapply.exp: thread_set=all: try remove 2: thread
1.1
define remove-again^M
Type commands for definition of "remove-again".^M
End with a line saying just "end".^M
>remove-inferiors 2^M
end^M
>(gdb) FAIL: gdb.threads/threadapply.exp: thread_set=all: try remove 2: define remove-again (timeout)
...

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

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

* [Bug testsuite/30288] [gdb/cli, editing off] FAIL: gdb.base/trace-commands.exp: nested trace-commands test (pattern 2)
  2023-03-29 16:45 [Bug cli/30288] New: [gdb/cli, editing off] FAIL: gdb.base/trace-commands.exp: nested trace-commands test (pattern 2) vries at gcc dot gnu.org
  2023-03-30  4:14 ` [Bug cli/30288] " vries at gcc dot gnu.org
@ 2023-03-31 14:05 ` vries at gcc dot gnu.org
  2023-03-31 15:15 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2023-03-31 14:05 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|cli                         |testsuite

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

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

* [Bug testsuite/30288] [gdb/cli, editing off] FAIL: gdb.base/trace-commands.exp: nested trace-commands test (pattern 2)
  2023-03-29 16:45 [Bug cli/30288] New: [gdb/cli, editing off] FAIL: gdb.base/trace-commands.exp: nested trace-commands test (pattern 2) vries at gcc dot gnu.org
  2023-03-30  4:14 ` [Bug cli/30288] " vries at gcc dot gnu.org
  2023-03-31 14:05 ` [Bug testsuite/30288] " vries at gcc dot gnu.org
@ 2023-03-31 15:15 ` cvs-commit at gcc dot gnu.org
  2023-03-31 15:15 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-31 15:15 UTC (permalink / raw)
  To: gdb-prs

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

--- 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=89447229c7961dd99d5167f2ebcc5d8973d5d5ae

commit 89447229c7961dd99d5167f2ebcc5d8973d5d5ae
Author: Tom de Vries <tdevries@suse.de>
Date:   Fri Mar 31 17:15:37 2023 +0200

    [gdb/testsuite] Fix gdb.threads/threadapply.exp with editing off

    With test-case gdb.threads/threadapply.exp and editing set to on, we have:
    ...
    (gdb) define remove^M
    Type commands for definition of "remove".^M
    End with a line saying just "end".^M
    >remove-inferiors 3^M
    >end^M
    (gdb)
    ...
    but with editing set to off, we run into:
    ...
    (gdb) define remove^M
    Type commands for definition of "remove".^M
    End with a line saying just "end".^M
    >remove-inferiors 3^M
    end^M
    >(gdb) FAIL: gdb.threads/threadapply.exp: thread_set=all: try remove: \
      define remove (timeout)
    ...

    The commands are issued by this test:
    ...
            gdb_define_cmd "remove" {
                "remove-inferiors 3"
            }
    ...
    which does:
    - gdb_test_multiple "define remove", followed by
    - gdb_test_multiple "remove-inferiors 3\nend".

    Proc gdb_test_multiple has special handling for multi-line commands, which
    splits it up into subcommands, and for each subcommand issues it and then
    waits for the resulting prompt (the secondary prompt ">" for all but the
last
    subcommand).

    However, that doesn't work as expected in this case because the initial
    gdb_test_multiple "define remove" fails to match all resulting output, and
    consequently the secondary prompt resulting from "define remove" is counted
as
    if it was the one resulting from "remove-inferiors 3".

    Fix this by matching the entire output of "define remove", including the
    secondary prompt.

    Tested on x86_64-linux.

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

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

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

* [Bug testsuite/30288] [gdb/cli, editing off] FAIL: gdb.base/trace-commands.exp: nested trace-commands test (pattern 2)
  2023-03-29 16:45 [Bug cli/30288] New: [gdb/cli, editing off] FAIL: gdb.base/trace-commands.exp: nested trace-commands test (pattern 2) vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-03-31 15:15 ` cvs-commit at gcc dot gnu.org
@ 2023-03-31 15:15 ` cvs-commit at gcc dot gnu.org
  2023-03-31 15:16 ` vries at gcc dot gnu.org
  2023-03-31 15:33 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-31 15:15 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 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=103409bb38502b95cb60475939a49c2b059673d5

commit 103409bb38502b95cb60475939a49c2b059673d5
Author: Tom de Vries <tdevries@suse.de>
Date:   Fri Mar 31 17:15:37 2023 +0200

    [gdb/testsuite] Fix gdb.base/trace-commands.exp with editing off

    With test-case gdb.base/trace-commands.exp and editing off, I run into
fails
    because multi-line commands are issued using gdb_test_sequence, which
    doesn't handle them correctly.

    Fix this by using gdb_test instead.

    Tested on x86_64-linux.

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

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

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

* [Bug testsuite/30288] [gdb/cli, editing off] FAIL: gdb.base/trace-commands.exp: nested trace-commands test (pattern 2)
  2023-03-29 16:45 [Bug cli/30288] New: [gdb/cli, editing off] FAIL: gdb.base/trace-commands.exp: nested trace-commands test (pattern 2) vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-03-31 15:15 ` cvs-commit at gcc dot gnu.org
@ 2023-03-31 15:16 ` vries at gcc dot gnu.org
  2023-03-31 15:33 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2023-03-31 15:16 UTC (permalink / raw)
  To: gdb-prs

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

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

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

--- Comment #4 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] 7+ messages in thread

* [Bug testsuite/30288] [gdb/cli, editing off] FAIL: gdb.base/trace-commands.exp: nested trace-commands test (pattern 2)
  2023-03-29 16:45 [Bug cli/30288] New: [gdb/cli, editing off] FAIL: gdb.base/trace-commands.exp: nested trace-commands test (pattern 2) vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-03-31 15:16 ` vries at gcc dot gnu.org
@ 2023-03-31 15:33 ` vries at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2023-03-31 15:33 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #0)
> If it's a testsuite issue, we should error out in send_gdb if the command
> string contains more than one "\n".

I've looked into this, but there are a couple of locations that seem to do this
intentionally, to try and trigger a bug, so I've dropped this idea.

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

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

end of thread, other threads:[~2023-03-31 15:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29 16:45 [Bug cli/30288] New: [gdb/cli, editing off] FAIL: gdb.base/trace-commands.exp: nested trace-commands test (pattern 2) vries at gcc dot gnu.org
2023-03-30  4:14 ` [Bug cli/30288] " vries at gcc dot gnu.org
2023-03-31 14:05 ` [Bug testsuite/30288] " vries at gcc dot gnu.org
2023-03-31 15:15 ` cvs-commit at gcc dot gnu.org
2023-03-31 15:15 ` cvs-commit at gcc dot gnu.org
2023-03-31 15:16 ` vries at gcc dot gnu.org
2023-03-31 15:33 ` 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).