From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13287 invoked by alias); 8 Sep 2009 18:04:21 -0000 Received: (qmail 13095 invoked by uid 22791); 8 Sep 2009 18:04:19 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Sep 2009 18:04:11 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 958102BAB78; Tue, 8 Sep 2009 14:04:09 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id i34WDDM+2qdt; Tue, 8 Sep 2009 14:04:09 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 38BB82BAB69; Tue, 8 Sep 2009 14:04:09 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id D4DCDF589B; Tue, 8 Sep 2009 11:04:02 -0700 (PDT) Date: Tue, 08 Sep 2009 18:04:00 -0000 From: Joel Brobecker To: Michael Snyder Cc: "gdb-patches@sourceware.org" , Hui Zhu , Mark Kettenis Subject: Re: [RFA] cleanup of syscall consts in process record Message-ID: <20090908180402.GR30677@adacore.com> References: <4AA2D95B.4090904@vmware.com> <20090908164934.GP30677@adacore.com> <4AA696F6.6040503@vmware.com> <4AA69878.9060602@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4AA69878.9060602@vmware.com> User-Agent: Mutt/1.5.18 (2008-05-17) 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 X-SW-Source: 2009-09/txt/msg00209.txt.bz2 > 2009-09-08 Michael Snyder > > * amd64-linux-tdep.h (enum amd64_syscall): New enum consts, > to replace literal consts used in amd64-linux-tdep.c > * linux-record.h (enum gdb_syscall): New enum consts, to replace > literal consts used in amd64-linux-tdep.c and linux-record.c. > * amd64-linux-tdep.c (amd64_canonicalize_syscall): New function, > translate from native amd64 Linux syscall id to internal gdb id. > (amd64_linux_syscall_record): Switch statement abstracted out > and replaced with a call to amd64_canonicalize_syscall. > * linux-record.c (record_linux_system_call): Replace literal > consts with enum consts. > * i386-linux-tdep.c (i386_canonicalize_syscall): New function, > trivially translate from native i386 Linux syscalls to gdb syscalls. > (i386_linux_intx80_sysenter_record): Nice! I really like this version much better. The approach you took with i386 made me wonder whether we really need the amd64_syscall enum at all - we could have used a plain int as the argument to amd64_canonicalize_syscall, and use plain numbers there, rather than having an enum that's only used there. I don't mind, though, so don't worry about it unless you agree as well. Note that this should also fix the issue that Hui reported about building on cygwin with --enable-64-bit-bfd. So I'll remove Hui's patch from my list. Just one comment: > +static enum gdb_syscall > +i386_canonicalize_syscall (int syscall) > +{ > + enum { i386_syscall_max = 499 }; > + > + if (syscall <= i386_syscall_max) > + return syscall; I thought that we should incorporate Mark's suggestion of checking syscall against negative values. But I now realize that if syscall is negative, we'll return a value that's equivalent to returning -1. And the check against negative values in i386_linux_intx80_sysenter_record should then catch it. -- Joel