From patchwork Wed Jan 25 12:08:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 63668 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 9E1DD3858035 for ; Wed, 25 Jan 2023 12:10:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9E1DD3858035 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674648640; 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=aQdIUWoB4+cfyQaKPlfnSCUT3oqfIgmaJXZR13ifVFucS9Vm1hRA+xPIs46nNxJle 3RYPnCkZlxIcasaTQ5yFXJzqZoYaPzPu2swN+Qpt8RU8Tf5ZuGOqnxaQhH1cnHBsAm OLOteR8Ez7xPEvIgbRpaQAXxczIa1A2tg/nqsmVs= 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 51FA53858035 for ; Wed, 25 Jan 2023 12:09:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 51FA53858035 Received: from mail-vs1-f71.google.com (mail-vs1-f71.google.com [209.85.217.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-639-9llUNU-MO-OSFwa-ap8_4g-1; Wed, 25 Jan 2023 07:09:13 -0500 X-MC-Unique: 9llUNU-MO-OSFwa-ap8_4g-1 Received: by mail-vs1-f71.google.com with SMTP id m63-20020a677142000000b003ce30446ff5so4235434vsc.23 for ; Wed, 25 Jan 2023 04:09:13 -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=XHIk0cc/GcByJx96vu94vGRpRpehGkxRoMTzG6C63NqSHuhOxNzNk/cwDwjwo+WpiB LwAxPBoeEWjt2iCW4+UmkfR/SA83BEdeX2j1vxxgInkO403ATV0FNZDYpJRK36Vz2PSy lVdhnzFJ8tSQBwdiNFRvHPUx1XtZwDzIBnqzSkA0dgnqI0nqpx5Dj8Tj+oxaWvJ0pUKA Id1qxLeH/6fvRQ12YWy297tSCGfXRsqV/dLfo4rOPHeo6XMvXZo2XYhf1HlGc9jsd8NT 7VVMOEaco0GV6Ii+Z3KdDFarvOc6ccxsHkqZT2ViU4tN+3NUrR0rPuyqGWSgwhPA/Bkc GsWw== X-Gm-Message-State: AFqh2kq259VOHxYWCjucEl773hw7uWxahDO5rqNI/X4t78Znes6cjgjp 2F5zcyB+xXxYcuv3/Bhd5aMuiObJz7u8T3onzyo0THwor3dUbfIb9jRs2ZAK4+nPD4fFKOs3SAR 7gJzq2OAqA+DPrY/Nmh6OX/jhykATZsScLWy+5LGqTNUFwPnL9DiF8X8qujqo0KD5iDfaOu4IjQ == X-Received: by 2002:a1f:3d93:0:b0:3d3:1c0b:1b05 with SMTP id k141-20020a1f3d93000000b003d31c0b1b05mr18743577vka.16.1674648551774; Wed, 25 Jan 2023 04:09:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXsqXEFzqlf7E7If+zZPkOK8RSBxcGuDM31pS5RfLFaR5D4bMThvvEjTOUmKweuHjCtgaXqmBQ== X-Received: by 2002:a1f:3d93:0:b0:3d3:1c0b:1b05 with SMTP id k141-20020a1f3d93000000b003d31c0b1b05mr18743556vka.16.1674648551464; Wed, 25 Jan 2023 04:09:11 -0800 (PST) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id m18-20020ae9e012000000b00704c9015e68sm3308721qkk.116.2023.01.25.04.09.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 04:09:11 -0800 (PST) To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv2 8/8] gdb/tui: more debug output Date: Wed, 25 Jan 2023 12:08:48 +0000 Message-Id: <8135f317a3ce0341b89c864adc0dc38e85703424.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 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 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. */