From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22601 invoked by alias); 2 Aug 2013 06:56:46 -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 22587 invoked by uid 89); 2 Aug 2013 06:56:46 -0000 X-Spam-SWARE-Status: No, score=-4.2 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_MED,RCVD_IN_HOSTKARMA_W,RDNS_NONE,SPF_PASS autolearn=ham version=3.3.1 Received: from Unknown (HELO e28smtp04.in.ibm.com) (122.248.162.4) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 02 Aug 2013 06:56:44 +0000 Received: from /spool/local by e28smtp04.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 2 Aug 2013 12:19:12 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp04.in.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 2 Aug 2013 12:19:10 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id D57001258054 for ; Fri, 2 Aug 2013 12:26:04 +0530 (IST) Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r726vbNd11075734 for ; Fri, 2 Aug 2013 12:27:37 +0530 Received: from d28av04.in.ibm.com (loopback [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r726uWBU027154 for ; Fri, 2 Aug 2013 16:56:32 +1000 Received: from d23ml188.in.ibm.com (d23ml188.in.ibm.com [9.182.8.144]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r726uWX1027146; Fri, 2 Aug 2013 16:56:32 +1000 In-Reply-To: <201308011325.r71DPfva000959@glazunov.sibelius.xs4all.nl> References: <201308011325.r71DPfva000959@glazunov.sibelius.xs4all.nl> Subject: Re: [PATCH 4/5] powerpc64-aix ptrace64 when defined. X-KeepSent: 21D042FF:CF4E8435-65257BBB:0024F10A; type=4; name=$KeepSent To: Mark Kettenis Cc: gdb-patches@sourceware.org, tromey@redhat.com Message-ID: From: Raunaq 12 Date: Fri, 02 Aug 2013 06:56:00 -0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13080206-5564-0000-0000-00000914F557 X-SW-Source: 2013-08/txt/msg00062.txt.bz2 > > When GDB is compiled in 64 BIT mode ptrace and ptracex calls are not > > defined on AIX. > > So, instead we check if ptrace64 is defined, if it is then we call that > > instead of ptrace/x. > > > > Kindly review this. Thanks. > > I'm basically happy with the gdb_ptrace.h bit. You could apply some > of the advice about avoiding unecessary casts to rs600-nat.c and > aix-thread.c, but I don't really care about the code in there. Thanks Mark. Yes, will look into removing those casts in aix-thread.c and rs6000-nat.c once I get some kind of feedback for the code in there. > > * gdb_ptrace.h: Add macro to define ptrace64 if HAVE_PTRACE64 defined > > * gdb_ptrace.h: Use ptrace64 instead of ptrace if HAVE_PTRACE64 is defined. > > > * rs6000-nat.c: Check for __ld_info64_ if compiling 64 BIT gdb. > > (rs6000_ptrace32): Call ptrace64 instead of ptrace if present. > > (rs6000_ptrace64): Call ptace64 instead of ptracex if present. > > *configure.ac: Add function check for ptrace64 > > * configure.ac: Check for ptrace64. > > > *config.in: initialize HAVE_PTRACE64 which will be set by configure > > * configure, config.in: Regenerate. > > +# define ptrace(request, pid, addr, data) \ > > + ptrace(request, pid, addr, data, 0) > > Needs a space between on the last line between 'ptrace' and '(' (but > not on the line before that. Including all the changes suggested, here is the final changelog and patch :- --- ChangeLog :- * gdb_ptrace.h: Use ptrace64 instead of ptrace if HAVE_PTRACE64 is defined. * rs6000-nat.c: Check for __ld_info64_ if compiling 64 BIT gdb. (rs6000_ptrace32): Call ptrace64 instead of ptrace if present. (rs6000_ptrace64): Call ptace64 instead of ptracex if present. * configure.ac: Check for ptrace64. * configure, config.in: Regenerate. --- Index: ./gdb/gdb_ptrace.h =================================================================== --- ./gdb.orig/gdb_ptrace.h +++ ./gdb/gdb_ptrace.h @@ -135,7 +135,15 @@ zero. */ #ifdef PTRACE_TYPE_ARG5 -# define ptrace(request, pid, addr, data) ptrace (request, pid, addr, data, 0) +# ifdef HAVE_PTRACE64 +# define ptrace(request, pid, addr, data) \ + ptrace64 (request, pid, addr, data, 0) +# undef PTRACE_TYPE_ARG3 +# define PTRACE_TYPE_ARG3 long long +# else +# define ptrace(request, pid, addr, data) \ + ptrace (request, pid, addr, data, 0) +# endif #endif #endif /* gdb_ptrace.h */ Index: ./gdb/rs6000-nat.c =================================================================== --- ./gdb.orig/rs6000-nat.c +++ ./gdb/rs6000-nat.c @@ -66,7 +66,7 @@ /* In 32-bit compilation mode (which is the only mode from which ptrace() works on 4.3), __ld_info32 is #defined as equivalent to ld_info. */ -#ifdef __ld_info32 +#if defined (__ld_info32) || defined (__ld_info64) # define ARCH3264 #endif @@ -132,7 +132,11 @@ static int rs6000_ptrace32 (int req, int id, int *addr, int data, int *buf) { + #ifdef HAVE_PTRACE64 + int ret = ptrace64 (req, (long long) id, (long long) addr, data, buf); + #else int ret = ptrace (req, id, (int *)addr, data, buf); + #endif #if 0 printf ("rs6000_ptrace32 (%d, %d, 0x%x, %08x, 0x%x) = 0x%x\n", req, id, (unsigned int)addr, data, (unsigned int)buf, ret); @@ -146,7 +150,11 @@ rs6000_ptrace64 (int req, int id, long long addr, int data, void *buf) { #ifdef ARCH3264 + #ifdef HAVE_PTRACE64 + int ret = ptrace64 (req, (long long) id, addr, data, (int *)buf); + #else int ret = ptracex (req, id, addr, data, buf); + #endif #else int ret = 0; #endif Index: ./gdb/configure.ac =================================================================== --- ./gdb.orig/configure.ac +++ ./gdb/configure.ac @@ -1180,7 +1180,7 @@ sigaction sigprocmask sigsetmask socketpair syscall \ ttrace wborder wresize setlocale iconvlist libiconvlist btowc \ setrlimit getrlimit posix_madvise waitpid lstat \ - fdwalk pipe2]) + fdwalk pipe2 ptrace64]) AM_LANGINFO_CODESET # Check the return and argument types of ptrace. No canned test for Index: ./gdb/config.in =================================================================== --- ./gdb.orig/config.in +++ ./gdb/config.in @@ -101,6 +101,9 @@ */ #undef HAVE_DECL_MALLOC +/* Define to 1 if you have the `ptrace64' function. */ +#undef HAVE_PTRACE64 + /* Define to 1 if you have the declaration of `ptrace', and to 0 if you don't. */ #undef HAVE_DECL_PTRACE