From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24781 invoked by alias); 22 Oct 2013 13:09:49 -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 24762 invoked by uid 89); 22 Oct 2013 13:09:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS,T_FRT_SLUT,UNPARSEABLE_RELAY,UNWANTED_LANGUAGE_BODY autolearn=ham version=3.3.2 X-HELO: userp1040.oracle.com Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 22 Oct 2013 13:09:46 +0000 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r9MD9igR013200 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 22 Oct 2013 13:09:45 GMT Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r9MD9hX1029629 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 22 Oct 2013 13:09:44 GMT Received: from abhmt114.oracle.com (abhmt114.oracle.com [141.146.116.66]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r9MD9hVB010893 for ; Tue, 22 Oct 2013 13:09:43 GMT Received: from termi.oracle.com (/10.175.6.116) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 22 Oct 2013 06:09:42 -0700 From: jose.marchesi@oracle.com (Jose E. Marchesi) To: gdb-patches@sourceware.org Subject: [PATCH] Support for the $_siginfo convenience var in sparc64 Date: Tue, 22 Oct 2013 13:09:00 -0000 Message-ID: <8761sptppx.fsf@oracle.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00681.txt.bz2 Hi. The following patch adds support for the $_siginfo convenience variable to sparc64-*-linux-gnu targets. 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 }