This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Fix first time you type UP or DOWN in TUI's command window
- From: Pedro Alves <palves at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 18 Mar 2019 18:56:57 -0000
- Subject: [binutils-gdb] Fix first time you type UP or DOWN in TUI's command window
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5371b8502ab414aea510f65ce1acb9f090bf0340
commit 5371b8502ab414aea510f65ce1acb9f090bf0340
Author: Pedro Alves <palves@redhat.com>
Date: Mon Mar 18 18:32:42 2019 +0000
Fix first time you type UP or DOWN in TUI's command window
The first time you type UP or DOWN arrow in the command window, GDB
should scroll the source window, but instead it displays the line
number and the file name in the command window(?).
What happens there is that the first time we call
tui_ui_out::do_field_int, it doesn't initialize m_line, because
m_start_of_line is -1, as set by the constructor; and then the
following call to tui_ui_out::do_field_string falls back to
cli_ui_out::do_field_string because m_line is zero.
The problem is caused by a typo in the C++ification of tui_ui_out,
commit 112e8700a6f, where m_line and m_start_of_line's initial values
were swapped from what they used to be:
-struct ui_out *
-tui_out_new (struct ui_file *stream)
+tui_ui_out::tui_ui_out (ui_file *stream)
+: cli_ui_out (stream, 0),
+ m_line (0),
+ m_start_of_line (-1)
{
-
- /* Initialize our fields. */
- data->line = -1;
- data->start_of_line = 0;
This commit fixes it.
gdb/ChangeLog:
2019-03-18 Pedro Alves <palves@redhat.com>
Eli Zaretskii <eliz@gnu.org>
* tui/tui-out.c (tui_ui_out::tui_ui_out): Fix initialization of
m_line and m_start_of_line.
Diff:
---
gdb/ChangeLog | 6 ++++++
gdb/tui/tui-out.c | 4 ++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5599f5b..79376db 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2019-03-18 Pedro Alves <palves@redhat.com>
+ Eli Zaretskii <eliz@gnu.org>
+
+ * tui/tui-out.c (tui_ui_out::tui_ui_out): Fix initialization of
+ m_line and m_start_of_line.
+
2019-03-18 Eli Zaretskii <eliz@gnu.org>
* tui/tui-io.c (gdb_wgetch): Don't echo CR.
diff --git a/gdb/tui/tui-out.c b/gdb/tui/tui-out.c
index d5a173b..dd37736 100644
--- a/gdb/tui/tui-out.c
+++ b/gdb/tui/tui-out.c
@@ -109,8 +109,8 @@ tui_ui_out::do_text (const char *string)
tui_ui_out::tui_ui_out (ui_file *stream)
: cli_ui_out (stream, 0),
- m_line (0),
- m_start_of_line (-1)
+ m_line (-1),
+ m_start_of_line (0)
{
}