Fix search in TUI

Message ID 20191222140316.4044-1-ssbssa@yahoo.de
State New, archived
Headers

Commit Message

Terekhov, Mikhail via Gdb-patches Dec. 22, 2019, 2:03 p.m. UTC
  The variable last_line_listed is never set when print_source_lines_base is
called in TUI mode, so the search always started from the last line printed
outside of TUI mode.

gdb/ChangeLog:

2019-12-22  Hannes Domani  <ssbssa@yahoo.de>

	* source.c (print_source_lines_base): Set last_line_listed.
---
 gdb/source.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Tom Tromey Jan. 6, 2020, 4:10 p.m. UTC | #1
>>>>> "Hannes" == Hannes Domani via gdb-patches <gdb-patches@sourceware.org> writes:

Hannes> The variable last_line_listed is never set when print_source_lines_base is
Hannes> called in TUI mode, so the search always started from the last line printed
Hannes> outside of TUI mode.

Hannes> gdb/ChangeLog:

Hannes> 2019-12-22  Hannes Domani  <ssbssa@yahoo.de>

Hannes> 	* source.c (print_source_lines_base): Set last_line_listed.

Thanks, this is ok.

Tom
  
Terekhov, Mikhail via Gdb-patches Jan. 6, 2020, 4:18 p.m. UTC | #2
Am Montag, 6. Januar 2020, 17:10:42 MEZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:

> >>>>> "Hannes" == Hannes Domani via gdb-patches <gdb-patches@sourceware.org> writes:
>
> Hannes> The variable last_line_listed is never set when print_source_lines_base is
> Hannes> called in TUI mode, so the search always started from the last line printed
> Hannes> outside of TUI mode.
>
> Hannes> gdb/ChangeLog:
>
> Hannes> 2019-12-22  Hannes Domani  <ssbssa@yahoo.de>
>
> Hannes>     * source.c (print_source_lines_base): Set last_line_listed.
>
> Thanks, this is ok.

Pushed, thanks.
  

Patch

diff --git a/gdb/source.c b/gdb/source.c
index f5cd2a37e4..a6726f14c4 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1232,6 +1232,7 @@  print_source_lines_base (struct symtab *s, int line, int stopline,
 
   loc->set (s, line);
   first_line_listed = line;
+  last_line_listed = line;
 
   /* If printing of source lines is disabled, just print file and line
      number.  */