From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2030 invoked by alias); 22 Oct 2013 13:21:15 -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 2015 invoked by uid 89); 22 Oct 2013 13:21:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,T_FRT_SLUT,UNWANTED_LANGUAGE_BODY autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 22 Oct 2013 13:21:13 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9MDLBO8029531 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 22 Oct 2013 09:21:11 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r9MDL9p9019443; Tue, 22 Oct 2013 09:21:10 -0400 Message-ID: <52667BC5.2050300@redhat.com> Date: Tue, 22 Oct 2013 13:21:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: "Jose E. Marchesi" CC: gdb-patches@sourceware.org Subject: Re: [PATCH] Support for the $_siginfo convenience var in sparc64 References: <8761sptppx.fsf@oracle.com> In-Reply-To: <8761sptppx.fsf@oracle.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-10/txt/msg00683.txt.bz2 On 10/22/2013 02:11 PM, Jose E. Marchesi wrote: > > Hi. > > The following patch adds support for the $_siginfo convenience variable > to sparc64-*-linux-gnu targets. I take it from the patch that linux-tdep.c:linux_get_siginfo_type wouldn't work for sparc64? Why is that? What's different? > It also makes the tests gdb.base/siginfo-thread.exp and > gdb.base/siginfo-obj.exp to run (and pass) on these targets. > > Tested on sparc64-unknown-linux-gnu. No visible regressions after > running the testsuite. > > 2013-10-22 Jose E. Marchesi > > * sparc64-linux-tdep.c (sparc64_linux_get_siginfo_type): New function. > (sparc64_linux_init_abi): Hook sparc_linux_get_siginfo_type to provide > gdbarch_get_siginfo_type. > > 2013-10-22 Jose E. Marchesi > > * gdb.base/siginfo-obj.exp: Extended signal info is now supported > in sparc64, so run the test in these targets. > * gdb.base/siginfo-thread.exp: Likewise. > > diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c > index 3f53f6c..1c4f647 100644 > --- a/gdb/sparc64-linux-tdep.c > +++ b/gdb/sparc64-linux-tdep.c > @@ -232,6 +232,121 @@ sparc64_linux_get_syscall_number (struct gdbarch *gdbarch, > return ret; > } > > +/* Implementation of gdbarch_get_siginfo_type as documented in > + gdbarch.h */ > + > +static struct type * > +sparc64_linux_get_siginfo_type (struct gdbarch *gdbarch) > +{ > + struct type *int_type, *uint_type, *long_type, *void_ptr_type; > + struct type *uid_type, *pid_type; > + struct type *sigval_type, *clock_type; > + struct type *siginfo_type, *sifields_type; > + struct type *type; > + > + int_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), > + 0, "int"); > + uint_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), > + 1, "unsigned int"); > + long_type = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), > + 0, "long"); > + void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void); > + > + /* sival_t */ > + sigval_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION); > + TYPE_NAME (sigval_type) = xstrdup ("sigval_t"); > + append_composite_type_field (sigval_type, "sival_int", int_type); > + append_composite_type_field (sigval_type, "sival_ptr", void_ptr_type); > + > + /* __pid_t */ > + pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, > + TYPE_LENGTH (int_type), "__pid_t"); > + TYPE_TARGET_TYPE (pid_type) = int_type; > + TYPE_TARGET_STUB (pid_type) = 1; > + > + /* __uid_t */ > + uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, > + TYPE_LENGTH (uint_type), "__uid_t"); > + TYPE_TARGET_TYPE (uid_type) = uint_type; > + TYPE_TARGET_STUB (uid_type) = 1; > + > + /* __clock_t */ > + clock_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, > + TYPE_LENGTH (long_type), "__clock_t"); > + TYPE_TARGET_TYPE (clock_type) = long_type; > + TYPE_TARGET_STUB (clock_type) = 1; > + > + /* _sifields */ > + sifields_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION); > + > + { > + const int si_max_size = 128; > + int si_pad_size; > + int size_of_int = gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT; > + > + /* _pad */ > + if (gdbarch_ptr_bit (gdbarch) == 64) > + si_pad_size = (si_max_size / size_of_int) - 4; > + else > + si_pad_size = (si_max_size / size_of_int) - 3; > + append_composite_type_field (sifields_type, "_pad", > + init_vector_type (int_type, si_pad_size)); > + } > + > + /* _kill */ > + type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); > + append_composite_type_field (type, "si_pid", pid_type); > + append_composite_type_field (type, "si_uid", uid_type); > + append_composite_type_field (sifields_type, "_kill", type); > + > + /* _timer */ > + type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); > + append_composite_type_field (type, "si_tid", int_type); > + append_composite_type_field (type, "si_overrun", int_type); > + append_composite_type_field (type, "si_sigval", sigval_type); > + append_composite_type_field (sifields_type, "_timer", type); > + > + /* _rt */ > + type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); > + append_composite_type_field (type, "si_pid", pid_type); > + append_composite_type_field (type, "si_uid", uid_type); > + append_composite_type_field (type, "si_sigval", sigval_type); > + append_composite_type_field (sifields_type, "_rt", type); > + > + /* _sigchld */ > + type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); > + append_composite_type_field (type, "si_pid", pid_type); > + append_composite_type_field (type, "si_uid", uid_type); > + append_composite_type_field (type, "si_status", int_type); > + append_composite_type_field (type, "si_utime", clock_type); > + append_composite_type_field (type, "si_stime", clock_type); > + append_composite_type_field (sifields_type, "_sigchld", type); > + > + /* _sigfault */ > + type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); > + append_composite_type_field (type, "si_addr", void_ptr_type); > + append_composite_type_field (type, "si_trapno", int_type); > + append_composite_type_field (sifields_type, "_sigfault", type); > + > + /* _sigpoll */ > + type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); > + append_composite_type_field (type, "si_band", int_type); > + append_composite_type_field (type, "si_fd", int_type); > + append_composite_type_field (sifields_type, "_sigpoll", type); > + > + /* struct siginfo */ > + siginfo_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); > + TYPE_NAME (siginfo_type) = xstrdup ("siginfo"); > + append_composite_type_field (siginfo_type, "si_signo", int_type); > + append_composite_type_field (siginfo_type, "si_errno", int_type); > + append_composite_type_field (siginfo_type, "si_code", int_type); > + append_composite_type_field_aligned (siginfo_type, > + "_sifields", sifields_type, > + TYPE_LENGTH (long_type)); > + > + return siginfo_type; > +} > + > > > static void > @@ -278,6 +393,9 @@ sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) > set_xml_syscall_file_name (XML_SYSCALL_FILENAME_SPARC64); > set_gdbarch_get_syscall_number (gdbarch, > sparc64_linux_get_syscall_number); > + > + set_gdbarch_get_siginfo_type (gdbarch, > + sparc64_linux_get_siginfo_type); > } > > > diff --git a/gdb/testsuite/gdb.base/siginfo-obj.exp b/gdb/testsuite/gdb.base/siginfo-obj.exp > index 6cee02e..5046892 100644 > --- a/gdb/testsuite/gdb.base/siginfo-obj.exp > +++ b/gdb/testsuite/gdb.base/siginfo-obj.exp > @@ -28,7 +28,8 @@ if [target_info exists gdb,nosignals] { > > if { ! [istarget "i?86-*-linux*"] > && ! [istarget "x86_64-*-linux*"] > - && ! [istarget "arm*-*-linux*"] } { > + && ! [istarget "arm*-*-linux*"] > + && ! [istarget "sparc64-*-linux*"] } { > verbose "Skipping siginfo-obj.exp because of lack of support." > return > } > diff --git a/gdb/testsuite/gdb.base/siginfo-thread.exp b/gdb/testsuite/gdb.base/siginfo-thread.exp > index a351802..541594b 100644 > --- a/gdb/testsuite/gdb.base/siginfo-thread.exp > +++ b/gdb/testsuite/gdb.base/siginfo-thread.exp > @@ -23,7 +23,8 @@ if [target_info exists gdb,nosignals] { > > if { ! [istarget "i?86-*-linux*"] > && ! [istarget "x86_64-*-linux*"] > - && ! [istarget "arm*-*-linux*"] } { > + && ! [istarget "arm*-*-linux*"] > + && ! [istarget "sparc64-*-linux*"] } { > verbose "Skipping siginfo-thread.exp because of lack of support." > return > } > -- Pedro Alves