This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Should we be able to read simulator memory immediately after a "load" command?


On Tue, 29 Jun 2010 15:56:03 -0400
Daniel Jacobowitz <dan@codesourcery.com> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]