From patchwork Fri Jan 6 10:25:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 62793 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 31D8C3857C44 for ; Fri, 6 Jan 2023 10:29:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 31D8C3857C44 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673000987; bh=pmk6w1/4OYnPSe5NK3XRH/80PsnaQS0/RDZpEiNljHs=; 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=nORjy5XnhEoaD4tbHrVjpcY8G2xwZrB3P2/0CavsSmKybNB2rn8waYdtNY0itJ6/F YBZWgo/nnr4XpEtdYA072nJMdw1RcBofxOsjyy2yJUCpWUYmcT9fOkLxn86xydQ0d2 GXEavXmuk/rKBkQkINDvQyFw6yZJT4DeTM9SxvI8= 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.129.124]) by sourceware.org (Postfix) with ESMTPS id 45A913858439 for ; Fri, 6 Jan 2023 10:26:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 45A913858439 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-183-WbV4w1v4PU6X1B-XH057ow-1; Fri, 06 Jan 2023 05:26:24 -0500 X-MC-Unique: WbV4w1v4PU6X1B-XH057ow-1 Received: by mail-ej1-f71.google.com with SMTP id nb4-20020a1709071c8400b007c18ba778e9so869553ejc.16 for ; Fri, 06 Jan 2023 02:26:24 -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=pmk6w1/4OYnPSe5NK3XRH/80PsnaQS0/RDZpEiNljHs=; b=Xu8Zo7LEfeFM5ipz3tI2Im1qCCve1ZuMC9haK7gihmSupGD5EC45x1J2RQCCO8ihzD sf2mOFWKScD/0MPS05jpo5Az6e1TS76i4VU9+e5plLTolG1q9/iT6WG9N0phPc7gAQ9A ms5xRO5gTcs54I5Ii58W8A8eSiQOZaxjftiO70YGOcD2HEIwgTNt/+LY8haOBnfjA4fs EZU2YL1YhPoaHGzr7xb6VtYSdCEg4xi8gnG9XRlgUpUnBXBCrkKCbGJjh+tOLLP6TX6A CEw4t0np9l71gNapcMZzMmPCxrF3T/Jwr1mrgFtYLOQ5s3vp9IBSHwG24Ll3+Wy+9Pjs kFDQ== X-Gm-Message-State: AFqh2kp/l52A8za0z6xtDVzZ/ahx+51F/uTFz1XN6OPNlaGrnv9bO4dd t8fU0Bm1vXwfU4srkS3osUsgXCnZsx2n/gay1DLX5cjs/Fto/tdNYwKdiGQ29rW0fu87QTOThuN /D4BhoAE5ztNYg/RogBVRCGo2KqxdCL7uR0e6leFCjFkkIk4bHeKV17UeDSCsEFbFNHkGCkPQcg == X-Received: by 2002:a05:6402:5510:b0:495:fa3d:1d72 with SMTP id fi16-20020a056402551000b00495fa3d1d72mr2201754edb.8.1673000783269; Fri, 06 Jan 2023 02:26:23 -0800 (PST) X-Google-Smtp-Source: AMrXdXvv49wXqpyMwoaIkoWT5csrqXNShdfn9+fSr2M02YWEkrBC5l1lGDdfg8HtN6VYwmE2jqCpkw== X-Received: by 2002:a05:6402:5510:b0:495:fa3d:1d72 with SMTP id fi16-20020a056402551000b00495fa3d1d72mr2201738edb.8.1673000782983; Fri, 06 Jan 2023 02:26:22 -0800 (PST) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id y5-20020aa7ccc5000000b00463bc1ddc76sm361896edt.28.2023.01.06.02.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jan 2023 02:26:22 -0800 (PST) To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 14/15] gdb/tui: more debug output Date: Fri, 6 Jan 2023 10:25:41 +0000 Message-Id: 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" Add some additional debug output that I've found really useful while working on the previous set of patches. Unless tui debug is turned on, then there should be no user visible changes with this commit. --- gdb/tui/tui-winsource.c | 21 +++++++++++++++++++++ gdb/tui/tui.h | 3 +++ 2 files changed, 24 insertions(+) diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index b5b6079a909..52a0f7af00f 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -316,6 +316,8 @@ tui_source_window_base::show_source_line (int lineno) void tui_source_window_base::refresh_window () { + TUI_SCOPED_DEBUG_START_END ("window `%s`", name ()); + /* tui_win_info::refresh_window would draw the empty background window to the screen, potentially creating a flicker. */ wnoutrefresh (handle.get ()); @@ -326,6 +328,12 @@ tui_source_window_base::refresh_window () int content_width = m_max_length; int pad_x = m_horizontal_offset - m_pad_offset; + tui_debug_printf ("pad_width = %d, left_margin = %d, view_width = %d", + pad_width, left_margin, view_width); + tui_debug_printf ("content_width = %d, pad_x = %d, m_horizontal_offset = %d", + content_width, pad_x, m_horizontal_offset); + tui_debug_printf ("m_pad_offset = %d", m_pad_offset); + gdb_assert (m_pad_offset >= 0); gdb_assert (m_horizontal_offset + view_width <= std::max (content_width, view_width)); @@ -346,6 +354,8 @@ tui_source_window_base::refresh_window () void tui_source_window_base::show_source_content () { + TUI_SCOPED_DEBUG_START_END ("window `%s`", name ()); + gdb_assert (!m_content.empty ()); /* The pad should be at least as wide as the window, but ideally, as wide @@ -390,6 +400,8 @@ tui_source_window_base::show_source_content () } m_pad_requested_width = required_pad_width; + tui_debug_printf ("requested width %d, allocated width %d", + required_pad_width, getmaxx (m_pad.get ())); } gdb_assert (m_pad != nullptr); @@ -431,6 +443,8 @@ tui_source_window_base::update_tab_width () void tui_source_window_base::rerender () { + TUI_SCOPED_DEBUG_START_END ("window `%s`", name ()); + if (!m_content.empty ()) { struct symtab_and_line cursal @@ -492,6 +506,8 @@ tui_source_window_base::refill () bool tui_source_window_base::validate_scroll_offsets () { + TUI_SCOPED_DEBUG_START_END ("window `%s`", name ()); + int original_pad_offset = m_pad_offset; if (m_horizontal_offset < 0) @@ -501,6 +517,11 @@ tui_source_window_base::validate_scroll_offsets () int pad_width = getmaxx (m_pad.get ()); int view_width = this->view_width (); + tui_debug_printf ("pad_width = %d, view_width = %d, content_width = %d", + pad_width, view_width, content_width); + tui_debug_printf ("original_pad_offset = %d, m_horizontal_offset = %d", + original_pad_offset, m_horizontal_offset); + if (m_horizontal_offset + view_width > content_width) m_horizontal_offset = std::max (content_width - view_width, 0); diff --git a/gdb/tui/tui.h b/gdb/tui/tui.h index a9ecd589a70..ca30e7cc65e 100644 --- a/gdb/tui/tui.h +++ b/gdb/tui/tui.h @@ -36,6 +36,9 @@ extern bool debug_tui; #define TUI_SCOPED_DEBUG_ENTER_EXIT \ scoped_debug_enter_exit (debug_tui, "tui") +#define TUI_SCOPED_DEBUG_START_END(fmt, ...) \ + scoped_debug_start_end (debug_tui, "tui", fmt, ##__VA_ARGS__) + struct ui_file; /* Types of error returns. */