From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90112 invoked by alias); 26 Sep 2017 09:33:23 -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 90068 invoked by uid 89); 26 Sep 2017 09:33:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=-19.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=adi, int=e2, D*Uni-Bielefeld.DE, rocebitecunibielefeldde?= X-HELO: smtp.CeBiTec.Uni-Bielefeld.DE Received: from smtp.CeBiTec.Uni-Bielefeld.DE (HELO smtp.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 26 Sep 2017 09:33:20 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 9B4D51A2; Tue, 26 Sep 2017 11:33:18 +0200 (CEST) Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id sJ0Aq+blQnRd; Tue, 26 Sep 2017 11:33:14 +0200 (CEST) Received: from lokon.CeBiTec.Uni-Bielefeld.DE (lokon.CeBiTec.Uni-Bielefeld.DE [129.70.161.152]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id C78A519E; Tue, 26 Sep 2017 11:33:14 +0200 (CEST) Received: (from ro@localhost) by lokon.CeBiTec.Uni-Bielefeld.DE (8.15.2+Sun/8.15.2/Submit) id v8Q9XEWF022415; Tue, 26 Sep 2017 11:33:14 +0200 (MEST) From: Rainer Orth To: gdb-patches@sourceware.org Cc: Weimin Pan Subject: Fix gdb 8.1 Solaris/SPARC compilation (PR build/22206) Date: Tue, 26 Sep 2017 09:33:00 -0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (usg-unix-v) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-SW-Source: 2017-09/txt/msg00787.txt.bz2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 4701 When testing my Solaris < 10 removal patch on Solaris/SPARC, I found that gdb mainline is currently broken there due to the recent SPARC M7 ADI patches: /vol/src/gnu/gdb/gdb/local/gdb/sparc64-tdep.c:1876:0: error: "PSR_ICC" rede= fined [-Werror] #define PSR_ICC 0x00f00000 ^ In file included from /usr/include/v7/sys/privregs.h:24:0, from /usr/include/sys/regset.h:420, from /usr/include/sys/ucontext.h:21, from /usr/include/sys/signal.h:231, from /usr/include/sys/procset.h:23, from /usr/include/sys/wait.h:25, from /usr/include/stdlib.h:21, from build-gnulib/import/stdlib.h:36, from /vol/src/gnu/gdb/gdb/local/gdb/common/common-defs.h:5= 3, from /vol/src/gnu/gdb/gdb/local/gdb/defs.h:28, from /vol/src/gnu/gdb/gdb/local/gdb/sparc64-tdep.c:20: /usr/include/v7/sys/psr.h:35:0: note: this is the location of the previous = definition #define PSR_ICC 0x00F00000 /* integer condition codes */ ^ /vol/src/gnu/gdb/gdb/local/gdb/sparc64-tdep.c:1878:0: error: "PSR_IMPL" red= efined [-Werror] #define PSR_IMPL 0xf0000000 ^ In file included from /usr/include/v7/sys/privregs.h:24:0, from /usr/include/sys/regset.h:420, from /usr/include/sys/ucontext.h:21, from /usr/include/sys/signal.h:231, from /usr/include/sys/procset.h:23, from /usr/include/sys/wait.h:25, from /usr/include/stdlib.h:21, from build-gnulib/import/stdlib.h:36, from /vol/src/gnu/gdb/gdb/local/gdb/common/common-defs.h:5= 3, from /vol/src/gnu/gdb/gdb/local/gdb/defs.h:28, from /vol/src/gnu/gdb/gdb/local/gdb/sparc64-tdep.c:20: /usr/include/v7/sys/psr.h:41:0: note: this is the location of the previous = definition #define PSR_IMPL 0xF0000000 /* implementation */ ^ Comparing Solaris 11.4 and sparc64-tdep.c, there are more inconsistencies: : #define PSR_S 0x00000080 /* supervisor mode */ #define PSR_ICC 0x00F00000 /* integer condition codes */ #define PSR_VER 0x0F000000 /* mask version */ #define PSR_IMPL 0xF0000000 /* implementation */ #define PSR_RSV 0x000FC000 /* reserved */ sparc64-tdep.c: #define PSR_S 0x00000080 #define PSR_ICC 0x00f00000 #define PSR_VERS 0x0f000000 #define PSR_IMPL 0xf0000000 #define PSR_V8PLUS 0xff000000 #define PSR_XCC 0x000f0000 Apart from the capitalization differences that trip g++, the names differ (PSR_VER vs. PSR_VERS), PSR_XCC is included in Solaris' PSR_RSV, and there's no PSR_V8PLUS on Solaris either. /vol/src/gnu/gdb/gdb/local/gdb/sparc64-tdep.c: In function =E2=80=98int adi= _tag_fd()=E2=80=99: /vol/src/gnu/gdb/gdb/local/gdb/sparc64-tdep.c:296:63: error: format =E2=80= =98%d=E2=80=99 expects argument of type =E2=80=98int=E2=80=99, but argument= 4 has type =E2=80=98pid_t {aka long int}=E2=80=99 [-Werror=3Dformat=3D] snprintf (cl_name, sizeof(cl_name), "/proc/%d/adi/tags", pid); ^ /vol/src/gnu/gdb/gdb/local/gdb/sparc64-tdep.c: In function =E2=80=98bool ad= i_is_addr_mapped(CORE_ADDR, std::size_t)=E2=80=99: /vol/src/gnu/gdb/gdb/local/gdb/sparc64-tdep.c:314:64: error: format =E2=80= =98%d=E2=80=99 expects argument of type =E2=80=98int=E2=80=99, but argument= 4 has type =E2=80=98pid_t {aka long int}=E2=80=99 [-Werror=3Dformat=3D] snprintf (filename, sizeof filename, "/proc/%d/adi/maps", pid); ^ You cannot always print a pid_t, which can be either int or long on Solaris, as an int. Obviously, the ADI patch which modifies code shared between all SPARC targets, hasn't been tested on anything but Linux/SPARC. The patch below includes the minimal fixes necessary to unbreak the Solaris/SPARC build. However, as detailed in the PR, there's more breakage here: apart from not bothering to implement ADI support on Solaris, the code contains several more changes to shared/common SPARC code that are simply wrong on anything but Linux/SPARC. The patch was tested on sparcv9-sun-solaris2.10 and sparcv9-sun-solaris2.11.4 (build and gdb/gdb gdb/gdb smoke test only). Ok for mainline? Rainer --=20 ---------------------------------------------------------------------------= -- Rainer Orth, Center for Biotechnology, Bielefeld University 2017-09-25 Rainer Orth PR build/22206 * sparc64-tdep.c (adi_tag_fd): Print pid as long. (adi_is_addr_mapped): Likewise. (PSR_ICC): Don't redefine. (PSR_IMPL): Likewise. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=sol2sparc-gdb81.patch Content-length: 1320 # HG changeset patch # Parent 5123ae285cd10f18efd6d5db4a75bc4989514ef1 Fix gdb 8.1 Solaris/SPARC compilation (PR build/22206) diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c --- a/gdb/sparc64-tdep.c +++ b/gdb/sparc64-tdep.c @@ -293,7 +293,7 @@ adi_tag_fd (void) return proc->stat.tag_fd; char cl_name[MAX_PROC_NAME_SIZE]; - snprintf (cl_name, sizeof(cl_name), "/proc/%d/adi/tags", pid); + snprintf (cl_name, sizeof(cl_name), "/proc/%ld/adi/tags", (long) pid); int target_errno; proc->stat.tag_fd = target_fileio_open (NULL, cl_name, O_RDWR|O_EXCL, 0, &target_errno); @@ -311,7 +311,7 @@ adi_is_addr_mapped (CORE_ADDR vaddr, siz size_t i = 0; pid_t pid = ptid_get_pid (inferior_ptid); - snprintf (filename, sizeof filename, "/proc/%d/adi/maps", pid); + snprintf (filename, sizeof filename, "/proc/%ld/adi/maps", (long) pid); char *data = target_fileio_read_stralloc (NULL, filename); if (data) { @@ -1873,9 +1873,13 @@ sparc64_init_abi (struct gdbarch_info in #define TSTATE_XCC 0x000000f000000000ULL #define PSR_S 0x00000080 +#ifndef PSR_ICC #define PSR_ICC 0x00f00000 +#endif #define PSR_VERS 0x0f000000 +#ifndef PSR_IMPL #define PSR_IMPL 0xf0000000 +#endif #define PSR_V8PLUS 0xff000000 #define PSR_XCC 0x000f0000 --=-=-=--