This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Improve and fix catch-syscall.exp
- From: Doug Evans <xdje42 at gmail dot com>
- To: Sergio Durigan Junior <sergiodj at redhat dot com>
- Cc: Pedro Alves <palves at redhat dot com>, GDB Patches <gdb-patches at sourceware dot org>
- Date: Wed, 18 Dec 2013 13:10:26 -0800
- Subject: Re: [PATCH] Improve and fix catch-syscall.exp
- Authentication-results: sourceware.org; auth=none
- References: <m37gb85p2o dot fsf at redhat dot com> <m3a9g27yr8 dot fsf at sspiff dot org> <m38uvkxuiy dot fsf at redhat dot com> <52B02635 dot 2090405 at redhat dot com> <m338lrwfbm dot fsf at redhat dot com>
On Tue, Dec 17, 2013 at 9:35 AM, Sergio Durigan Junior
<sergiodj@redhat.com> wrote:
> On Tuesday, December 17 2013, Pedro Alves wrote:
>
>> On 12/16/2013 11:09 PM, Sergio Durigan Junior wrote:
>>> + set close_syscall [get_integer_valueof "close_syscall" 0]
>>> + set chroot_syscall [get_integer_valueof "chroot_syscall" 0]
>>> + set all_syscalls_numbers [list $close_syscall $chroot_syscall]
>>> + set last_syscall_number [get_integer_valueof "exit_group_syscall" 0]
>>
>> Minor nit:
>>
>> As we saw in the other patch, using 0 for invalid syscall
>> number isn't a good idea. It shouldn't really matter much in
>> practice but for code clarity I suggest defaulting to -1 instead.
>
> Thanks, fixed.
>
> I also modified catch-syscall.c to use SYS_bla instead of __NR_bla,
> according to Doug's suggestion on IRC.
>
> I believe Pedro already gave an approval. Doug, are you OK with this
> version?
>
> --
> Sergio
>
> 2013-12-17 Sergio Durigan Junior <sergiodj@redhat.com>
>
> * gdb.base/catch-syscall.c: Include <sys/syscall.h>.
> (close_syscall, chroot_syscall, exit_group_syscall): New
> variables.
> * gdb.base/catch-syscall.exp: Replace gdb_compile by
> prepare_for_testing. Call fill_all_syscalls_numbers before
> starting. Replace gdb_exit, gdb_start, gdb_reinitialize_dir and
> gdb_load by clean_restart.
> (check_info_bp_any_syscall, check_info_bp_specific_syscall)
> (check_info_bp_many_syscalls): Remove global gdb_prompt.
> (check_call_to_syscall): Likewise. Add global decimal. Improve
> testing regex.
> (check_return_from_syscall): Likewise.
> (check_continue, insert_catch_syscall_with_arg): Remove global
> gdb_prompt.
> (insert_catch_syscall_with_many_args): Likewise. Add global
> decimal. Fix $filter_str. Improve testing regex.
> (check_for_program_end): Remove global gdb_prompt.
> (test_catch_syscall_without_args): Likewise. Add global decimal.
> Improve testing regex.
> (test_catch_syscall_with_args, test_catch_syscall_with_many_args)
> (test_catch_syscall_with_wrong_args)
> (test_catch_syscall_restarting_inferior)
> (test_catch_syscall_fail_nodatadir): Remove global gdb_prompt.
> (do_syscall_tests): Likewise. Remove global srcdir.
> (test_catch_syscall_without_args_noxml): Remove global gdb_prompt.
> Add global last_syscall_number. Test for the exact syscall number
> to be caught.
> (test_catch_syscall_with_args_noxml): Remove global gdb_prompt.
> Add global all_syscalls_numbers. Test each syscall number to be
> caught, instead of only testing "close".
> (test_catch_syscall_with_wrong_args_noxml): Remove global gdb_prompt.
> (do_syscall_tests_without_xml): Likewise. Remove global srcdir.
> Remove stale comment.
> (fill_all_syscalls_numbers): Add global last_syscall_number. Fill
> the correct syscall numbers using information from the inferior.
Two nits. Ok with the changes below.
> @@ -428,47 +391,35 @@ proc do_syscall_tests_without_xml {} {
>
> # This procedure fills the vector "all_syscalls_numbers" with the proper
> # numbers for the used syscalls according to the architecture.
> +#
> +# These numbers were taken from the respective <asm/unistd.h> files
> +# from each architecture.
This comment can go (no longer needed).
>
> -gdb_exit
> -set do_xml_test ![gdb_skip_xml_test]
> -gdb_start
> -gdb_reinitialize_dir $srcdir/$subdir
> -gdb_load ${binfile}
> +# Filling all the syscalls numbers before starting anything.
s/Filling/Fill/
> +fill_all_syscalls_numbers