public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/28948] New: Enabling/disabling logging over an interpreter switch can crash gdb
@ 2022-03-07 21:38 aburgess at redhat dot com
  2022-08-10 19:07 ` [Bug gdb/28948] " tromey at sourceware dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: aburgess at redhat dot com @ 2022-03-07 21:38 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 28948
           Summary: Enabling/disabling logging over an interpreter switch
                    can crash gdb
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: aburgess at redhat dot com
  Target Milestone: ---

Try this GDB session:

 (gdb) file /path/to/some/executable
 (gdb) set logging file /tmp/gdb.log
 (gdb) set logging debugredirect on 
 (gdb) set logging enabled on 
 Copying output to /tmp/gdb.log.
 Redirecting debug output to /tmp/gdb.log.
 (gdb) set debug infrun 1
 (gdb) start
 ... snip ...
 (gdb) tui enable

 # Then at the TUI prompt:

 (gdb) set logging debugredirect off
 (gdb) set logging enabled off
 (gdb) stepi
 (gdb) stepi
 (gdb) stepi

 # By this point GDB has usually crashed for me.

This is very similar to this bug:

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

It might almost be considered a duplicate of that bug, but I'm not 100% sure
the same fix for the previous will also fix this, though the underlying problem
is identical in nature.

What happens is that when we enable logging, GDB stashes the current output
file descriptors to one side, and replaces them with alternative file
descriptors.  Then, when we switch interpreter (tui enable) we replace the
current output streams with the streams for the new interpreter.

Then, when we disable logging, we replace the current streams (those for the
tui now) with the earlier backed up streams (those from before logging was
enabled), which happen to be the streams for the CLI.

At this point, weird stuff happens.  Usually the TUI will immediately disappear
from the screen, and usually GDB crashes pretty quickly.

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

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

end of thread, other threads:[~2022-08-12 20:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-07 21:38 [Bug gdb/28948] New: Enabling/disabling logging over an interpreter switch can crash gdb aburgess at redhat dot com
2022-08-10 19:07 ` [Bug gdb/28948] " tromey at sourceware dot org
2022-08-11 13:05 ` tromey at sourceware dot org
2022-08-12 17:23 ` tromey at sourceware dot org
2022-08-12 20:02 ` 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).