diff options
author | Stan Shebs <shebs@apple.com> | 1999-09-09 00:02:17 +0000 |
---|---|---|
committer | Stan Shebs <shebs@apple.com> | 1999-09-09 00:02:17 +0000 |
commit | 754acf44966696ce7bce75ec6d374dbd443970be (patch) | |
tree | a4806dbe8f3980165a4f389fcb2a7617aecb9bfa /gdb/source.c | |
parent | 88d27de31e77c81b718eb8d9aeb16b20814796d3 (diff) | |
download | gdb-754acf44966696ce7bce75ec6d374dbd443970be.tar.gz |
import gdb-1999-09-08 snapshot
Diffstat (limited to 'gdb/source.c')
-rw-r--r-- | gdb/source.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/gdb/source.c b/gdb/source.c index 79825291185..4293e59bc14 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1311,19 +1311,12 @@ list_command (arg, from_tty) error ("No default source file yet. Do \"help list\"."); else if (no_end) { - if (lines_to_list % 2 == 0) - print_source_lines (sal.symtab, - max (sal.line - (lines_to_list / 2), 1), - sal.line + (lines_to_list / 2), 0); - else - /* If lines_to_list is odd, then we round down in - * one of the lines_to_list/2 computations, round up in - * the other, so the total window size around the specified - * line comes out right. - */ - print_source_lines (sal.symtab, - max (sal.line - (lines_to_list / 2), 1), - sal.line + ((1 + lines_to_list) / 2), 0); + int first_line = sal.line - lines_to_list / 2; + + if (first_line < 1) first_line = 1; + + print_source_lines (sal.symtab, first_line, first_line + lines_to_list, + 0); } else print_source_lines (sal.symtab, sal.line, |