From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22070 invoked by alias); 2 Jul 2010 16:46:30 -0000 Received: (qmail 22047 invoked by uid 22791); 2 Jul 2010 16:46:28 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,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; Fri, 02 Jul 2010 16:46:24 +0000 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o62GkMvR022409 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 2 Jul 2010 12:46:22 -0400 Received: from mesquite.lan (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o62GkMrG019189 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Fri, 2 Jul 2010 12:46:22 -0400 Date: Fri, 02 Jul 2010 16:46:00 -0000 From: Kevin Buettner To: gdb-patches@sourceware.org Subject: Re: Should we be able to read simulator memory immediately after a "load" command? Message-ID: <20100702094621.757698c1@mesquite.lan> In-Reply-To: <20100629195600.GA17949@caradoc.them.org> References: <20100628130010.360f398d@mesquite.lan> <20100629195600.GA17949@caradoc.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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: 2010-07/txt/msg00043.txt.bz2 On Tue, 29 Jun 2010 15:56:03 -0400 Daniel Jacobowitz wrote: > On Mon, Jun 28, 2010 at 01:00:10PM -0700, Kevin Buettner wrote: > > This code was added in a patch from 2006. See: > > > > http://sourceware.org/ml/gdb-patches/2006-10/msg00042.html > > > > In that posting, Daniel provides a good rationale for that patch as a > > whole, but I did not see any discussion of the portion affecting > > gdbsim_xfer_inferior_memory(). > > I'm just guessing, but my guess is that removing the check breaks > reading memory between "tar sim" and "load", and previously we would > have read from the executable file. Yes, that makes sense. > If I bothered to make the change it was probably because of the > testsuite... My own testing showed some regressions using that simple patch that I posted earlier. To that patch I added sim specific `has_memory' and `has_all_memory' methods which simply return true when `program_loaded' is true. I also took Michael's advice and changed the test in gdbsim_xfer_inferior_memory to instead call `to_has_memory'. This worked great but for two regressions in gdb.base/multi.exp. The problem was that `program_loaded' was a global and needed to be turned into a per-inferior instance variable. I did a bit more work to fix those regressions and now have a patch which allows us to have multiple simulator instances. It only works for certain simulators. E.g. mips and frv work, but powerpc and arm do not. v850 should work, but doesn't for some reason. (My guess is that there's an inadvertent global lurking in the v850 sim code somewhere.) I know without trying them that rx and m32c will also not support multiple instances. I haven't looked closely at the others yet. I'll post it as a two-parter, the first part moves the static globals into a per-inferior struct and makes the necessary adjustments to the code. The second part will add `has_memory' and `has_all_memory' methods in addition to adjusting gdbsim_xfer_inferior_memory(), thus fixing the problem that lead me down this path at the outset. Kevin