This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 6/7] gdb: Add an error when 'list -' reaches the start of a file.
- From: Pedro Alves <palves at redhat dot com>
- To: Andrew Burgess <andrew dot burgess at embecosm dot com>, gdb-patches at sourceware dot org
- Date: Thu, 26 Nov 2015 12:38:12 +0000
- Subject: Re: [PATCH 6/7] gdb: Add an error when 'list -' reaches the start of a file.
- Authentication-results: sourceware.org; auth=none
- References: <cover dot 1448411121 dot git dot andrew dot burgess at embecosm dot com> <3cbf859f648e8f9df42755149ecac45a17603eca dot 1448411122 dot git dot andrew dot burgess at embecosm dot com>
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