From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28420 invoked by alias); 12 Apr 2012 13:09:55 -0000 Received: (qmail 28016 invoked by uid 22791); 12 Apr 2012 13:09:53 -0000 X-SWARE-Spam-Status: No, hits=-7.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 12 Apr 2012 13:09:40 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3CD9dnU027908 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 12 Apr 2012 09:09:39 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q3CD9ccw001509; Thu, 12 Apr 2012 09:09:38 -0400 Message-ID: <4F86D411.4000100@redhat.com> Date: Thu, 12 Apr 2012 13:52:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: "H.J. Lu" CC: "H.J. Lu" , GDB Subject: Re: PATCH: PR gdb/13969: GDBserver doesn't check unsupported binary References: <20120411191609.GA466@intel.com> In-Reply-To: <20120411191609.GA466@intel.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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/msg00299.txt.bz2 On 04/11/2012 08:16 PM, H.J. Lu wrote: > 2012-04-11 H.J. Lu > > PR gdb/13969 > * linux-low.c (linux_pid_exe_is_elf_64_file): Also return the > e_machine field. > (linux_qxfer_libraries_svr4): Update call to elf_64_file_p. > > * linux-low.h (linux_pid_exe_is_elf_64_file): Updated. > > * linux-x86-low.c (linux_is_64bit): New. I don't see a new linux_is_64bit symbol in the patch. > (x86_arch_setup): Check if GDBserver is compatible with > process. These all all logically related changes. Please drop the empty lines. > --- a/gdb/gdbserver/linux-x86-low.c > +++ b/gdb/gdbserver/linux-x86-low.c > @@ -1106,17 +1106,28 @@ x86_linux_process_qsupported (const char *query) > static void > x86_arch_setup (void) > { > -#ifdef __x86_64__ > int pid = pid_of (get_thread_lwp (current_inferior)); > - int use_64bit = linux_pid_exe_is_elf_64_file (pid); > + unsigned int machine; > + int use_64bit = linux_pid_exe_is_elf_64_file (pid, &machine); > > + if (sizeof (void *) == 4) > + { > + if (use_64bit > 0) > + error (_("Can't debug 64-bit process with 32-bit GDBserver")); > +#ifndef __x86_64__ > + else if (machine == EM_X86_64) > + error (_("Can't debug x86-64 process with 32-bit GDBserver")); > +#endif > + } > + > +#ifdef __x86_64__ > if (use_64bit < 0) Please rename use_64bit to something like is_elf64. The code reads now a bit confusingly with "use_64bit". Okay with that change, and the ChangeLog entry fixed. I assume there's no kernel limitation that would prevent a x32 gdbserver from debugging a 64-bit process? -- Pedro Alves