This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/4] 'catch syscall' feature -- Architecture-dependent part
- From: Tom Tromey <tromey at redhat dot com>
- To: SÃrgio Durigan JÃnior <sergiodj at linux dot vnet dot ibm dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 04 Nov 2008 09:15:58 -0700
- Subject: Re: [PATCH 2/4] 'catch syscall' feature -- Architecture-dependent part
- References: <1225773084.24532.54.camel@miki>
- Reply-to: tromey at redhat dot com
>>>>> "SÃrgio" == SÃrgio Durigan JÃnior <sergiodj@linux.vnet.ibm.com> writes:
SÃrgio> * i386-linux-tdep.c: Define the syscall's XML struct to hold
SÃrgio> information about syscalls.
SÃrgio> (init_sysinfo): New.
There is some code duplication between this and ppc-linux-tdep.c.
It seems to me that much of the Linux code will be shared by all
ports. So, I think the duplicated stuff should go in linux-nat.c.
SÃrgio> (i386_linux_get_syscall_number): New.
SÃrgio> (i386_linux_syscall_name_from_number): New.
SÃrgio> (i386_linux_syscall_number_from_name): New.
SÃrgio> (i386_linux_get_syscalls_names): New.
In the current patch, these could all be static. Aside from
i386_linux_get_syscall_number, perhaps they ought to be shared in
linux-nat.c though. The same applies for the equivalent PPC functions.
SÃrgio> +/* Return the current system call's number present in the
SÃrgio> + r0 register. When the function fails, it returns -1. */
SÃrgio> +LONGEST
SÃrgio> +ppc_linux_get_syscall_number (struct gdbarch *gdbarch,
SÃrgio> + ptid_t ptid)
SÃrgio> +{
[...]
SÃrgio> + buf = (gdb_byte *) xmalloc (tdep->wordsize * sizeof (gdb_byte));
I suspect you need a cleanup here, rather than an explicit xfree. I
am not sure. If regcache_cooked_read can call error, then you need
one.
Tom