From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12587 invoked by alias); 15 Jul 2013 09:12:17 -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 12562 invoked by uid 89); 15 Jul 2013 09:12:16 -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; Mon, 15 Jul 2013 09:12:15 +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 r6F9C0hQ004578; Mon, 15 Jul 2013 11:12:00 +0200 (CEST) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3/Submit) id r6F9Bx9F028368; Mon, 15 Jul 2013 11:11:59 +0200 (CEST) Date: Mon, 15 Jul 2013 09:12:00 -0000 Message-Id: <201307150911.r6F9Bx9F028368@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 Mon, 15 Jul 2013 13:00:35 +0530) Subject: Re: [PATCH 3/5] powerpc64-aix inf-ptrace patch References: <87r4f6fgst.fsf@fleche.redhat.com> <201307101907.r6AJ7AfX021641@glazunov.sibelius.xs4all.nl> X-SW-Source: 2013-07/txt/msg00342.txt.bz2 > From: Raunaq 12 > Date: Mon, 15 Jul 2013 13:00:35 +0530 > > Hi Mark/Tom, > > Thanks for the feedback. > > I removed the newly added file and instead used a wrapper function and > macros. > Kindly review the patch below and let me know if this should be okay ? Not quite. > ChangeLog :- > > * inf-ptrace.c: Add support for ptrace64 in 64 BIT mode > (inf_ptrace_follow_fork): Likewise > (inf_ptrace_me): Likewise > (inf_ptrace_post_startup_inferior): Likewise > (inf_ptrace_attach): Likewise > (inf_ptrace_post_attach): Likewise > (inf_ptrace_detach): Likewise > (inf_ptrace_kill): Likewise > (inf_ptrace_resume): Likewise > (inf_ptrace_wait): Likewise > (inf_ptrace_xfer_partial): Likewise > (inf_ptrace_fetch_register): Likewise > (inf_ptrace_store_register): Likewise > (inf_ptrace_fetch_register): Likewise > * rs6000-nat.c: Check for __ld_info64 if compiling 64 BIT gdb. > (rs6000_ptrace32): Added ptrace64 support for 64 bit mode. > (rs6000_ptrace64): Likewise. > * gdb_ptrace.h: Add macro for ptrace64 call. > --- > Index: ./gdb/inf-ptrace.c > =================================================================== > --- ./gdb/inf-ptrace.c > +++ ./gdb/inf-ptrace.c > @@ -36,6 +36,17 @@ > #include "gdbthread.h" > > ^L > +#ifdef BFD64 > +#define check_ptrace ptrace64 > +#define addr_ptr long long > +#define pid_type long long > +#define addr_uintptr_t long long > +#else > +#define check_ptrace ptrace > +#define addr_ptr PTRACE_TYPE_ARG3 > +#define pid_type int > +#define addr_uintptr_t uintptr_t > +#endif This is the wrong place to put this stuff. Take a look at gdb_ptrace.h; it already has code to deal with AIX. You just need to adjust that to use ptrace64 if available. Something like: #ifdef HAVE_TYPE_ARG5 # ifdef HAVE_PTRACE64 # define ptrace(request, pid, addr, data) \ ptrace64 (request, pid, addr, data, 0) # else # define ptrace(request, pid, addr, data) \ ptrace (request, pid, addr, data, 0) # endif #endif You can do any casting that's really necessary there. The (pid_type) casts are almost certainly not necessary. The existing (uintptr_t) casts might appear to be a problem if you want to have a 32-bit gdb that supports debugging 64-bit processes. However, since xfer_partial(), fetch_registers() and store_registers() get overridden by rs6000-nat.c that shouldn't be an issue. So unless I'm missing something, you should not need to make any changes to inf-ptrace.c itself. Cheers, Mark