Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Pedro Alves <palves@redhat.com>
Cc: GDB <gdb-patches@sourceware.org>
Subject: Re: PATCH: PR gdb/13969: GDBserver doesn't check unsupported binary
Date: Thu, 12 Apr 2012 16:53:00 -0000	[thread overview]
Message-ID: <CAMe9rOpeuuzu-3ZHien3XCfXVi2pcXeLC-6Ap8jbXUk+hA2Dhw@mail.gmail.com> (raw)
In-Reply-To: <4F8704F9.9040309@redhat.com>

On Thu, Apr 12, 2012 at 9:38 AM, Pedro Alves <palves@redhat.com> wrote:
> On 04/12/2012 05:25 PM, H.J. Lu wrote:
>
>> On Thu, Apr 12, 2012 at 8:57 AM, Pedro Alves <palves@redhat.com> wrote:
>>> On 04/12/2012 04:37 PM, H.J. Lu wrote:
>>>
>>>> It doesn't work since x32 is a 32-bit process.  Although x32
>>>> GDBserver can get registers of 64-bit process,  it can't handle 64-bit address
>>>
>>>> in 64b-bit process, like setting break points.
>>>
>>> Oh yeah...  PowerPC has PPC_PTRACE_PEEKDATA_3264/PPC_PTRACE_POKEDATA_3264
>>> for that, but well, it's PowerPC specific.
>>>
>>
>> Also x32 siginfo is different from 64bit signfo. X32 ptrace can't get 64bit
>> siginfo due to address fields in siginfo.
>
>
> Are you certain about that?  With a 64-bit debugger vs 32-bit process,
> PTRACE_GETSIGINFO returns the siginfo in 64-bit layout.  I could see the
> kernel returning 64-bit siginfo for x32 too (it's a question of whether
> the kernel returns its native layout, or the debugger's).
>
> In the 64x32 case, GDB has to go through contortions to
> translate the siginfo layout (in both directions), for the
> $_siginfo convenience variable's support.  This ends up needing to
> replicate what the kernel's compat layer does.  IMO, a PTRACE_
> method that always returned the siginfo object in the layout of the
> inferior would be nice.
>

x32 ptrace returns x32 siginfo, which is compatible with
ia32 inferior, but not 64bit inferior, due to

	/* SIGILL, SIGFPE, SIGSEGV, SIGBUS.  */
	struct
	  {
	    void *si_addr;	/* Faulting insn/memory ref.  */
	  } _sigfault;

si_addr is 32bit for x32 ptrace.


-- 
H.J.


  reply	other threads:[~2012-04-12 16:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11 20:36 H.J. Lu
2012-04-12 13:52 ` Pedro Alves
2012-04-12 15:58   ` H.J. Lu
2012-04-12 16:01     ` Pedro Alves
2012-04-12 16:38       ` H.J. Lu
2012-04-12 16:45         ` Pedro Alves
2012-04-12 16:53           ` H.J. Lu [this message]
2012-04-12 17:20             ` Pedro Alves
2012-04-12 18:05               ` H.J. Lu

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=CAMe9rOpeuuzu-3ZHien3XCfXVi2pcXeLC-6Ap8jbXUk+hA2Dhw@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@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