public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/29787] New: Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash
@ 2022-11-16  3:53 vimacs.hacks at gmail dot com
  2022-11-16  3:57 ` [Bug gdb/29787] " simark at simark dot ca
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: vimacs.hacks at gmail dot com @ 2022-11-16  3:53 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 29787
           Summary: Using "set debug infrun on" and "set logging enabled"
                    breaks GDB prompt and makes GDB crash
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: vimacs.hacks at gmail dot com
  Target Milestone: ---

The use of readline in GDB is broken in commit
a715464cd2e25c8bf46190cc8bde9267c9ab6ac0 when using "set debug infrun on" and
"set logging enabled".

GDB 12.1 doesn't have this bug, but GDB 12.1 doesn't have paging for the debug
messages, so I don't know if this bug is only in the versions after GDB 12.1.

Steps to produce this bug:

1. build a simple program:

$ cat main.c 
int main()
{
}
$ gcc -g -O0 main.c

2. debug it and use the following commands:

$ ./gdb/gdb ./a.out
(gdb) b main
Breakpoint 1 at 0x1122: file main.c, line 3.
(gdb) set debug infrun on 
(gdb) set logging enabled 
Copying output to gdb.txt.
Copying debug output to gdb.txt.
(gdb) r

3. just type <RET> until the debug message finishes, and type <RET> once more,
GDB will crash with "readline: readline_callback_read_char() called with no
handler!"

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

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

* [Bug gdb/29787] Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash
  2022-11-16  3:53 [Bug gdb/29787] New: Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash vimacs.hacks at gmail dot com
@ 2022-11-16  3:57 ` simark at simark dot ca
  2022-11-16 18:11 ` tromey at sourceware dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: simark at simark dot ca @ 2022-11-16  3:57 UTC (permalink / raw)
  To: gdb-prs

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

Simon Marchi <simark at simark dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simark at simark dot ca
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-11-16
     Ever confirmed|0                           |1

--- Comment #1 from Simon Marchi <simark at simark dot ca> ---
I was able to reproduce.  To be clear, you press <RET> to continue past the
pagination prompts.  This was not clear to me at first.  Basically, after
running, press <RET> until it crashes.

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

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

* [Bug gdb/29787] Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash
  2022-11-16  3:53 [Bug gdb/29787] New: Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash vimacs.hacks at gmail dot com
  2022-11-16  3:57 ` [Bug gdb/29787] " simark at simark dot ca
@ 2022-11-16 18:11 ` tromey at sourceware dot org
  2022-11-16 18:40 ` tromey at sourceware dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2022-11-16 18:11 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.1
                 CC|                            |tromey at sourceware dot org

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
Sounds like a regression.

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

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

* [Bug gdb/29787] Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash
  2022-11-16  3:53 [Bug gdb/29787] New: Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash vimacs.hacks at gmail dot com
  2022-11-16  3:57 ` [Bug gdb/29787] " simark at simark dot ca
  2022-11-16 18:11 ` tromey at sourceware dot org
@ 2022-11-16 18:40 ` tromey at sourceware dot org
  2022-11-17 16:27 ` tromey at sourceware dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2022-11-16 18:40 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
I don't think any output to gdb_stdlog should be paged,
so that seems like one problem here.

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

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

* [Bug gdb/29787] Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash
  2022-11-16  3:53 [Bug gdb/29787] New: Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash vimacs.hacks at gmail dot com
                   ` (2 preceding siblings ...)
  2022-11-16 18:40 ` tromey at sourceware dot org
@ 2022-11-17 16:27 ` tromey at sourceware dot org
  2022-11-17 16:34 ` tromey at sourceware dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2022-11-17 16:27 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
Fixing the logging isn't super hard, but I think the real
problem is that some bit of code is enabling the stdin
input handler without also installing the readline callback
handler.

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

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

* [Bug gdb/29787] Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash
  2022-11-16  3:53 [Bug gdb/29787] New: Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash vimacs.hacks at gmail dot com
                   ` (3 preceding siblings ...)
  2022-11-17 16:27 ` tromey at sourceware dot org
@ 2022-11-17 16:34 ` tromey at sourceware dot org
  2022-11-17 16:48 ` tromey at sourceware dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2022-11-17 16:34 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
One other weirdness for me here is that supposedly infrun
disables pagination.  Looking into this, I found a buglet
in fetch_inferior_event:

void
fetch_inferior_event ()
{
  INFRUN_SCOPED_DEBUG_ENTER_EXIT;
...
  /* Temporarily disable pagination.  Otherwise, the user would be
     given an option to press 'q' to quit, which would cause an early
     exit and could leave GDB in a half-baked state.  */
  scoped_restore save_pagination
    = make_scoped_restore (&pagination_enabled, false);


That is, it disables pagination -- but after the logging is done.

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

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

* [Bug gdb/29787] Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash
  2022-11-16  3:53 [Bug gdb/29787] New: Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash vimacs.hacks at gmail dot com
                   ` (4 preceding siblings ...)
  2022-11-17 16:34 ` tromey at sourceware dot org
@ 2022-11-17 16:48 ` tromey at sourceware dot org
  2022-11-17 18:11 ` tromey at sourceware dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2022-11-17 16:48 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |tromey at sourceware dot org

--- Comment #6 from Tom Tromey <tromey at sourceware dot org> ---
Fixing fetch_inferior event is enough to fix this bug.
Should probably fix the logging in general, too, though.

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

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

* [Bug gdb/29787] Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash
  2022-11-16  3:53 [Bug gdb/29787] New: Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash vimacs.hacks at gmail dot com
                   ` (5 preceding siblings ...)
  2022-11-17 16:48 ` tromey at sourceware dot org
@ 2022-11-17 18:11 ` tromey at sourceware dot org
  2022-11-17 18:29 ` tromey at sourceware dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2022-11-17 18:11 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #7 from Tom Tromey <tromey at sourceware dot org> ---
It occurs to me now that changing fetch_inferior_event shouldn't
be needed, because gdb_stdlog should never cause paging.
So, that patch isn't actually needed.

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

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

* [Bug gdb/29787] Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash
  2022-11-16  3:53 [Bug gdb/29787] New: Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash vimacs.hacks at gmail dot com
                   ` (6 preceding siblings ...)
  2022-11-17 18:11 ` tromey at sourceware dot org
@ 2022-11-17 18:29 ` tromey at sourceware dot org
  2022-11-28 20:41 ` cvs-commit at gcc dot gnu.org
  2022-11-28 20:42 ` tromey at sourceware dot org
  9 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2022-11-17 18:29 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #8 from Tom Tromey <tromey at sourceware dot org> ---
https://sourceware.org/pipermail/gdb-patches/2022-November/193923.html

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

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

* [Bug gdb/29787] Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash
  2022-11-16  3:53 [Bug gdb/29787] New: Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash vimacs.hacks at gmail dot com
                   ` (7 preceding siblings ...)
  2022-11-17 18:29 ` tromey at sourceware dot org
@ 2022-11-28 20:41 ` cvs-commit at gcc dot gnu.org
  2022-11-28 20:42 ` tromey at sourceware dot org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-28 20:41 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #9 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

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

commit 1dd889362bb7027ebea754a161bf629270cc9042
Author: Tom Tromey <tromey@adacore.com>
Date:   Thu Nov 17 10:24:38 2022 -0700

    Don't let gdb_stdlog use pager

    When using the "set logging" commands, cli_interp_base::set_logging
    will send gdb_stdlog output (among others) to the tee it makes for
    gdb_stdout.  However, this has the side effect of also causing logging
    to use the pager.  This is PR gdb/29787.

    This patch fixes the problem by keeping stderr and stdlog separate
    from stdout, preserving the rule that only gdb_stdout should page.

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

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

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

* [Bug gdb/29787] Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash
  2022-11-16  3:53 [Bug gdb/29787] New: Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash vimacs.hacks at gmail dot com
                   ` (8 preceding siblings ...)
  2022-11-28 20:41 ` cvs-commit at gcc dot gnu.org
@ 2022-11-28 20:42 ` tromey at sourceware dot org
  9 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2022-11-28 20:42 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #10 from Tom Tromey <tromey at sourceware dot org> ---
Fixed.

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

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

end of thread, other threads:[~2022-11-28 20:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-16  3:53 [Bug gdb/29787] New: Using "set debug infrun on" and "set logging enabled" breaks GDB prompt and makes GDB crash vimacs.hacks at gmail dot com
2022-11-16  3:57 ` [Bug gdb/29787] " simark at simark dot ca
2022-11-16 18:11 ` tromey at sourceware dot org
2022-11-16 18:40 ` tromey at sourceware dot org
2022-11-17 16:27 ` tromey at sourceware dot org
2022-11-17 16:34 ` tromey at sourceware dot org
2022-11-17 16:48 ` tromey at sourceware dot org
2022-11-17 18:11 ` tromey at sourceware dot org
2022-11-17 18:29 ` tromey at sourceware dot org
2022-11-28 20:41 ` cvs-commit at gcc dot gnu.org
2022-11-28 20:42 ` tromey at sourceware dot 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).