Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: raunaq12@in.ibm.com
Cc: gdb-patches@sourceware.org, tromey@redhat.com
Subject: Re: [PATCH 3/5] powerpc64-aix inf-ptrace patch
Date: Mon, 15 Jul 2013 09:12:00 -0000	[thread overview]
Message-ID: <201307150911.r6F9Bx9F028368@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <OFA7DBDA74.2B3E3B73-ON65257BA9.00293949-65257BA9.00295CCB@in.ibm.com>	(message from Raunaq 12 on Mon, 15 Jul 2013 13:00:35 +0530)

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


  reply	other threads:[~2013-07-15  9:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10  9:15 Raunaq 12
2013-07-10 17:47 ` Tom Tromey
2013-07-10 19:07   ` Mark Kettenis
2013-07-15  7:32     ` Raunaq 12
2013-07-15  9:12       ` Mark Kettenis [this message]
2013-07-16 10:48         ` Raunaq 12
2013-07-23  5:35 Raunaq 12
2013-07-23  9:01 ` Mark Kettenis
2013-07-23 12:57   ` Raunaq 12
2013-07-23 14:25     ` Mark Kettenis
2013-07-23 19:40 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201307150911.r6F9Bx9F028368@glazunov.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=gdb-patches@sourceware.org \
    --cc=raunaq12@in.ibm.com \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox