From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id D47873858C2F; Fri, 27 Jan 2023 16:25:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D47873858C2F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674836738; bh=U4MixRJYgNyOdf105KbIjk2h9Ikzz2ySfS5ADN70Zls=; h=From:To:Subject:Date:From; b=Z3+tlDT4YSfNw8ZmmJGW1O8cTKGBmE7rBGNJpbn9GKCBwOnI/ZUEvnDPvlDGkHfb9 I7Js265phYPv7r8W+n7MiAX5QYhZhaVBBIbENRN6YjmRBoNR3AKp8Z/68eOgGCagJW PvXWLCe05WqMoOI7WanVgChU8hlqmVfgv9B9R4DQ= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/tui: more debug output X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: 99c15700fd47e59a14d6338fda7aeadf5ba480f3 X-Git-Newrev: 2d46b103a52e4597ee60aa224ef4e5fb225ba893 Message-Id: <20230127162538.D47873858C2F@sourceware.org> Date: Fri, 27 Jan 2023 16:25:38 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D2d46b103a52e= 4597ee60aa224ef4e5fb225ba893 commit 2d46b103a52e4597ee60aa224ef4e5fb225ba893 Author: Andrew Burgess Date: Thu Jan 5 14:42:34 2023 +0000 gdb/tui: more debug output =20 Add some additional debug output that I've found really useful while working on the previous set of patches. =20 Unless tui debug is turned on, then there should be no user visible changes with this commit. Diff: --- 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 =3D m_max_length; int pad_x =3D m_horizontal_offset - m_pad_offset; =20 + tui_debug_printf ("pad_width =3D %d, left_margin =3D %d, view_width =3D = %d", + pad_width, left_margin, view_width); + tui_debug_printf ("content_width =3D %d, pad_x =3D %d, m_horizontal_offs= et =3D %d", + content_width, pad_x, m_horizontal_offset); + tui_debug_printf ("m_pad_offset =3D %d", m_pad_offset); + gdb_assert (m_pad_offset >=3D 0); gdb_assert (m_horizontal_offset + view_width <=3D 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 ()); =20 /* 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 () } =20 m_pad_requested_width =3D required_pad_width; + tui_debug_printf ("requested width %d, allocated width %d", + required_pad_width, getmaxx (m_pad.get ())); } =20 gdb_assert (m_pad !=3D 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 =3D m_pad_offset; =20 if (m_horizontal_offset < 0) @@ -501,6 +517,11 @@ tui_source_window_base::validate_scroll_offsets () int pad_width =3D getmaxx (m_pad.get ()); int view_width =3D this->view_width (); =20 + tui_debug_printf ("pad_width =3D %d, view_width =3D %d, content_width = =3D %d", + pad_width, view_width, content_width); + tui_debug_printf ("original_pad_offset =3D %d, m_horizontal_offset =3D %= d", + original_pad_offset, m_horizontal_offset); + if (m_horizontal_offset + view_width > content_width) m_horizontal_offset =3D std::max (content_width - view_width, 0); =20 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") =20 +#define TUI_SCOPED_DEBUG_START_END(fmt, ...) \ + scoped_debug_start_end (debug_tui, "tui", fmt, ##__VA_ARGS__) + struct ui_file; =20 /* Types of error returns. */