[binutils-gdb] gdb/tui: more debug output
Andrew Burgess
aburgess@sourceware.org
Fri Jan 27 16:25:38 GMT 2023
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2d46b103a52e4597ee60aa224ef4e5fb225ba893
commit 2d46b103a52e4597ee60aa224ef4e5fb225ba893
Author: Andrew Burgess <aburgess@redhat.com>
Date: Thu Jan 5 14:42:34 2023 +0000
gdb/tui: more debug output
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.
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 = 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. */
More information about the Gdb-cvs
mailing list