From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20073 invoked by alias); 3 Aug 2007 18:59:25 -0000 Received: (qmail 20063 invoked by uid 22791); 3 Aug 2007 18:59:24 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 03 Aug 2007 18:59:20 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 2711B98123; Fri, 3 Aug 2007 18:59:20 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id C0BC998122; Fri, 3 Aug 2007 18:59:19 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.67) (envelope-from ) id 1IH2Mn-0007Nr-Cs; Fri, 03 Aug 2007 14:59:17 -0400 Date: Fri, 03 Aug 2007 18:59:00 -0000 From: Daniel Jacobowitz To: Mark Kettenis Cc: gdb-patches@sourceware.org Subject: Re: [rfc] Adjust address size on MIPS Message-ID: <20070803185917.GA28107@caradoc.them.org> Mail-Followup-To: Mark Kettenis , gdb-patches@sourceware.org References: <20070803175822.GA11142@caradoc.them.org> <200708031837.l73IbSSG018774@brahms.sibelius.xs4all.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200708031837.l73IbSSG018774@brahms.sibelius.xs4all.nl> User-Agent: Mutt/1.5.15 (2007-04-09) 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: 2007-08/txt/msg00071.txt.bz2 On Fri, Aug 03, 2007 at 08:37:28PM +0200, Mark Kettenis wrote: > > Date: Fri, 3 Aug 2007 13:58:22 -0400 > > From: Daniel Jacobowitz > > > > I recently tried to use a 64-bit stub to debug an O32 MIPS program. > > It fell down because GDB would send a "m83000000" packet, instead of > > the proper "mffffffff83000000" packet (sign extended 64-bit > > addresses). I think that if a stub sends us some 64-bit registers in > > the "g" packet, the polite thing to do would be to send it 64-bit > > addresses by default. > > > > Does this sound wrong to anyone? > > This feels like a bad hack to me. If it is sending 64-bit addresses > should PROPERTY_GP64 be set in the first place? Isn't that exactly when it should be set? Some context - I'm not sure how much of this you're already familiar with, probably quite a bit. The remote stub is controlling some program (about which it may know very little) and has some register/address size (which may be independent of the program). This comes about because you can run an o32 program unmodified in a 64-bit environment. What's happening to me right now is that the remote stub is 64-bit, but the program is 32-bit. GDB sees that registers are 64-bit and sets the gdbarch appropriately. But since the program is o32, GDB knows that pointers are 32-bit, and then uses that as the address size. So we set a breakpoint at "0x83000000" based on the address in the symbol file. If we were a well-behaved MIPS o32 program using a store instruction, this would be sign extended behind the scenes and everything would be happy. But in the world of the 64-bit stub, you might have 4G RAM at 0 and a different 4G RAM at 0xffffffff00000000. The stub doesn't know which one of those we mean, so it takes us at our word and tries 0x83000000. Which, if you have less than 3GB of RAM, is probably not mapped as a 64-bit address. -- Daniel Jacobowitz CodeSourcery