This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v7 3/8] Use xml-syscall to compare syscall numbers in arm_linux_sigreturn_return-addr.
- From: Antoine Tremblay <antoine dot tremblay at ericsson dot com>
- To: Pedro Alves <palves at redhat dot com>, Yao Qi <qiyaoltc at gmail dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: 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.
- Authentication-results: sourceware.org; auth=none
- References: <1449583641-18156-1-git-send-email-antoine dot tremblay at ericsson dot com> <1449583641-18156-4-git-send-email-antoine dot tremblay at ericsson dot com> <86io45ql3x dot fsf at gmail dot com> <566AC1AA dot 3030007 at ericsson dot com> <56718A56 dot 8000304 at redhat dot com>
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 <antoine.tremblay@ericsson.com> 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