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 C6C95385B539 for ; Fri, 6 Jan 2023 10:26:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C6C95385B539 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=1673000784; 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=gYTObLDeYD2IfMAgdGg2rhbe5dt0hFYryLfIafrGFrHlzgF9Nua9jyclUBHgun/+yu4INt b0uNrAW1XGUZgw4lItUuLYkYtXlC1ruQeh/pPdhfINBzrh/5M77AHpR5htDErp4mR40E/F GSH7BXPO+mwDa6ewzfN1SOa5QQs0+cs= 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) From: Andrew Burgess 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 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