+2015-12-11 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * cli/cli-cmds.c (list_command): Add an error when trying to use
+ '-' to scan read off the start of the source file.
+
2015-12-11 Andrew Burgess <andrew.burgess@embecosm.com>
* cli/cli-cmds.c (list_command): Check that the argument string is
/* "l -" lists previous ten lines, the ones before the ten just
listed. */
else if (arg[0] == '-')
- print_source_lines (cursal.symtab,
- max (get_first_line_listed ()
- - get_lines_to_list (), 1),
- get_first_line_listed (), 0);
+ {
+ if (get_first_line_listed () == 1)
+ error (_("Already at the start of %s."),
+ symtab_to_filename_for_display (cursal.symtab));
+ print_source_lines (cursal.symtab,
+ max (get_first_line_listed ()
+ - get_lines_to_list (), 1),
+ get_first_line_listed (), 0);
+ }
return;
}
+2015-12-11 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * gdb.base/list.exp (test_list_forward): Add end of file error
+ test.
+ (test_repeat_list_command): Add end of file error test.
+ (test_list_backwards): Add beginning of file error test.
+
2015-12-11 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb.base/list.exp (test_list_invalid_args): New function,
}
pass "successive list commands to page forward ($testcnt tests)"
+
+ gdb_test "list" "Line number 44 out of range; \[^\r\n\]+ has 43 lines\." \
+ "end of file error after \"list\" command"
+
gdb_stop_suppressing_tests
}
}
pass "repeat list commands to page forward using 'return' ($testcnt tests)"
+
+ gdb_test "list" "Line number 44 out of range; \[^\r\n\]+ has 43 lines\." \
+ "end of file error after using 'return' to repeat the list command"
+
gdb_stop_suppressing_tests
}
}
pass "$testcnt successive \"list -\" commands to page backwards"
+
+ gdb_test "list -" "Already at the start of .*\." \
+ "beginning of file error after \"list -\" command"
+
gdb_stop_suppressing_tests
}