From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7556 invoked by alias); 15 Dec 2013 18:44:46 -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 7545 invoked by uid 89); 15 Dec 2013 18:44:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 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-wg0-f41.google.com Received: from mail-wg0-f41.google.com (HELO mail-wg0-f41.google.com) (74.125.82.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 15 Dec 2013 18:44:44 +0000 Received: by mail-wg0-f41.google.com with SMTP id y10so1176820wgg.0 for ; Sun, 15 Dec 2013 10:44:41 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.180.14.195 with SMTP id r3mr10213435wic.51.1387133080949; Sun, 15 Dec 2013 10:44:40 -0800 (PST) Received: by 10.194.123.4 with HTTP; Sun, 15 Dec 2013 10:44:40 -0800 (PST) In-Reply-To: References: Date: Sun, 15 Dec 2013 18:44:00 -0000 Message-ID: Subject: Re: [PATCH] Improve and fix catch-syscall.exp From: Doug Evans To: Sergio Durigan Junior Cc: GDB Patches Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes X-SW-Source: 2013-12/txt/msg00561.txt.bz2 On Sun, Dec 15, 2013 at 10:30 AM, Doug Evans wrote: > Sergio Durigan Junior writes: > >> Hi, >> >> While fixing another bug, I found that the current >> gdb.base/catch-syscall.exp is kind of messy, could use some >> improvements, and is not correctly testing some things. >> >> I've made the following patch to address all the issues I found. On the >> organization side, it does a cleanup and removes unecessary imports of >> gdb_prompt, uses prepare_for_testing and clean_restart where needed, and >> fixes some comments. The testcase was also not correctly testing >> catching syscalls using only numbers, or catching many syscalls at >> once. I fixed that. This is good because I will soon submit another >> patch to fix a bug on catch syscall which will make use of the new >> things I've added. >> >> I tested this on x86_64 Fedora 18, and I'm waiting for machines to test >> on PPC and ARM at least, but I checked the syscalls numbers on every >> architecture supported by the patch to make sure everything was OK. >> >> OK to apply? > > Hi. > > I was wondering, what if the magic numbers that are the syscall > numbers were recorded in the test .c file like: > > int close_syscall_number = foo; > > and then have the .exp fetch these values after running-to-main. > That would save having to record syscall numbers in the .exp, > and all the conditionals to test for the architecture. > > Not sure there isn't a flaw in this plan, > and I guess it's debatable whether it's better to just record > the numbers in the .exp or reference the __NR_* numbers from asm/unistd*.h > in the .c, but it sounds promising. Alternatively, gdb knows the numbers. IWBN to provide a way to print them, and then the .exp file could get the numbers from that. OTOH, one could just have the .exp do the catch and process the output to get the number. (gdb) catch syscall 6 Catchpoint 2 (syscall 'close' [6]) (gdb) catch syscall close Catchpoint 1 (syscall 'close' [6]) One might even check the .c __NR_ value with gdb's value computed from the .exp for extra paranoid testing, but I'm guessing there's insufficient benefit.