From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id mUb8KXXo4WkY2B0AWB0awg (envelope-from ) for ; Fri, 17 Apr 2026 03:59:49 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=jc6qpWI2; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=UL3c8Y7G; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=jc6qpWI2; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=UL3c8Y7G; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id A4D331E0C3; Fri, 17 Apr 2026 03:59:49 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED,WEIRD_PORT autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 5B6681E0B1 for ; Fri, 17 Apr 2026 03:59:47 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id F14BA4BAE7E6 for ; Fri, 17 Apr 2026 07:59:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F14BA4BAE7E6 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=jc6qpWI2; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=UL3c8Y7G; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=jc6qpWI2; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=UL3c8Y7G Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id 2667D4BA23EF for ; Fri, 17 Apr 2026 07:57:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2667D4BA23EF Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2667D4BA23EF Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776412665; cv=none; b=HSnLFHWmz1zyCiMzgnKtjO5wfNxJfqzmUQRVWl+OuFdIJzTNfphLwk6O4faVMc0yiazu2gK0jXvTohd9mgNENVckeHvzaP02GF24WI4v+G6l6OCaxbFka9PrcwZEIaPYttR862c9DZ65kI/GQAUT/iuv4zVpGKGFd1ZwY9xpobk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776412665; c=relaxed/simple; bh=En0Vt8o5XbQ4ZdmOfj0TM3q/DSXksCdwJw4wpKFkiTk=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=wqaf8cBoxTyvxgC6VEjjOp/zCyV0GYoS4ug8tL52aYULiz1dBfacGCebI7r7lZdUs3S3gVpWHqXcAf1m9sP0VyP1cMqPDLZy1RjLOL2vCxdxVBCndcCBeo48OcWLY3bxTm68AnrOLMLuV/5ezu8HTOe/zXgPx1/aDIJf6LIL9iU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2667D4BA23EF Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 22D725BE21 for ; Fri, 17 Apr 2026 07:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1776412640; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J30Bn7sVQ69sRgjWBS3uhBe+ysD2r95cK1ytc5nSquQ=; b=jc6qpWI2RdLBzM/8eBJ2ZpU2B1u8/kcUODj+G2fesEC+R3JSjhBgzSXYYiCAuNPNeGGy4b ibJ+aDDnTCrWUzqEerLUS7Mcy3VDxBhRhUgi11VpaHmI2CZCq1phU2+vV9NirFVn2bhL5y mIa9Bzzrvp+kPOE/as+8vx0dgjYOnc0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1776412640; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J30Bn7sVQ69sRgjWBS3uhBe+ysD2r95cK1ytc5nSquQ=; b=UL3c8Y7GOt71o5W5SrUXxNtqOzUYS0BdcIplof7/0oDvLCURKXcAuR2qoeqdxxL0zVUUdS gz77oWy19S9tpmBg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=jc6qpWI2; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=UL3c8Y7G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1776412640; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J30Bn7sVQ69sRgjWBS3uhBe+ysD2r95cK1ytc5nSquQ=; b=jc6qpWI2RdLBzM/8eBJ2ZpU2B1u8/kcUODj+G2fesEC+R3JSjhBgzSXYYiCAuNPNeGGy4b ibJ+aDDnTCrWUzqEerLUS7Mcy3VDxBhRhUgi11VpaHmI2CZCq1phU2+vV9NirFVn2bhL5y mIa9Bzzrvp+kPOE/as+8vx0dgjYOnc0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1776412640; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J30Bn7sVQ69sRgjWBS3uhBe+ysD2r95cK1ytc5nSquQ=; b=UL3c8Y7GOt71o5W5SrUXxNtqOzUYS0BdcIplof7/0oDvLCURKXcAuR2qoeqdxxL0zVUUdS gz77oWy19S9tpmBg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 0D45E593AF for ; Fri, 17 Apr 2026 07:57:20 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id WARmAeDn4WkYHgAAD6G6ig (envelope-from ) for ; Fri, 17 Apr 2026 07:57:20 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH v6 1/4] [gdb/tui] Fix crash with debuginfod query (tui enable) Date: Fri, 17 Apr 2026 09:57:16 +0200 Message-ID: <20260417075719.852558-2-tdevries@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260417075719.852558-1-tdevries@suse.de> References: <20260417075719.852558-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim, suse.de:mid, gnu.org:url, sourceware.org:url] X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: 22D725BE21 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org PR tui/31449 reports a SIGFPE when the debuginfod query happens while enabling TUI using the "tui enable" command: ... Thread 1 "gdb" received signal SIGFPE, Arithmetic exception. 0x0000000001021084 in tui_inject_newline_into_command_window () at /data/vries/gdb/src/gdb/tui/tui-io.c:1096 1096 py += px / tui_cmd_win ()->width; ... due to divide-by-zero because tui_cmd_win ()->width == 0. The corresponding backtrace is: ... (gdb) bt #0 0x0000000001021084 in tui_inject_newline_into_command_window () at gdb/tui/tui-io.c:1096 #1 0x0000000000fe65fd in gdb_readline_wrapper_line (line=...) at gdb/top.c:939 #2 0x0000000000944eef in gdb_rl_callback_handler (rl=0x2cc865a0 "n") at gdb/event-top.c:288 #3 0x0000000001175779 in rl_callback_read_char () at readline/readline/callback.c:302 #4 0x0000000000944bc3 in gdb_rl_callback_read_char_wrapper_sjlj () at gdb/event-top.c:197 #5 0x0000000000944cd4 in gdb_rl_callback_read_char_wrapper_noexcept () at gdb/event-top.c:240 #6 0x0000000000944d52 in gdb_rl_callback_read_char_wrapper (...) at gdb/event-top.c:252 #7 0x0000000001062352 in stdin_event_handler (error=0, client_data=0x2c865150) at gdb/ui.c:154 #8 0x0000000001a04edf in handle_file_event (file_ptr=0x2ccf8850, ready_mask=1) at gdbsupport/event-loop.cc:551 #9 0x0000000001a05522 in gdb_wait_for_event (block=1) at gdbsupport/event-loop.cc:672 #10 0x0000000001a043ff in gdb_do_one_event (mstimeout=-1) at gdbsupport/event-loop.cc:263 #11 0x00000000006d5480 in interp::do_one_event (this=0x2cc2af20, mstimeout=-1) at gdb/interps.h:93 #12 0x0000000000fe670d in gdb_readline_wrapper ( prompt=0x2ccca4e0 "Enable debuginfod for this session? (y or [n]) ") at gdb/top.c:1033 #13 0x00000000010c6853 in defaulted_query(...) (...) at gdb/utils.c:844 #14 0x00000000010c6b8a in nquery (...) at gdb/utils.c:901 #15 0x00000000007a9324 in debuginfod_is_enabled () at gdb/debuginfod-support.c:268 #16 0x00000000007a950d in debuginfod_source_query (...) at gdb/debuginfod-support.c:311 #17 0x0000000000efc2c7 in open_source_file (s=0x2cc8f4b0) at gdb/source.c:1152 #18 0x0000000000efc619 in symtab_to_fullname (...) at gdb/source.c:1214 #19 0x0000000000f5ebb3 in find_line_symtab (...) at gdb/symtab.c:3287 #20 0x0000000000f5f0e5 in find_pc_for_line (...) at gdb/symtab.c:3391 #21 0x0000000001011f54 in tui_get_begin_asm_address (...) at gdb/tui/tui-disasm.c:404 #22 0x000000000104888d in tui_source_window_base::rerender (this=0x2cbdc570) at gdb/tui/tui-winsource.c:474 #23 0x0000000001028e81 in tui_win_info::resize (this=0x2cbdc570, height_=21, width_=127, origin_x_=0, origin_y_=0) at gdb/tui/tui-layout.c:299 #24 0x00000000010297d0 in tui_layout_window::apply (this=0x2cc50350, x_=0, y_=0, width_=127, height_=21, preserve_cmd_win_size_p=false) at gdb/tui/tui-layout.c:432 #25 0x000000000102bfea in tui_layout_split::apply (this=0x2caea920, x_=0, y_=0, width_=127, height_=33, preserve_cmd_win_size_p=false) at gdb/tui/tui-layout.c:1026 #26 0x0000000001028267 in tui_apply_current_layout (...) at gdb/tui/tui-layout.c:68 #27 0x0000000001028737 in tui_set_layout (layout=0x2c9b9e90) at gdb/tui/tui-layout.c:133 #28 0x0000000001028af5 in tui_set_initial_layout () at gdb/tui/tui-layout.c:209 #29 0x000000000104b795 in tui_enable () at gdb/tui/tui.c:496 #30 0x000000000104bab3 in tui_enable_command (args=0x0, from_tty=1) at gdb/tui/tui.c:591 #31 0x00000000006c5ffe in do_simple_func (args=0x0, from_tty=1, c=0x2c9bb2f0) at gdb/cli/cli-decode.c:94 #32 0x00000000006cc94f in cmd_func (cmd=0x2c9bb2f0, args=0x0, from_tty=1) at gdb/cli/cli-decode.c:2831 #33 0x0000000000fe53ad in execute_command (p=0x2c86699a "", from_tty=1) at gdb/top.c:563 #34 0x000000000094584d in command_handler (command=0x2c866990 "tui enable") at gdb/event-top.c:611 #35 0x0000000000945dfe in command_line_handler (rl=...) at gdb/event-top.c:844 #36 0x000000000101e916 in tui_command_line_handler (rl=...) at gdb/tui/tui-interp.c:101 #37 0x0000000000944eef in gdb_rl_callback_handler (rl=0x2cc86a30 "tui enable") at gdb/event-top.c:288 #38 0x0000000001175779 in rl_callback_read_char () at readline/readline/callback.c:302 #39 0x0000000000944bc3 in gdb_rl_callback_read_char_wrapper_sjlj () at gdb/event-top.c:197 #40 0x0000000000944cd4 in gdb_rl_callback_read_char_wrapper_noexcept () at gdb/event-top.c:240 #41 0x0000000000944d52 in gdb_rl_callback_read_char_wrapper (...) at gdb/event-top.c:252 #42 0x0000000001062352 in stdin_event_handler (error=0, client_data=0x2c865150) at gdb/ui.c:154 #43 0x0000000001a04edf in handle_file_event (file_ptr=0x2ccf8850, ready_mask=1) at gdbsupport/event-loop.cc:551 #44 0x0000000001a05522 in gdb_wait_for_event (block=1) at gdbsupport/event-loop.cc:672 #45 0x0000000001a043ff in gdb_do_one_event (mstimeout=-1) at gdbsupport/event-loop.cc:263 #46 0x00000000006d5480 in interp::do_one_event (this=0x2cc2af20, mstimeout=-1) at gdb/interps.h:93 #47 0x0000000000b77f25 in start_event_loop () at gdb/main.c:403 #48 0x0000000000b78113 in captured_command_loop () at gdb/main.c:468 #49 0x0000000000b7a07c in captured_main (context=0x7fff660b9e60) at gdb/main.c:1381 #50 0x0000000000b7a178 in gdb_main (args=0x7fff660b9e60) at gdb/main.c:1400 #51 0x0000000000419705 in main (argc=5, argv=0x7fff660b9f98) at gdb/gdb.c:38 (gdb) ... The problem is that the command window is used (during initialization of the source window) before it's properly initialized. Fix this by adding a check at the start of tui_inject_newline_into_command_window that avoids the SIGFPE. This makes the behavior on x86_64-linux (where we ran into the SIGFPE) equivalent to the behavior on aarch64-linux, where a divide-by-zero just returns zero. Note that this does not address the fact that the query happens somewhere during rather than before or after TUI initialization, so the query itself continues to look odd: ... This GDB supports auto-downloading debuginfo from the following URLs: Enable debuginfod for this session? (y or [n]) ... The fix is minimal, and consequently low-risk, and applies cleanly to the gdb-17-branch. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31449 --- gdb/testsuite/gdb.tui/query-foo.c | 24 ++++++++ gdb/testsuite/gdb.tui/query.exp | 99 +++++++++++++++++++++++++++++++ gdb/tui/tui-io.c | 3 + 3 files changed, 126 insertions(+) create mode 100644 gdb/testsuite/gdb.tui/query-foo.c create mode 100644 gdb/testsuite/gdb.tui/query.exp diff --git a/gdb/testsuite/gdb.tui/query-foo.c b/gdb/testsuite/gdb.tui/query-foo.c new file mode 100644 index 00000000000..bf4a8766dcd --- /dev/null +++ b/gdb/testsuite/gdb.tui/query-foo.c @@ -0,0 +1,24 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2026 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +extern int foo (void); + +int +foo (void) +{ + return 0; +} diff --git a/gdb/testsuite/gdb.tui/query.exp b/gdb/testsuite/gdb.tui/query.exp new file mode 100644 index 00000000000..acf0db63ebb --- /dev/null +++ b/gdb/testsuite/gdb.tui/query.exp @@ -0,0 +1,99 @@ +# Copyright 2026 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Check that a debuginfod query during TUI initialization doesn't cause a +# crash. + +require allow_tui_tests + +load_lib debuginfod-support.exp +require allow_debuginfod_tests + +tuiterm_env + +standard_testfile -main.c -foo.c + +set tmpfile [standard_output_file $srcfile] +set srcfiles [list $tmpfile $srcfile2] + +set fd [open $tmpfile w] +puts $fd { + extern int foo (void); + int + main (void) + { + return foo (); + } +} +close $fd + +if { [build_executable "failed to prepare" $testfile $srcfiles] == -1 } { + return +} + +# Delete query-main.c to trigger the debuginfod query during TUI +# initialization. +file delete $tmpfile + +set l {} +lappend l "command" +# Disabled due to PR33794. +#lappend l "keys" + +foreach_with_prefix how $l { + save_vars { env(DEBUGINFOD_URLS) } { + setenv DEBUGINFOD_URLS "foo" + Term::clean_restart 24 80 $testfile + } + + if {![Term::prepare_for_tui]} { + return 0 + } + + Term::gen_prompt + + if { $how == "command" } { + send_gdb "tui enable\n" + set re \ + [string_to_regexp \ + {(y or [n]) }] + gdb_assert { [Term::wait_for_region_contents 0 0 80 24 $re] } + send_gdb "n\n" + Term::wait_for "" + } else { + send_gdb "\030\001" + set re \ + "Please set debuginfod enabled to on or off before enabling TUI" + gdb_assert { [Term::wait_for_region_contents 0 0 80 24 $re] } + } + + # Check that prompt is responsive. + gdb_assert { [Term::command "print 1"] } "responsive prompt" + + set cmd "set debuginfod enabled off" + gdb_assert { [Term::command "$cmd"] } $cmd + + with_test_prefix tui { + if { $how == "command" } { + send_gdb "tui enable\n" + } else { + send_gdb "\030\001" + } + gdb_assert { [Term::wait_for ""] } "entered" + + # Check that prompt is responsive. + gdb_assert { [Term::command "print 1"] } "responsive prompt" + } +} diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c index 642b88ead0c..503c7edf4d6 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -1080,6 +1080,9 @@ void tui_inject_newline_into_command_window () { gdb_assert (tui_active); + if (tui_cmd_win () == nullptr || tui_cmd_win ()->width == 0 + || tui_cmd_win ()->height == 0) + return; WINDOW *w = tui_cmd_win ()->handle.get (); -- 2.51.0