From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24308 invoked by alias); 23 Jul 2013 14:25:33 -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 24282 invoked by uid 89); 23 Jul 2013 14:25:32 -0000 X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RDNS_NONE autolearn=no version=3.3.1 Received: from Unknown (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 23 Jul 2013 14:25:30 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3) with ESMTP id r6NEPDMX028309; Tue, 23 Jul 2013 16:25:13 +0200 (CEST) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3/Submit) id r6NEPDxM001322; Tue, 23 Jul 2013 16:25:13 +0200 (CEST) Date: Tue, 23 Jul 2013 14:25:00 -0000 Message-Id: <201307231425.r6NEPDxM001322@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: raunaq12@in.ibm.com CC: gdb-patches@sourceware.org, tromey@redhat.com In-reply-to: (message from Raunaq 12 on Tue, 23 Jul 2013 18:26:01 +0530) Subject: Re: [PATCH 3/5] powerpc64-aix inf-ptrace patch References: <201307230901.r6N91Tfu005129@glazunov.sibelius.xs4all.nl> X-SW-Source: 2013-07/txt/msg00536.txt.bz2 > From: Raunaq 12 > Date: Tue, 23 Jul 2013 18:26:01 +0530 > > > No this will break other systems. Instead, make sure PTRACE_TYPE_ARG3 > > gets defined to the proper type of the 3rd argument of ptrace64 when > > you choose to use it. I'd expect that if you add the autoconf check I > > mentioned you could simply change the #ifdef PTRACE_TYPE_ARG5 in > > gdb_ptrace.h to something like: > > > > #ifdef PTRACE_TYPE_ARG5 > > # 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 > > The above suggestion of defining PTRACE_TYPE_ARG3 in gdb_ptrace.h works > very fine. Great! > I can add an autoconf check like - > > AC_CHECK_FUNCS(ptrace64) Just add it to the existing AC_CHECK_FUNCS() call in configure.ac. > and then in gdb_ptrace.h i can add - > > #ifdef PTRACE_TYPE_ARG5 > # if defined (__64BIT__) && defined (HAVE_PTRACE64) > # .... > > Note:- ptrace64 is defined in both 32 and 64 bit mode. But we need to use > ptrace64 only when we compile gdb in 64 BIT mode hence the __64BIT__ check. > Or I can also use the AC_CHECK_SIZEOF(long) to check if we are in 64 bit > mode. > > Which do you suggest? or, is there a better way of checking this ? Well, is there any downside to using ptrace64 in a 32-bit GDB. The AIX 6.1 online manual page for ptrace, ptracex, ptrace64 suggests that will work just fine. If that is indeed the case, I would simply not bother with the check and use ptrace64 whenever it is available.