From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22345 invoked by alias); 16 Dec 2015 16:05:19 -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 22333 invoked by uid 89); 16 Dec 2015 16:05:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: usplmg21.ericsson.net Received: from usplmg21.ericsson.net (HELO usplmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 16 Dec 2015 16:05:12 +0000 Received: from EUSAAHC002.ericsson.se (Unknown_Domain [147.117.188.78]) by usplmg21.ericsson.net (Symantec Mail Security) with SMTP id 37.18.32102.FAB81765; Wed, 16 Dec 2015 17:05:03 +0100 (CET) Received: from [142.133.110.95] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.80) with Microsoft SMTP Server id 14.3.248.2; Wed, 16 Dec 2015 11:05:09 -0500 Subject: Re: [PATCH v7 3/8] Use xml-syscall to compare syscall numbers in arm_linux_sigreturn_return-addr. To: Pedro Alves , Yao Qi References: <1449583641-18156-1-git-send-email-antoine.tremblay@ericsson.com> <1449583641-18156-4-git-send-email-antoine.tremblay@ericsson.com> <86io45ql3x.fsf@gmail.com> <566AC1AA.3030007@ericsson.com> <56718A56.8000304@redhat.com> CC: From: Antoine Tremblay Message-ID: <56718BB5.20508@ericsson.com> Date: Wed, 16 Dec 2015 16:05:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <56718A56.8000304@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-12/txt/msg00302.txt.bz2 On 12/16/2015 10:59 AM, Pedro Alves wrote: > On 12/11/2015 12:29 PM, Antoine Tremblay wrote: >> >> >> On 12/11/2015 06:29 AM, Yao Qi wrote: >>> Antoine Tremblay writes: >>> >>>> It also adds a new function to xml-syscall.h/c to compare syscalls numbers >>>> called is_syscall. >>> >>> Why don't we use existing get_syscall_by_name in >>> arm_linux_sigreturn_return_addr rather than adding a new function is_syscall? >>> >> >> This is because it complicated the code a lot just to compare a syscall >> I have to do what is in the is_syscall function. >> >> And I have to do that over and over... so might as well be in a function ? >> >> > > The issue is the having to handle the struct syscall instance, right? Right. > So instead of is_syscall, you could add a function that returns the > syscall number directly, like: > > int > get_syscall_number (struct gdbarch *gdbarch, > const char *syscall_name) > { > init_syscalls_info (gdbarch); > > return xml_get_syscall_number (gdbarch, syscall_name); > } > > and then users could use the more natural == comparison: > > /* Is this a sigreturn or rt_sigreturn syscall? */ > - if (svc_number == 119 || svc_number == 173) > + if (get_syscall_number (gdbarch, "sigreturn") == svc_number) > + || get_syscall_number (gdbarch, "rt_sigreturn") == svc_number)) > { > > and maybe other places could be simplified to use get_syscall_number > for other purposes than direct comparison. I like the idea. I'll redo it like that. Thanks, Antoine