From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 0F7C93858D33 for ; Fri, 6 Jan 2023 10:26:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0F7C93858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673000761; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Q7jzm48HHwjSwjGD1mvU2ypNvJbQTjN70k6LFd1pjeU=; b=huWj0HuG3QilYtln+g0sVd4xUrfiyHlwWgntK8Tu9faYrUf1182SPXvykRlm4S2dPERwxI akTx16HNetVXo8yjjPm3lUyDwJppF0PAHvNQn4ze6xTQRt6wosCvWaU28Bfb/WMkcI0OE0 /qwLULkKmkAlt2s0bul0B/eN6a/yg24= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-210-EubwYOkzNPirk4sB5A0igw-1; Fri, 06 Jan 2023 05:26:00 -0500 X-MC-Unique: EubwYOkzNPirk4sB5A0igw-1 Received: by mail-ed1-f72.google.com with SMTP id z20-20020a05640240d400b0047028edd264so954438edb.20 for ; Fri, 06 Jan 2023 02:26:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q7jzm48HHwjSwjGD1mvU2ypNvJbQTjN70k6LFd1pjeU=; b=CzxNYVU3DPpBRIkQUtLPsPO73DveptSKFmgl0/Vbl03haFwfvJtLbzWf3kxxdUTbo1 bePgWkQafCgvn51RMxrq7sH2YUA1YAAey8XiVs/dBOlvTxW/bnNhHKkbxJtYnwEaAF2t ygDnlIg7twKb/7SjHE0zJrkyhQ7y5vSZcGD0fsD5l7fGqWTVo+kNKUYrwuPs7+U2+8qj jkmVceqKB7E30fwJ18D1g9/4Mynr6AH1X0AwvJcFjH60EbN7kLpXVUAJCREyeeHnMa7J VVdjRIlmLnTSWV2Fyh/pW01uw8TJ3W1stBV8mgpGlNzNQvaKUnGu8vGv6Iz32yYNk30C 7E8A== X-Gm-Message-State: AFqh2kr0miETuItGmPtllYD8HmDhJeUpUrZrW9fbj9yQkDNMLAiHCpKr KzpxVQ1bRzfP6U57ZPNOckr+clSf5TNfAnd21VsIxB8sVgyioH2mBv3XQ+k5094zidWEBKDfyBQ KSKFH7V+esId9oD4rBDKftJh+Z7YZYMmRBl4hOX93wEgOky6+/4dxwuQAk5/2RAM8hWHHEzYt2A == X-Received: by 2002:a17:907:8748:b0:7c1:ad6:7331 with SMTP id qo8-20020a170907874800b007c10ad67331mr52534234ejc.27.1673000759417; Fri, 06 Jan 2023 02:25:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXtvbnZ6swcwPEMQ3GbjuarSp0/TpeBxQpiPxpgKJNhF7KwCloa+GjDLPIKWXc7vdZ5uuQqBHg== X-Received: by 2002:a17:907:8748:b0:7c1:ad6:7331 with SMTP id qo8-20020a170907874800b007c10ad67331mr52534222ejc.27.1673000759200; Fri, 06 Jan 2023 02:25:59 -0800 (PST) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id ew3-20020a170907950300b0084cc121f49esm268233ejc.83.2023.01.06.02.25.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jan 2023 02:25:58 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 05/15] gdb/tui: convert if/error to an assert Date: Fri, 6 Jan 2023 10:25:32 +0000 Message-Id: <41ae74a51377abd813ad2bdb29cedfbfbdc54e3c.1673000632.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: While working on the previous commit, I realised that there was an error in tui_set_focus_command that could never be triggered. Since the big tui rewrite (adding dynamic layouts) it is no longer true that there is a tui_win_info object for every window at all times. We now only create a tui_win_info object for a particular window, when the window is part of the current layout. As a result, if we have a tui_win_info pointer, then the window must be visible inside tui_set_focus_command (this function calls tui_enable as its first action, which makes the current layout visible). The gdb.tui/tui-focus.exp test script exercises this area of code, and doesn't trigger the assert, nor do any of our other existing tui tests. --- gdb/tui/tui-win.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 9c088899817..4fc8e7a4503 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -720,8 +720,11 @@ tui_set_focus_command (const char *arg, int from_tty) if (win_info == NULL) error (_("Unrecognized window name \"%s\""), arg); - if (!win_info->is_visible ()) - error (_("Window \"%s\" is not visible"), arg); + + /* If a window is part of the current layout then it will have a + tui_win_info associated with it and be visible, otherwise, there will + be no tui_win_info and the above error will have been raised. */ + gdb_assert (win_info->is_visible ()); if (!win_info->can_focus ()) error (_("Window \"%s\" cannot be focused"), arg); -- 2.25.4