public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 4/5] powerpc64-aix ptrace64 when defined.
@ 2013-08-01 11:28 Raunaq 12
  2013-08-01 13:26 ` Mark Kettenis
  0 siblings, 1 reply; 14+ messages in thread
From: Raunaq 12 @ 2013-08-01 11:28 UTC (permalink / raw)
  To: gdb-patches; +Cc: tromey, Mark Kettenis


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.
---
ChangeLog :-

* gdb_ptrace.h: Add macro to define ptrace64 if HAVE_PTRACE64 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
*config.in: initialize HAVE_PTRACE64 which will be set by configure
---
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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] powerpc64-aix ptrace64 when defined.
  2013-08-01 11:28 [PATCH 4/5] powerpc64-aix ptrace64 when defined Raunaq 12
@ 2013-08-01 13:26 ` Mark Kettenis
  2013-08-02  6:56   ` Raunaq 12
                     ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Mark Kettenis @ 2013-08-01 13:26 UTC (permalink / raw)
  To: raunaq12; +Cc: gdb-patches, tromey

> From: Raunaq 12 <raunaq12@in.ibm.com>
> Date: Thu, 1 Aug 2013 16:56:53 +0530
> 
> 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.

Still some nits:

> ---
> ChangeLog :-
> 
> * 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.



> ---
> 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)

Needs a space between on the last line between 'ptrace' and '(' (but
not on the line before that.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] powerpc64-aix ptrace64 when defined.
  2013-08-01 13:26 ` Mark Kettenis
@ 2013-08-02  6:56   ` Raunaq 12
       [not found]   ` <OF21D042FF.CF4E8435-ON65257BBB.0024F10A-65257BBB.00261FEF@LocalDomain>
  2013-08-07 13:36   ` Raunaq 12
  2 siblings, 0 replies; 14+ messages in thread
From: Raunaq 12 @ 2013-08-02  6:56 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches, tromey

> > 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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 4/5] powerpc64-aix ptrace64 when defined.
       [not found]   ` <OF21D042FF.CF4E8435-ON65257BBB.0024F10A-65257BBB.00261FEF@LocalDomain>
@ 2013-08-07 11:39     ` Raunaq 12
  0 siblings, 0 replies; 14+ messages in thread
From: Raunaq 12 @ 2013-08-07 11:39 UTC (permalink / raw)
  To: gdb-patches; +Cc: brobecker, tromey, Mark Kettenis, Pedro Alves

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.
---
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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] powerpc64-aix ptrace64 when defined.
  2013-08-01 13:26 ` Mark Kettenis
  2013-08-02  6:56   ` Raunaq 12
       [not found]   ` <OF21D042FF.CF4E8435-ON65257BBB.0024F10A-65257BBB.00261FEF@LocalDomain>
@ 2013-08-07 13:36   ` Raunaq 12
  2013-08-07 14:44     ` Ulrich Weigand
  2 siblings, 1 reply; 14+ messages in thread
From: Raunaq 12 @ 2013-08-07 13:36 UTC (permalink / raw)
  To: Mark Kettenis, Ulrich Weigand, gdb-patches; +Cc: tromey

[-- Attachment #1: Type: text/plain, Size: 1039 bytes --]

> > 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

Hi Mark,
Removed the unnecessary casts from pid in rs6000-nat.c as well.
If it is Okay to commit, Ulrich, kindly find the Changelog and
attached patch below.

This patch changes configure.ac so configure and config.in should
be regenerated.
---
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.

(See attached file: gdb-7.6-defptrace64.patch)

Thanks,
Raunaq M. Bathija

[-- Attachment #2: gdb-7.6-defptrace64.patch --]
[-- Type: application/octet-stream, Size: 2271 bytes --]

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, 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, id, addr, data, 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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] powerpc64-aix ptrace64 when defined.
  2013-08-07 13:36   ` Raunaq 12
@ 2013-08-07 14:44     ` Ulrich Weigand
  0 siblings, 0 replies; 14+ messages in thread
From: Ulrich Weigand @ 2013-08-07 14:44 UTC (permalink / raw)
  To: Raunaq 12; +Cc: Mark Kettenis, Ulrich Weigand, gdb-patches, tromey

Raunaq 12 wrote:

> 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.
> 
> (See attached file: gdb-7.6-defptrace64.patch)

I've checked this in as well.

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] powerpc64-aix ptrace64 when defined.
  2013-08-12 19:43   ` David Edelsohn
@ 2013-08-22 23:32     ` Joel Brobecker
  0 siblings, 0 replies; 14+ messages in thread
From: Joel Brobecker @ 2013-08-22 23:32 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Raunaq 12, GDB Patches, Mark Kettenis, Ulrich Weigand

> I built gdb-7.6 with the ptrace64 patch (without --enable-64-bit-bfd)
> and it seems to work correctly on cc1plus. So at least the current
> patch does not harm debugging.

Actually, I just found that it breaks thread support on 32bit AIX,
at least.  A simpler way to show the problem is:

    (gdb) x /x &__n_pthreads
    0xf06a8258 <__n_pthreads>:      Cannot access memory at address 0xf06a8258

Prior to the patch, we have:

    (gdb) x /x &__n_pthreads
    0xf06a8258 <__n_pthreads>:      0x00000003

The error returned by ptrace64 is EIO (5), which means it thinks
the address is wrong (or else the request ID is invalid, but I doubt
that). I'm a bit rushed, as usual, but I still have a little extra
time today to dig a little further.

-- 
Joel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] powerpc64-aix ptrace64 when defined.
  2013-08-12 12:11 ` Raunaq 12
@ 2013-08-12 19:43   ` David Edelsohn
  2013-08-22 23:32     ` Joel Brobecker
  0 siblings, 1 reply; 14+ messages in thread
From: David Edelsohn @ 2013-08-12 19:43 UTC (permalink / raw)
  To: Raunaq 12; +Cc: GDB Patches, Mark Kettenis, Ulrich Weigand

On Mon, Aug 12, 2013 at 8:10 AM, Raunaq 12 <raunaq12@in.ibm.com> wrote:

> My initial intention was to use ptrace64 only if ptrace64 was available and
> GDB was built in 64 BIT. But after a few discussions over this, I decided
> to use ptrace64 when ever the API is defined.
>
> So, this present patch would use
> ptrace64 even for a 32 bit build as you rightly noticed.
> This did not change the test results for a 32 bit build of GDB.

I built gdb-7.6 with the ptrace64 patch (without --enable-64-bit-bfd)
and it seems to work correctly on cc1plus. So at least the current
patch does not harm debugging.

Thanks, David

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] powerpc64-aix ptrace64 when defined.
  2013-08-12 12:02 ` Raunaq 12
@ 2013-08-12 15:53   ` David Edelsohn
  0 siblings, 0 replies; 14+ messages in thread
From: David Edelsohn @ 2013-08-12 15:53 UTC (permalink / raw)
  To: Raunaq 12; +Cc: GDB Patches, Mark Kettenis, Ulrich Weigand

On Mon, Aug 12, 2013 at 8:00 AM, Raunaq 12 <raunaq12@in.ibm.com> wrote:

> The earlier version of this patch was using ptrace64 only if BFD64 was
> defined,
> i.e. when GDB was built in 64 BIT mode.
> Did you build 32 bit gdb?
> If so, according to the previous version of this patch,
> no ptrace related calls were changed as ptrace64 was only
> called if BFD64 was defined. Could you please resend the error you got
> while debugging
> 32 bit GCC to my mail id? I can look into it to see where the problem is
> coming from.

I have not tried to build GDB with the latest test of patches.  When I
used the earlier patches to build GDB in 32 bit mode but with
--enable-64-bit-bfd (because I want to debug 64 bit applications), and
tried to use the debugger with GCC, I encountered the problem that no
function call argument values were available.

Thanks, David

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] powerpc64-aix ptrace64 when defined.
       [not found] <CAGWvnynVeLt6F-QREsP_CtQvwvtZgwqHxtcS6pn58LMf=AX=GA@mail.gmail.com>
  2013-08-12 12:02 ` Raunaq 12
@ 2013-08-12 12:11 ` Raunaq 12
  2013-08-12 19:43   ` David Edelsohn
  1 sibling, 1 reply; 14+ messages in thread
From: Raunaq 12 @ 2013-08-12 12:11 UTC (permalink / raw)
  To: David Edelsohn; +Cc: gdb-patches, Mark Kettenis, Ulrich Weigand


[ sending again without the line wrapping that makes it so hard to read]

David Edelsohn <dje.gcc@gmail.com> wrote on 08/09/2013 09:23:42 PM:

> From: David Edelsohn <dje.gcc@gmail.com>
> To: Raunaq 12/India/IBM@IBMIN, Mark Kettenis <mark.kettenis@xs4all.nl>, Ulrich Weigand
> <Ulrich.Weigand@de.ibm.com>
> Cc: gdb-patches@sourceware.org
> Date: 08/09/2013 09:22 PM
> Subject: Re: [PATCH 4/5] powerpc64-aix ptrace64 when defined.
>
> > 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.
>
> Have you tested the patch in both 32 bit mode and 64 bit mode for both host GDB and target
> debugee?

Yes, ran the tests in testsuite/gdb.base and any new failures did not arise when

>I tried the earlier version of this patch from last year and experienced problems
> debugging in 32 bit mode (I no longer could debug GCC).

The earlier version of this patch was using ptrace64 only if BFD64 was defined,
i.e. when GDB was built in 64 BIT mode.
Did you build 32 bit gdb?
If so, according to the previous version of this patch,
no ptrace related calls were changed as ptrace64 was only
called if BFD64 was defined. Could you please resend the error you got while debugging
32 bit GCC to my mail id? I can look into it to see where the problem is coming from.

> ptrace, ptracex and ptrace64 are defined in syscalls.exp.
>
> ptrace64                syscall3264
> # 32
> ptrace                  syscall32
> ptracex                 syscall32

> As you wrote, ptrace and ptracex are 32 bit only API; ptrace64 is available as 32 bit and 64 bit
> API. ptrace64 is suppose to support 32 bit debugee targets, but I experienced problems.
>
> ptrace64 will be discovered as supported by configure when building 32 bit GDB.

> Is your intention to always use ptrace64 when it is available or only to use it for GDB hosted on
> 64 bit mode?

My initial intention was to use ptrace64 only if ptrace64 was available and
GDB was built in 64 BIT. But after a few discussions over this, I decided
to use ptrace64 when ever the API is defined.

So, this present patch would use
ptrace64 even for a 32 bit build as you rightly noticed.
This did not change the test results for a 32 bit build of GDB.

Thanks,
Raunaq M. Bathija

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] powerpc64-aix ptrace64 when defined.
       [not found] <CAGWvnynVeLt6F-QREsP_CtQvwvtZgwqHxtcS6pn58LMf=AX=GA@mail.gmail.com>
@ 2013-08-12 12:02 ` Raunaq 12
  2013-08-12 15:53   ` David Edelsohn
  2013-08-12 12:11 ` Raunaq 12
  1 sibling, 1 reply; 14+ messages in thread
From: Raunaq 12 @ 2013-08-12 12:02 UTC (permalink / raw)
  To: David Edelsohn; +Cc: gdb-patches, Mark Kettenis, Ulrich Weigand



David Edelsohn <dje.gcc@gmail.com> wrote on 08/09/2013 09:23:42 PM:

> From: David Edelsohn <dje.gcc@gmail.com>
> To: Raunaq 12/India/IBM@IBMIN, Mark Kettenis <mark.kettenis@xs4all.nl>,
Ulrich Weigand
> <Ulrich.Weigand@de.ibm.com>
> Cc: gdb-patches@sourceware.org
> Date: 08/09/2013 09:22 PM
> Subject: Re: [PATCH 4/5] powerpc64-aix ptrace64 when defined.
>
> > 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.
>
> Have you tested the patch in both 32 bit mode and 64 bit mode for both
host GDB and target
> debugee?

Yes, ran the tests in testsuite/gdb.base and any new failures did not arise
when

>I tried the earlier version of this patch from last year and experienced
problems
> debugging in 32 bit mode (I no longer could debug GCC).

The earlier version of this patch was using ptrace64 only if BFD64 was
defined,
i.e. when GDB was built in 64 BIT mode.
Did you build 32 bit gdb?
If so, according to the previous version of this patch,
no ptrace related calls were changed as ptrace64 was only
called if BFD64 was defined. Could you please resend the error you got
while debugging
32 bit GCC to my mail id? I can look into it to see where the problem is
coming from.

> ptrace, ptracex and ptrace64 are defined in syscalls.exp.
>
> ptrace64                syscall3264
> # 32
> ptrace                  syscall32
> ptracex                 syscall32

> As you wrote, ptrace and ptracex are 32 bit only API; ptrace64 is
available as 32 bit and 64 bit
> API. ptrace64 is suppose to support 32 bit debugee targets, but I
experienced problems.
>
> ptrace64 will be discovered as supported by configure when building 32
bit GDB.

> Is your intention to always use ptrace64 when it is available or only to
use it for GDB hosted on
> 64 bit mode?

My initial intention was to use ptrace64 only if ptrace64 was available and
GDB was built in 64 BIT. But after a few discussions over this, I decided
to use ptrace64 when ever the API is defined.

So, this present patch would use
ptrace64 even for a 32 bit build as you rightly noticed.
This did not change the test results for a 32 bit build of GDB.

Thanks,
Raunaq M. Bathija

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] powerpc64-aix ptrace64 when defined.
@ 2013-08-10  2:57 David Edelsohn
  0 siblings, 0 replies; 14+ messages in thread
From: David Edelsohn @ 2013-08-10  2:57 UTC (permalink / raw)
  To: Raunaq 12; +Cc: Tom Tromey, Ulrich Weigand, GDB Patches, Mark Kettenis

[Trying again because GMail insists on sending HTML which
sourceware.org rejects.]

> 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.

Have you tested the patch in both 32 bit mode and 64 bit mode for both host
GDB and target debugee? I tried the earlier version of this patch from last
year and experienced problems debugging in 32 bit mode (I no longer could
debug GCC).

ptrace, ptracex and ptrace64 are defined in syscalls.exp

ptrace64                 syscall3264
# 32
ptrace                     syscall32
ptracex                   syscall32

As you wrote, ptrace and ptracex are 32 bit only APIs; ptrace64 is
available as 32 bit and 64 bit API.  ptrace64 is suppose to support 32 bit
debugee targets, but I experienced problems.

A configure probe of ptrace64 will compile and link in 32 bit mode and
configure will discover it as available when building 32 bit GDB.

Is your intention to always use ptrace64 when it is available or only to
use it for GDB built and hosted on 64 bit mode?

Thanks, David

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 4/5] powerpc64-aix ptrace64 when defined.
@ 2013-07-29  6:17 Raunaq 12
  0 siblings, 0 replies; 14+ messages in thread
From: Raunaq 12 @ 2013-07-29  6:17 UTC (permalink / raw)
  To: gdb-patches; +Cc: tromey, Mark Kettenis


When GDB is compiled in 64 BIT mode ptrace and ptracex calls are not
defined.
So, instead we check if ptrace64 is defined, if it is then we call that
instead of ptrace/x.
---
ChangeLog :-

* gdb_ptrace.h: Add macro to define ptrace64 if HAVE_PTRACE64 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
*config.in: initialize HAVE_PTRACE64 which will be set by configure
---
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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 4/5] powerpc64-aix ptrace64 when defined.
@ 2013-07-24 13:01 Raunaq 12
  0 siblings, 0 replies; 14+ messages in thread
From: Raunaq 12 @ 2013-07-24 13:01 UTC (permalink / raw)
  To: gdb-patches; +Cc: Mark Kettenis, tromey


When GDB is compiled in 64 BIT mode ptrace and ptracex calls are not
defined.
So, instead we check if ptrace64 is defined, if it is then we call that
instead of ptrace/x.
---
ChangeLog :-

* gdb_ptrace.h: Add macro to define ptrace64 if HAVE_PTRACE64 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
*config.in: initialize HAVE_PTRACE64 which will be set by configure
---
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

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-08-22 23:32 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-01 11:28 [PATCH 4/5] powerpc64-aix ptrace64 when defined Raunaq 12
2013-08-01 13:26 ` Mark Kettenis
2013-08-02  6:56   ` Raunaq 12
     [not found]   ` <OF21D042FF.CF4E8435-ON65257BBB.0024F10A-65257BBB.00261FEF@LocalDomain>
2013-08-07 11:39     ` Raunaq 12
2013-08-07 13:36   ` Raunaq 12
2013-08-07 14:44     ` Ulrich Weigand
     [not found] <CAGWvnynVeLt6F-QREsP_CtQvwvtZgwqHxtcS6pn58LMf=AX=GA@mail.gmail.com>
2013-08-12 12:02 ` Raunaq 12
2013-08-12 15:53   ` David Edelsohn
2013-08-12 12:11 ` Raunaq 12
2013-08-12 19:43   ` David Edelsohn
2013-08-22 23:32     ` Joel Brobecker
  -- strict thread matches above, loose matches on Subject: below --
2013-08-10  2:57 David Edelsohn
2013-07-29  6:17 Raunaq 12
2013-07-24 13:01 Raunaq 12

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).