This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 3/5] powerpc64-aix inf-ptrace patch
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: raunaq12 at in dot ibm dot com
- Cc: gdb-patches at sourceware dot org, tromey at redhat dot com
- Date: Tue, 23 Jul 2013 16:25:13 +0200 (CEST)
- Subject: Re: [PATCH 3/5] powerpc64-aix inf-ptrace patch
- References: <OF8903680D dot BD89C8FA-ON65257BB1 dot 001EA3F4-65257BB1 dot 001EB66B at in dot ibm dot com> <201307230901 dot r6N91Tfu005129 at glazunov dot sibelius dot xs4all dot nl> <OFC9A62BB4 dot E1D080B4-ON65257BB1 dot 00459CFE-65257BB1 dot 00472817 at in dot ibm dot com>
> 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.