From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C36FE3858D35; Wed, 8 Nov 2023 10:19:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C36FE3858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1699438752; bh=v85QaW/bgU/jqcC5US6s0PGzU6MIvcMqtcb1i08xGOY=; h=From:To:Subject:Date:From; b=AS1CzA7NpPHQkNT2erorlV1Z7Lkmwi9+9xiKCz8BJbjnYoyHwr+AZP+NWc8ggYYPI HFB+UtZAbvQCSt3MTWLJl9wmlXzZE7dOp0SVn3RwedS9uv03P/ruWjhPalgzuT+dqU Gmn8giQ71SrUsm/p3kO07QRpb2FHaSg4Va1U4k98= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug tui/31044] New: [gdb/tui] segfault when enabling TUI in window with two lines Date: Wed, 08 Nov 2023 10:19:11 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: tui X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org 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 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31044 Bug ID: 31044 Summary: [gdb/tui] segfault when enabling TUI in window with two lines Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: tui Assignee: unassigned at sourceware dot org Reporter: vries at gcc dot gnu.org Target Milestone: --- Say I got a terminal with 3 lines: ... $ echo $COLUMNS 71 $ echo $LINES 3 ... Doing: ... $ gdb -q a.out -tui ... gets me: ... =E2=94=8C=E2=94=80hello.c=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=90 (gdb)=20 ... I guess this hits the GIGO case here: ... /* Step 3: Resize. */ int size_accum =3D 0; const int maximum =3D m_vertical ? height : width; for (int i =3D 0; i < m_splits.size (); ++i) { /* If we fall off the bottom, just make allocations overlap.=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 GIGO. */ ... [ FWIW, we could make the source window unboxed in this case to make more efficiently use of our screen. ] Anyway, now reduce window size to two lines: ... $ echo $LINES 2 ... and try again: ... Thread 1 "gdb" received signal SIGSEGV, Segmentation fault. 0x0000000000d1e273 in gdb_puts (linebuffer=3D0x16df2e0 "Recursive internal problem.\n", stream=3D0x0) at /data/vries/gdb/src/gdb/utils.c:1811 1811 stream->puts (linebuffer); (gdb) bt #0 0x0000000000d1e273 in gdb_puts ( linebuffer=3D0x16df2e0 "Recursive internal problem.\n", stream=3D0x0) at /data/vries/gdb/src/gdb/utils.c:1811 #1 0x0000000000d1b1cd in abort_with_message ( msg=3D0x16df2e0 "Recursive internal problem.\n") at /data/vries/gdb/src/gdb/utils.c:177 #2 0x0000000000d1b36e in internal_vproblem(internal_problem *, const char = *, int, const char *, typedef __va_list_tag __va_list_tag *) (problem=3D0x26cb= 8e0 , file=3D0x1582e50 "/data/vries/gdb/src/gdb/cli-out= .c",=20 line=3D436, fmt=3D0x1582e11 "%s: Assertion `%s' failed.", ap=3D0x7fffff= ffcde8) at /data/vries/gdb/src/gdb/utils.c:339 #3 0x0000000000d1b90b in internal_verror (file=3D0x1582e50 "/data/vries/gdb/src/gdb/cli-out.c", line=3D436,=20 fmt=3D0x1582e11 "%s: Assertion `%s' failed.", ap=3D0x7fffffffcde8) at /data/vries/gdb/src/gdb/utils.c:476 #4 0x00000000014d5465 in internal_error_loc (file=3D0x1582e50 "/data/vries/gdb/src/gdb/cli-out.c", line=3D436,=20 fmt=3D0x1582e11 "%s: Assertion `%s' failed.") at /data/vries/gdb/src/gdbsupport/errors.cc:58 #5 0x00000000005ef44a in cli_ui_out::cli_ui_out (this=3D0x7fffffffcf30, stream=3D0x0, flags=3D...) at /data/vries/gdb/src/gdb/cli-out.c:436 #6 0x0000000000cc67f5 in ui_file::vprintf (this=3D0x0, format=3D0x16df363 = "%s\n", args=3D0x7fffffffd008) at /data/vries/gdb/src/gdb/ui-file.c:74 #7 0x0000000000d1e50d in gdb_vprintf (stream=3D0x0, format=3D0x16df363 "%s= \n", args=3D0x7fffffffd008) at /data/vries/gdb/src/gdb/utils.c:1876 #8 0x0000000000d1e5e4 in gdb_printf (stream=3D0x0, format=3D0x16df363 "%s\= n") at /data/vries/gdb/src/gdb/utils.c:1891 #9 0x0000000000d1b53c in internal_vproblem(internal_problem *, const char = *, int, const char *, typedef __va_list_tag __va_list_tag *) (problem=3D0x26cb= 8e0 ,=20 file=3D0x16b80c0 "/data/vries/gdb/src/gdb/tui/tui-layout.c", line=3D90, fmt=3D0x16b8020 "%s: Assertion `%s' failed.",=20 ap=3D0x7fffffffd238) at /data/vries/gdb/src/gdb/utils.c:393 #10 0x0000000000d1b90b in internal_verror (file=3D0x16b80c0 "/data/vries/gdb/src/gdb/tui/tui-layout.c", line=3D90,=20 fmt=3D0x16b8020 "%s: Assertion `%s' failed.", ap=3D0x7fffffffd238) at /data/vries/gdb/src/gdb/utils.c:476 #11 0x00000000014d5465 in internal_error_loc (file=3D0x16b80c0 "/data/vries/gdb/src/gdb/tui/tui-layout.c", line=3D90,=20 fmt=3D0x16b8020 "%s: Assertion `%s' failed.") at /data/vries/gdb/src/gdbsupport/errors.cc:58 #12 0x0000000000ca9cc2 in tui_apply_current_layout (preserve_cmd_win_size_p=3Dfalse) --Type for more, q to quit, c to continue without paging-- at /data/vries/gdb/src/gdb/tui/tui-layout.c:90 #13 0x0000000000caa05c in tui_set_layout (layout=3D0x2b58ee0) at /data/vries/gdb/src/gdb/tui/tui-layout.c:149 #14 0x0000000000caa305 in tui_set_initial_layout () at /data/vries/gdb/src/gdb/tui/tui-layout.c:225 #15 0x0000000000cc305b in tui_enable () at /data/vries/gdb/src/gdb/tui/tui.c:465 #16 0x0000000000ca4318 in tui_interp::resume (this=3D0x2d56890) at /data/vries/gdb/src/gdb/tui/tui-interp.c:132 #17 0x00000000008a4c49 in interp_set (interp=3D0x2d56890, top_level=3Dtrue)= at /data/vries/gdb/src/gdb/interps.c:148 #18 0x00000000008a4e56 in set_top_level_interpreter (name=3D0x2984950 "tui") at /data/vries/gdb/src/gdb/interps.c:199 #19 0x0000000000921926 in captured_main_1 (context=3D0x7fffffffda60) at /data/vries/gdb/src/gdb/main.c:1143 #20 0x000000000092223d in captured_main (data=3D0x7fffffffda60) at /data/vries/gdb/src/gdb/main.c:1314 #21 0x00000000009222dc in gdb_main (args=3D0x7fffffffda60) at /data/vries/gdb/src/gdb/main.c:1343 #22 0x0000000000418bd2 in main (argc=3D11, argv=3D0x7fffffffdb78) at /data/vries/gdb/src/gdb/gdb.c:39 (gdb)=20 ... We segfault while failing this assertion in tui_apply_current_layout: ... /* This should always be made visible by a layout. */ gdb_assert (TUI_CMD_WIN !=3D nullptr); ... FWIW, it's the same problem (not just the assertion failure, also the segfa= ult) when typing "tui enable" on the gdb prompt instead of using -tui. --=20 You are receiving this mail because: You are on the CC list for the bug.=