From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29407 invoked by alias); 12 Apr 2012 16:45:31 -0000 Received: (qmail 29297 invoked by uid 22791); 12 Apr 2012 16:45:29 -0000 X-SWARE-Spam-Status: No, hits=-4.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-qc0-f169.google.com (HELO mail-qc0-f169.google.com) (209.85.216.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 12 Apr 2012 16:45:16 +0000 Received: by qcsd16 with SMTP id d16so1583380qcs.0 for ; Thu, 12 Apr 2012 09:45:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.189.137 with SMTP id de9mr4985725qab.45.1334249115333; Thu, 12 Apr 2012 09:45:15 -0700 (PDT) Received: by 10.229.136.69 with HTTP; Thu, 12 Apr 2012 09:45:15 -0700 (PDT) In-Reply-To: <4F8704F9.9040309@redhat.com> References: <20120411191609.GA466@intel.com> <4F86D411.4000100@redhat.com> <4F86FB82.7030308@redhat.com> <4F8704F9.9040309@redhat.com> Date: Thu, 12 Apr 2012 16:53:00 -0000 Message-ID: Subject: Re: PATCH: PR gdb/13969: GDBserver doesn't check unsupported binary From: "H.J. Lu" To: Pedro Alves Cc: GDB Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-04/txt/msg00312.txt.bz2 On Thu, Apr 12, 2012 at 9:38 AM, Pedro Alves wrote: > On 04/12/2012 05:25 PM, H.J. Lu wrote: > >> On Thu, Apr 12, 2012 at 8:57 AM, Pedro Alves wrote: >>> On 04/12/2012 04:37 PM, H.J. Lu wrote: >>> >>>> It doesn't work since x32 is a 32-bit process. =A0Although x32 >>>> GDBserver can get registers of 64-bit process, =A0it can't handle 64-b= it address >>> >>>> in 64b-bit process, like setting break points. >>> >>> Oh yeah... =A0PowerPC 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 64= bit >> siginfo due to address fields in siginfo. > > > Are you certain about that? =A0With a 64-bit debugger vs 32-bit process, > PTRACE_GETSIGINFO returns the siginfo in 64-bit layout. =A0I 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. =A0This ends up needing to > replicate what the kernel's compat layer does. =A0IMO, 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. --=20 H.J.