aboutsummaryrefslogtreecommitdiff
path: root/gdb/source.c
diff options
context:
space:
mode:
authorStan Shebs <shebs@codesourcery.com>1999-09-09 00:02:17 +0000
committerStan Shebs <shebs@codesourcery.com>1999-09-09 00:02:17 +0000
commitd4f3574e777abfa65c9ba134e582228f3f32a8d6 (patch)
tree408b74c26833555087f04f4ec466afd488af6087 /gdb/source.c
parent325188ecac3a52d92d359c70f9b730470760e1d7 (diff)
downloadgdb-d4f3574e777abfa65c9ba134e582228f3f32a8d6.zip
gdb-d4f3574e777abfa65c9ba134e582228f3f32a8d6.tar.gz
gdb-d4f3574e777abfa65c9ba134e582228f3f32a8d6.tar.bz2
import gdb-1999-09-08 snapshot
Diffstat (limited to 'gdb/source.c')
-rw-r--r--gdb/source.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/gdb/source.c b/gdb/source.c
index 7982529..4293e59 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,