From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5968 invoked by alias); 24 Feb 2010 15:02:34 -0000 Received: (qmail 5217 invoked by uid 22791); 24 Feb 2010 15:02:23 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 24 Feb 2010 15:02:13 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.3/8.14.3) with ESMTP id o1OF24JK001077; Wed, 24 Feb 2010 16:02:04 +0100 (CET) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.3/8.14.3/Submit) id o1OF20xb006484; Wed, 24 Feb 2010 16:02:00 +0100 (CET) Date: Wed, 24 Feb 2010 15:02:00 -0000 Message-Id: <201002241502.o1OF20xb006484@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: davem@davemloft.net CC: gdb-patches@sourceware.org In-reply-to: <20100224.064923.50041816.davem@davemloft.net> (message from David Miller on Wed, 24 Feb 2010 06:49:23 -0800 (PST)) Subject: Re: [PATCH]: Add sparc catch syscall support. References: <20100224.064923.50041816.davem@davemloft.net> 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: 2010-02/txt/msg00593.txt.bz2 > Date: Wed, 24 Feb 2010 06:49:23 -0800 (PST) > From: David Miller > > Ok to commit? Looks reasonable to me. > 2010-02-24 David S. Miller > > * gdb_ptrace.h (PT_SYSCALL): If PTRACE_SYSCALL is available, use it. > * syscalls/sparc-linux.xml: New. > * syscalls/sparc64-linux.xml: New. > * Makefile.in (XML_SYSCALL_FILES): Add new syscall XML files. > * sparc-linux-tdep.c (XML_SYSCALL_FILENAME_SPARC32): Define. > (sparc32_linux_get_syscall_number): New function. > (sparc32_linux_init_abi): Set syscall XML file name and hook up > syscall number fetcher. > * sparc64-linux-tdep.c (XML_SYSCALL_FILENAME_SPARC64): Define. > (sparc64_linux_get_syscall_number): New function. > (sparc64_linux_init_abi): Set syscall XML file name and hook up > syscall number fetcher. > --- > gdb/Makefile.in | 3 +- > gdb/gdb_ptrace.h | 6 +- > gdb/sparc-linux-tdep.c | 30 ++++ > gdb/sparc64-linux-tdep.c | 30 ++++ > gdb/syscalls/sparc-linux.xml | 344 ++++++++++++++++++++++++++++++++++++++++ > gdb/syscalls/sparc64-linux.xml | 326 +++++++++++++++++++++++++++++++++++++ > 6 files changed, 737 insertions(+), 2 deletions(-) > create mode 100644 gdb/syscalls/sparc-linux.xml > create mode 100644 gdb/syscalls/sparc64-linux.xml > > diff --git a/gdb/Makefile.in b/gdb/Makefile.in > index 98f42b9..8e68bb1 100644 > --- a/gdb/Makefile.in > +++ b/gdb/Makefile.in > @@ -845,7 +845,8 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \ > XML_SYSCALLS_DIR = syscalls/ > XML_SYSCALLS_FILES = gdb-syscalls.dtd \ > ppc-linux.xml ppc64-linux.xml \ > - i386-linux.xml amd64-linux.xml > + i386-linux.xml amd64-linux.xml \ > + sparc-linux.xml sparc64-linux.xml > > TSOBS = inflow.o > > diff --git a/gdb/gdb_ptrace.h b/gdb/gdb_ptrace.h > index 71b448f..8ee8c4e 100644 > --- a/gdb/gdb_ptrace.h > +++ b/gdb/gdb_ptrace.h > @@ -115,7 +115,11 @@ > and there is probably no special request that we would be required > to use when resuming the execution of our program. */ > #ifndef PT_SYSCALL > -# define PT_SYSCALL PT_CONTINUE > +# ifdef PTRACE_SYSCALL > +# define PT_SYSCALL PTRACE_SYSCALL > +#else > +# define PT_SYSCALL PT_CONTINUE > +# endif > #endif > > /* Some systems, in particular DEC OSF/1, Digital Unix, Compaq Tru64 > diff --git a/gdb/sparc-linux-tdep.c b/gdb/sparc-linux-tdep.c > index d65db6c..20644b4 100644 > --- a/gdb/sparc-linux-tdep.c > +++ b/gdb/sparc-linux-tdep.c > @@ -32,6 +32,10 @@ > #include "symtab.h" > #include "trad-frame.h" > #include "tramp-frame.h" > +#include "xml-syscall.h" > + > +/* The syscall's XML filename for sparc 32-bit. */ > +#define XML_SYSCALL_FILENAME_SPARC32 "syscalls/sparc-linux.xml" > > #include "sparc-tdep.h" > > @@ -241,6 +245,27 @@ sparc_linux_write_pc (struct regcache *regcache, CORE_ADDR pc) > regcache_cooked_write_unsigned (regcache, SPARC32_PSR_REGNUM, psr); > } > > +static LONGEST > +sparc32_linux_get_syscall_number (struct gdbarch *gdbarch, > + ptid_t ptid) > +{ > + struct regcache *regcache = get_thread_regcache (ptid); > + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); > + /* The content of a register. */ > + gdb_byte buf[4]; > + /* The result. */ > + LONGEST ret; > + > + /* Getting the system call number from the register. > + When dealing with the sparc architecture, this information > + is stored at the %g1 register. */ > + regcache_cooked_read (regcache, SPARC_G1_REGNUM, buf); > + > + ret = extract_signed_integer (buf, 4, byte_order); > + > + return ret; > +} > + > > > static void > @@ -279,6 +304,11 @@ sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) > dwarf2_append_unwinders (gdbarch); > > set_gdbarch_write_pc (gdbarch, sparc_linux_write_pc); > + > + /* Functions for 'catch syscall'. */ > + set_xml_syscall_file_name (XML_SYSCALL_FILENAME_SPARC32); > + set_gdbarch_get_syscall_number (gdbarch, > + sparc32_linux_get_syscall_number); > } > > /* Provide a prototype to silence -Wmissing-prototypes. */ > diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c > index 8b7e908..72bbb32 100644 > --- a/gdb/sparc64-linux-tdep.c > +++ b/gdb/sparc64-linux-tdep.c > @@ -31,6 +31,10 @@ > #include "symtab.h" > #include "trad-frame.h" > #include "tramp-frame.h" > +#include "xml-syscall.h" > + > +/* The syscall's XML filename for sparc 64-bit. */ > +#define XML_SYSCALL_FILENAME_SPARC64 "syscalls/sparc64-linux.xml" > > #include "sparc64-tdep.h" > > @@ -205,6 +209,27 @@ sparc64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc) > regcache_cooked_write_unsigned (regcache, SPARC64_STATE_REGNUM, state); > } > > +static LONGEST > +sparc64_linux_get_syscall_number (struct gdbarch *gdbarch, > + ptid_t ptid) > +{ > + struct regcache *regcache = get_thread_regcache (ptid); > + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); > + /* The content of a register. */ > + gdb_byte buf[8]; > + /* The result. */ > + LONGEST ret; > + > + /* Getting the system call number from the register. > + When dealing with the sparc architecture, this information > + is stored at the %g1 register. */ > + regcache_cooked_read (regcache, SPARC_G1_REGNUM, buf); > + > + ret = extract_signed_integer (buf, 8, byte_order); > + > + return ret; > +} > + > > > static void > @@ -244,6 +269,11 @@ sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) > tdep->step_trap = sparc64_linux_step_trap; > > set_gdbarch_write_pc (gdbarch, sparc64_linux_write_pc); > + > + /* Functions for 'catch syscall'. */ > + set_xml_syscall_file_name (XML_SYSCALL_FILENAME_SPARC64); > + set_gdbarch_get_syscall_number (gdbarch, > + sparc64_linux_get_syscall_number); > } > > > diff --git a/gdb/syscalls/sparc-linux.xml b/gdb/syscalls/sparc-linux.xml > new file mode 100644 > index 0000000..4e3bde0 > --- /dev/null > +++ b/gdb/syscalls/sparc-linux.xml > @@ -0,0 +1,344 @@ > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > diff --git a/gdb/syscalls/sparc64-linux.xml b/gdb/syscalls/sparc64-linux.xml > new file mode 100644 > index 0000000..b701883 > --- /dev/null > +++ b/gdb/syscalls/sparc64-linux.xml > @@ -0,0 +1,326 @@ > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > -- > 1.6.6.1 > >