[PATCH 6/7] gdb: Add an error when 'list -' reaches the start of a file.
Pedro Alves
palves@redhat.com
Thu Nov 26 12:38:00 GMT 2015
On 11/25/2015 12:34 AM, Andrew Burgess wrote:
>
> diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
> index be84f81..5e7ef0a 100644
> --- a/gdb/cli/cli-cmds.c
> +++ b/gdb/cli/cli-cmds.c
> @@ -946,6 +946,9 @@ list_command (char *arg, int from_tty)
> listed. */
> if (arg[0] == '-')
> {
> + if (get_first_line_listed () == 1)
> + error ("Already at the start of %s.",
Wrap text in _().
> + symtab_to_filename_for_display (cursal.symtab));
> print_source_lines (cursal.symtab,
> max (get_first_line_listed ()
> - get_lines_to_list (), 1),
>
> diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp
> index 1b9d4e6..87878f6 100644
> --- a/gdb/testsuite/gdb.base/list.exp
> +++ b/gdb/testsuite/gdb.base/list.exp
> @@ -244,6 +244,10 @@ proc test_list_forward {} {
> }
>
> 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."
Lowercase first word and no period at end.
> + 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."
Ditto.
> +
> gdb_stop_suppressing_tests
> }
>
> @@ -324,6 +332,10 @@ proc test_list_backwards {} {
> }
>
> pass "$testcnt successive \"list -\" commands to page backwards"
> +
> + gdb_test "list -" "Already at the start of .*\." \
> + "Beginning of file error after \"list -\" command."
Ditto.
OK with those fixed.
Thanks,
Pedro Alves
More information about the Gdb-patches
mailing list