From patchwork Fri Jan 6 10:25:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 62792 Return-Path: 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 9C3FA384F037 for ; Fri, 6 Jan 2023 10:29:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9C3FA384F037 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673000955; bh=LCbS/a6N3S8MjiAV8GUZ53xUs+FT/s2YaIKlZzSnhuw=; 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=Nh+7S5gzMVPekUwlB8uv05z6Lq716fX9VvFUeiIuA1DJfbJ5ed66nUArFubL9eSsy azupELmTN0fJQqOF5VkGfSdrsdK/Q0C8R5fRR1luSjofj8PYXkHa9h3u6wjG0xLLtr spgitqNdXhUAtbq+wUL8dmTYpK1OYjuSKcvTTzdE= 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 C6C95385B539 for ; Fri, 6 Jan 2023 10:26:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C6C95385B539 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-14-ZCLrucEPNXW3fGRyyW4LIw-1; Fri, 06 Jan 2023 05:26:22 -0500 X-MC-Unique: ZCLrucEPNXW3fGRyyW4LIw-1 Received: by mail-ed1-f69.google.com with SMTP id x13-20020a05640226cd00b0047ac11c9774so950270edd.17 for ; Fri, 06 Jan 2023 02:26:22 -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=LCbS/a6N3S8MjiAV8GUZ53xUs+FT/s2YaIKlZzSnhuw=; b=WUkUF0YRwQ8Ag+p4gIwWO3qhPURSkbmi7i45wePCmnIIdlCvGywslGl87gQKvD1Gel jUc3PFvSgDhk+RtYdxhOba2KbSx39ppeBjmIBYTPn3wbd5EGK+jrHBaZ86NHCPL/PnjU lVaSSUKfV2jmkxM/HoHxxZDvq1lSDURXOT8LUX+yuquPCok5CQ3BH/cyoDr5KdcO9lsF 0h9O/hckt0JdKz7i6wZgd9FPlcNbhJXIawhN+Qclu41TcV8L5vc0vqJPIbAlxQXlnRx0 nj+T8e72DS0+7ub024n9dKIn2ioQMR9dmvNYvyTxFk+khx3Cwr6AzAspyyIvTqDOYWxJ gQ/A== X-Gm-Message-State: AFqh2krxnXcA6kDE3ZbfHys5OG2EWyoWgj074qESTgiHWuX7r561ZWXV V05Qgb3O3XVQl/hI6E9I/nHuOn0gEvWbF3OntXj5vbidmqYG0HZWBI8EiNS0X97OCz7iBkOA5E0 3WqHFdNzYH+0M0NLVC6OGhCNijyBPxLtLGQssyuyo0i56DM3lOCkQQMoxJglTmPeTqHn02gUtiA == X-Received: by 2002:a17:906:1e17:b0:84c:69f8:2ec2 with SMTP id g23-20020a1709061e1700b0084c69f82ec2mr30094938ejj.22.1673000781153; Fri, 06 Jan 2023 02:26:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXtgZi89JwK6QHVSagZ8Z4b/+Gl0C0/nzYltZRzsbVXrNqG2eLLprO1eMCKoOI7BtGJ1FCjt3Q== X-Received: by 2002:a17:906:1e17:b0:84c:69f8:2ec2 with SMTP id g23-20020a1709061e1700b0084c69f82ec2mr30094926ejj.22.1673000780910; Fri, 06 Jan 2023 02:26:20 -0800 (PST) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id kv18-20020a17090778d200b007c4f8bc322asm259931ejc.196.2023.01.06.02.26.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jan 2023 02:26:20 -0800 (PST) To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 13/15] gdb/tui: avoid extra refresh_window on vertical scroll Date: Fri, 6 Jan 2023 10:25:40 +0000 Message-Id: <62eb6cb39a74f263852e9f6bcd01ba00b5a8b4a0.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 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andrew Burgess via Gdb-patches From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" While working on the previous couple of patches I noticed that when I scroll the src and asm windows vertically, I get two refresh_window calls. The two calls can be traced back to tui_source_window_base::update_source_window_as_is, in here we call show_source_content, which calls refresh_window, and then update_exec_info, which also calls refresh_window. In this commit I propose making the refresh_window call in update_exec_info optional. In update_source_window_as_is I'll then call update_exec_info before calling show_source_content, and pass a flag to update_exec_info to defer the refresh. There are places where update_exec_info is used without any subsequent refresh_window call (e.g. when a breakpoint is updated), so update_exec_info does not to call refresh_window in some cases, which is why I'm using a flag to control the refresh. With this changes I'm now only seeing a single refresh_window call for each vertical scroll. There should be no user visible changes after this commit. --- gdb/tui/tui-winsource.c | 12 ++++++------ gdb/tui/tui-winsource.h | 9 ++++++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 50efa80576f..b5b6079a909 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -172,8 +172,8 @@ tui_source_window_base::update_source_window_as_is { validate_scroll_offsets (); update_breakpoint_info (nullptr, false); + update_exec_info (false); show_source_content (); - update_exec_info (); } } @@ -636,11 +636,10 @@ tui_source_window_base::update_breakpoint_info return need_refresh; } -/* Function to initialize the content of the execution info window, - based upon the input window which is either the source or - disassembly window. */ +/* See tui-winsource.h. */ + void -tui_source_window_base::update_exec_info () +tui_source_window_base::update_exec_info (bool refresh_p) { update_breakpoint_info (nullptr, true); for (int i = 0; i < m_content.size (); i++) @@ -668,5 +667,6 @@ tui_source_window_base::update_exec_info () show_line_number (i); } - refresh_window (); + if (refresh_p) + refresh_window (); } diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h index 2762afff010..7370ae95d8b 100644 --- a/gdb/tui/tui-winsource.h +++ b/gdb/tui/tui-winsource.h @@ -148,7 +148,14 @@ struct tui_source_window_base : public tui_win_info virtual bool location_matches_p (struct bp_location *loc, int line_no) = 0; - void update_exec_info (); + /* Fill in the left margin of the current window with execution indicator + information, e.g. breakpoint indicators, and line numbers. When + REFRESH_P is true this function will call refresh_window to ensure + updates are written to the screen, otherwise the refresh is skipped, + which will leave the on screen contents out of date. When passing + false for REFRESH_P you should be planning to call refresh_window + yourself. */ + void update_exec_info (bool refresh_p = true); /* Update the window to display the given location. Does nothing if the location is already displayed. */