From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B1CDD385AC28; Mon, 7 Mar 2022 21:38:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B1CDD385AC28 From: "aburgess at redhat dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/28948] New: Enabling/disabling logging over an interpreter switch can crash gdb Date: Mon, 07 Mar 2022 21:38:41 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: aburgess at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Mar 2022 21:38:41 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28948 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=20 (gdb) set logging enabled on=20 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=3D28620 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 pro= blem 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 disap= pear from the screen, and usually GDB crashes pretty quickly. --=20 You are receiving this mail because: You are on the CC list for the bug.=