This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2] Fix first time you type UP or DOWN in TUI's command window (Re: [RFC 8.3 0/3] Some style fixes)
> Cc: gdb-patches@sourceware.org
> From: Pedro Alves <palves@redhat.com>
> Date: Fri, 15 Mar 2019 14:15:23 +0000
>
> Bingo.
>
> So I think this is the right fix:
>
> >From 781ed3b6d82a4fb54f7bfe59185f0e6e9efd6b59 Mon Sep 17 00:00:00 2001
> From: Pedro Alves <palves@redhat.com>
> Date: Fri, 15 Mar 2019 13:05:26 +0000
> Subject: [PATCH] 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:
Thanks, this sound right to me. Still, I'd welcome some comments in
the header which explain the semantics of non-positive values of these
members, and for m_start_of_line, also its role in general. Fixing
this bug could have been much easier if that information was
available to begin with.