From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18489 invoked by alias); 31 Mar 2010 17:57:31 -0000 Received: (qmail 18479 invoked by uid 22791); 31 Mar 2010 17:57:31 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 31 Mar 2010 17:57:26 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.3/8.14.3) with ESMTP id o2VHu2Jf019078; Wed, 31 Mar 2010 19:56:02 +0200 (CEST) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.3/8.14.3/Submit) id o2VHu1Ml025379; Wed, 31 Mar 2010 19:56:01 +0200 (CEST) Date: Wed, 31 Mar 2010 17:57:00 -0000 Message-Id: <201003311756.o2VHu1Ml025379@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: msnyder@vmware.com CC: pedro@codesourcery.com, gdb@sourceware.org In-reply-to: <4BB387E1.3070702@vmware.com> (message from Michael Snyder on Wed, 31 Mar 2010 10:35:29 -0700) Subject: Re: Random gdbserver question (x86) References: <4BB28BF2.8080100@vmware.com> <201003310219.49529.pedro@codesourcery.com> <4BB387E1.3070702@vmware.com> Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-03/txt/msg00228.txt.bz2 > Date: Wed, 31 Mar 2010 10:35:29 -0700 > From: Michael Snyder > > Pedro Alves wrote: > > On Wednesday 31 March 2010 00:40:34, Michael Snyder wrote: > >> Question -- is gdbserver "multi-arch" to the extent that a 32-bit > >> gdbserver (built with target = i386) can debug a 64-bit app? > > > > No, only the other way around. It's "multi-arch" to the extent > > that a linux 64-bit gdbserver (built with target = x86-64) can > > debug a 32-bit app. It used to only be, only 64x64 or 32x32 was > > possible; with multi-arch, 64x32 was made possible. > > > >> I ask because linux-x86-low.c is full of ifdefs on the architecture. > >> It looks like most of the 64-bit code won't be compiled if the > >> build machine is 32-bit. > > > > Correct. > > And is that more-or-less true of gdb as well? I.e., if host/target > is x86_64-linux, then gdb can debug both 32 and 64 bit apps, but if > host/target is i386-linux, then gdb can only debug 32 bit apps? > > Actually, I phrase it as a question even though I am pretty sure it > is true. My real question is "Why?". It seems to me that if we just > included amd64-linux-nat.o and amd64-*-tdep.o in the build, then > 32-bit gdb should be able to debug 64-bit native apps. The problem here is that ptrace(2) from a 32-bit executable only gives you access to the 32-bit registers. Debugging 64-bit executables remotely should work fine though, provided you --enable-64-bit-bfd.