[gdb/tui] Don't show line number for lines not in source file
authorTom de Vries <tdevries@suse.de>
Tue, 16 May 2023 15:40:32 +0000 (17:40 +0200)
committerTom de Vries <tdevries@suse.de>
Tue, 16 May 2023 15:40:32 +0000 (17:40 +0200)
commit68b25a74aa492fa84bc530b471036d762cf772bf
treee7697277818fbe8e475cc324f55afcd5b6fc5a77
parentd1792f72bf92ac06be7a4785567e2c7bf78c0496
[gdb/tui] Don't show line number for lines not in source file

Currently, for a source file containing only 5 lines, we also show line
numbers 6 and 7 if they're in scope of the source window:
...
    0 +-compact-source.c----------------+
    1 |___3_{                           |
    2 |___4_  return 0;                 |
    3 |___5_}                           |
    4 |___6_                            |
    5 |___7_                            |
    6 +---------------------------------+
...

Fix this by not showing line numbers not in a source file, such that we have instead:
...
    0 +-compact-source.c----------------+
    1 |___3_{                           |
    2 |___4_  return 0;                 |
    3 |___5_}                           |
    4 |                                 |
    5 |                                 |
    6 +---------------------------------+
...

Tested on x86_64-linux.

Suggested-By: Simon Marchi <simon.marchi@efficios.com>
Approved-By: Tom Tromey <tom@tromey.com>
gdb/testsuite/gdb.tui/compact-source.exp
gdb/testsuite/lib/tuiterm.exp
gdb/tui/tui-source.c