This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

"next" into line longer than the source window-width (Re: [RFC 8.3 0/3] Some style fixes)


On 03/13/2019 03:44 PM, Eli Zaretskii wrote:
> I also found another regression in the TUI configuration: if you step
> with, say, "next" through the program, and execution winds up on a
> line that is longer than the source window-width, then the current
> line gets redrawn in reverse video, and as result it overwrites the
> window-frame and a portion of the next source line.  This happens
> because we only update one source line, and we do that in a way that
> doesn't take the window width and horizontal scrolling offset into
> account.
> 
> Here's the patch that fixes this regression:
> 
> --- gdb/tui/tui-winsource.c~5	2019-03-12 16:51:50.000000000 +0200
> +++ gdb/tui/tui-winsource.c	2019-03-13 08:21:02.303443600 +0200
> @@ -382,12 +387,30 @@ tui_set_is_exec_point_at (struct tui_lin
>          {
>            changed++;
>            content[i]->which_element.source.is_exec_point = new_state;
> -          tui_show_source_line (win_info, i + 1);
>          }
>        i++;
>      }
>    if (changed)
> -    tui_refresh_win (&win_info->generic);
> +    {
> +      struct gdbarch *gdbarch = win_info->detail.source_info.gdbarch;
> +      struct symtab *s = NULL;
> +
> +      if (win_info->generic.type == SRC_WIN)
> +	{
> +	  struct symtab_and_line cursal
> +	    = get_current_source_symtab_and_line ();
> +
> +	  if (cursal.symtab == NULL)
> +	    s = find_pc_line_symtab (get_frame_pc (get_selected_frame (NULL)));
> +	  else
> +	    s = cursal.symtab;
> +	}
> +      tui_update_source_window_as_is (win_info, gdbarch, s,
> +				      win_info->generic.content[0]
> +					->which_element.source.line_or_addr,
> +				      FALSE);
> +      tui_refresh_win (&win_info->generic);
> +    }

The substance of the patch LGTM.

But all this code above looks very much like the new tui_refill_source_window
function, added today by 6f11e6824e15.  I think you can replace all
the above with:

  -  tui_refresh_win (&win_info->generic);
  +  tui_refill_source_window (win_info);

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]