Message ID | 41ae74a51377abd813ad2bdb29cedfbfbdc54e3c.1673000632.git.aburgess@redhat.com |
---|---|
State | Committed |
Commit | 6789344ab22f7fbce94a31297b994f85685b90c6 |
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DB279384F031 for <patchwork@sourceware.org>; Fri, 6 Jan 2023 10:27:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB279384F031 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673000848; bh=Q7jzm48HHwjSwjGD1mvU2ypNvJbQTjN70k6LFd1pjeU=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=ZtLB2+uged5ixW3X/uoAad/zhIhapXM870H5P9u5b/I9gmA8W96ejZQwfWlJG8Edn u++r2epohpnY8vCyGZYFj/RYKvfFoC8Aoienn8dct6CDbXRpV4byBYjvIALNy/x59V gwJQhzCOUyJhZ95Acmo+CH/NSM3fGoI/bVlDL+lA= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org 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 <gdb-patches@sourceware.org>; Fri, 6 Jan 2023 10:26:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0F7C93858D33 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 <gdb-patches@sourceware.org>; 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) To: gdb-patches@sourceware.org Cc: Andrew Burgess <aburgess@redhat.com> 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: <cover.1673000632.git.aburgess@redhat.com> References: <cover.1673000632.git.aburgess@redhat.com> 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> From: Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> Reply-To: Andrew Burgess <aburgess@redhat.com> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
Mixed bag of TUI tests and fixes
|
|
Commit Message
Andrew Burgess
Jan. 6, 2023, 10:25 a.m. UTC
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(-)
Comments
Andrew Burgess <aburgess@redhat.com> writes: > 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. I've gone ahead and pushed this patch. The final version is included below. Thanks, Andrew --- commit 6789344ab22f7fbce94a31297b994f85685b90c6 Author: Andrew Burgess <aburgess@redhat.com> Date: Thu Dec 22 12:43:38 2022 +0000 gdb/tui: convert if/error to an assert 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. 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);
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);