From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22221 invoked by alias); 18 Dec 2013 21:10:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 22208 invoked by uid 89); 18 Dec 2013 21:10:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f176.google.com Received: from mail-wi0-f176.google.com (HELO mail-wi0-f176.google.com) (209.85.212.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 18 Dec 2013 21:10:29 +0000 Received: by mail-wi0-f176.google.com with SMTP id hq4so5948755wib.9 for ; Wed, 18 Dec 2013 13:10:26 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.180.104.42 with SMTP id gb10mr9860645wib.51.1387401026644; Wed, 18 Dec 2013 13:10:26 -0800 (PST) Received: by 10.194.123.4 with HTTP; Wed, 18 Dec 2013 13:10:26 -0800 (PST) In-Reply-To: References: <52B02635.2090405@redhat.com> Date: Wed, 18 Dec 2013 21:10:00 -0000 Message-ID: Subject: Re: [PATCH] Improve and fix catch-syscall.exp From: Doug Evans To: Sergio Durigan Junior Cc: Pedro Alves , GDB Patches Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes X-SW-Source: 2013-12/txt/msg00725.txt.bz2 On Tue, Dec 17, 2013 at 9:35 AM, Sergio Durigan Junior 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 > > * gdb.base/catch-syscall.c: Include . > (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 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