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 CE026385842E for ; Wed, 25 Jan 2023 12:09:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CE026385842E 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=1674648551; 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=LCbS/a6N3S8MjiAV8GUZ53xUs+FT/s2YaIKlZzSnhuw=; b=VrziqJshauryYWvwptz93T290ab1Thv9VFgHjbm9RLbhVQSowc+ZFk3mT3KfJRPQ0GNfhO jaJEPKl/yJQtAxJoxEDDVCFwSUIRMxB3vao43ny9baMFQ/Z0M7wHPeQELieS6eRLWEQCBA GkJpNvepCKPu2lnTj2OY+gc4rKGYYxg= Received: from mail-yw1-f197.google.com (mail-yw1-f197.google.com [209.85.128.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-450-_XtJcDtiPCamsOp5Xh_s2Q-1; Wed, 25 Jan 2023 07:09:10 -0500 X-MC-Unique: _XtJcDtiPCamsOp5Xh_s2Q-1 Received: by mail-yw1-f197.google.com with SMTP id 00721157ae682-5062f3a2977so70086557b3.21 for ; Wed, 25 Jan 2023 04:09:10 -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=wpJpZORa7/y3H4839B9hSIxfy+szGOVF9vIXN2qCtWmZVAhHnsGaQ5jQKQ1jyJan90 AYmXATrKaDz6oO6e1LjhhVQtF6ZOIbR3y114mFDiAwLacesLziJdgN9iBypyHo1h8byg +bRx6lr77roqf7cmf5KCNOFOio8OTsaaBMdZMgcpX3tP+q8AGXs5toRazk+JHhHZnXhK fR8040rXhgcdR1x9rQijlk/UWiaOZ7OilEVCRf6VqVUZwGbCil8zk8auZ+QclqXB/Y/m v193gL/RV8YdsLwTnvZKIPKNgj847ViFkmDHKJlnUWuuxDtJRUctBkWpXbbWVJ4UpN1c PQSw== X-Gm-Message-State: AO0yUKXQYYft3ebOsjV7Ap6aoVxsqjsgzTKDnUNJWNmovCKc514DhVC/ eQq0E7veR4FncMle6+qoLoFTtCN72sRHUO9/QWki6zn1Eo1jakIIwpLRsBwppcUjzyBXQedNiPo 9QD6WXF7j/7T7TW19uXjtMULv6kmUABGAYsdT3vg0dLA/9lmWmoyLbMxuZ5hCygKIpMDsvG2yTQ == X-Received: by 2002:a05:690c:d20:b0:506:4342:1a2d with SMTP id cn32-20020a05690c0d2000b0050643421a2dmr3932873ywb.12.1674648549781; Wed, 25 Jan 2023 04:09:09 -0800 (PST) X-Google-Smtp-Source: AK7set+qwJSt6b8HH8XAtlnqohIZqiCj+5RxroiFAFlmKZWEgy9MMfJKdAxutrbu2xaiDe5GbBztLg== X-Received: by 2002:a05:690c:d20:b0:506:4342:1a2d with SMTP id cn32-20020a05690c0d2000b0050643421a2dmr3932854ywb.12.1674648549445; Wed, 25 Jan 2023 04:09:09 -0800 (PST) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id b5-20020a378005000000b00704a2a40cf2sm3343955qkd.38.2023.01.25.04.09.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 04:09:09 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv2 7/8] gdb/tui: avoid extra refresh_window on vertical scroll Date: Wed, 25 Jan 2023 12:08:47 +0000 Message-Id: <9ad682de863f902b18660243f5ab0e88c56b1c65.1674648473.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,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 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. */ -- 2.25.4