This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 3/5] powerpc64-aix inf-ptrace patch


> From: Raunaq 12 <raunaq12@in.ibm.com>
> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]