Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@mips.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sourceware.org, Chris Dearman <chris@mips.com>,
	     "Maciej W. Rozycki" <macro@linux-mips.org>
Subject: Re: MIPS: Handle the DSP registers
Date: Thu, 27 Mar 2008 17:13:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.61.0803270953470.26878@perivale.mips.com> (raw)
In-Reply-To: <20080326175926.GA10127@caradoc.them.org>

On Wed, 26 Mar 2008, Daniel Jacobowitz wrote:

> You've got this backwards.  The numbers _taken_ by
> tdesc_remote_register_number are internal.  The numbers returned by it
> are the external interface with a remote stub.

 Ah, I see, indeed -- I got confused at one point.  So the numbers in XML 
files are externally visible and these from the enum containing 
MIPS_ZERO_REGNUM, etc. are internal.  Which means you are right they can 
be assigned randomly (so your choice is certainly not worse than mine but 
it's densier, which is an advantage here); though some other bits which 
predate target descriptions in my patch set depend on these numbers for 
remote targets, so again -- I will put that dependency to where the 
dependee is (1).

> Ptrace isn't affected by these numbers at all; translation is done
> by mips_linux_register_addr for instance.

 Indeed -- I was too fast writing this.

> If there are no existing remote stubs (ignoring gdbserver, here, newer
> versions of gdbserver will use XML) that transmit the new
> registers, then there's no need to give them any particular numbers.
> If there are existing stubs you want to preserve, then we can add
> a translation method if you can tell us what the actual register
> layout you want is.

 As far as I know it both YAMON and the SDE library debugging stub both 
provide access to cp0 registers.  I may not have time to check whether 
they use the problematic packets, but with the code shuffle above (1) this 
becomes a non-issue for this lone change.

> Does the MDI patch rely on passing "1" to the new function?  If not,
> please just use regcache_invalidate.  Speaking about good engineering

 Well, it passes "-1", so it is reasonable and not exactly the same as 
regcache_invalidate().

> design, a function which marks cached data as valid without putting
> in any data is pretty suspicious.

 Indeed -- another patch in the set adds:

  regcache_set_valid_p (regcache, cookednum,
			regcache_valid_p (regcache, rawnum));

at the botton of mips_pseudo_register_read() too, which is a place, I 
believe, the scenario you are referring to may actually happen; it used to 
for sure.  Similarly there used to be another possibility for this to 
trigger in code we have to access registers through a frame.

> Then an N32 GDB is not going to be able to read these registers unless
> we create a regset for them, FYI.  ptrace takes and returns longs on
> n32, not long longs.  I experimented with using long long, but it was
> a terrible mess.

 Hmm, I have had a peek at the kernel and it looks like PTRACE_POKEUSR and 
PTRACE_PEEKUSR requests are completely broken for n32; it's just that we 
have a way around it for GP/FP registers...

> >  It just looked wrong to me to depend on a preprocessor macro where we 
> > strive to make GDB multi-platform.  Your point is of course valid, but 
> > after a little thought I believe my change is right anyway.  Given a 
> > 64-bit kernel and an (n)64 or n32 GDB binary you may want to debug an o32 
> > executable; I have not investigated how ptrace() is meant to work in such 
> > a scenario and I do not insist on getting rid of the macro dependency with 
> > this patch, but this is something to be kept in mind in my opinion.
> 
> That exact requirement is why it's written the way it is.  If GDB is
> 64-bit, then we can always read 64-bit registers from the target; the
> pseudo ABI registers will be the right size for o32.

 Fair enough, though still hackish in my opinion. ;-)

> > fixed a couple of issues that I discovered in testing too.  Here is a new 
> > version.  As native regression testing takes quite a while, I will do this 
> > once we agree on a reasonable candidate for commission.
> 
> Sounds fine.  If you'll forgive me, I'll wait to look at the patch
> until we resolve the issues above.

 Well, certainly fixing ptrace() to work with DSP registers one way or 
another for n32 can wait until we have a relevant piece of silicon and 
I'll sort out the numbering issue as referred to above (1).  Please let me 
know whether there is anything else you have had in mind and I'll send a 
new version of the patch shortly.

  Maciej


  reply	other threads:[~2008-03-27 17:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-10 16:33 Maciej W. Rozycki
2007-12-18 13:42 ` Daniel Jacobowitz
2007-12-18 13:56   ` Nigel Stephens
2007-12-18 15:15     ` Daniel Jacobowitz
2007-12-18 16:06       ` Nigel Stephens
2008-03-19 17:07   ` Maciej W. Rozycki
2008-03-21 18:44     ` Daniel Jacobowitz
2008-03-26 16:59       ` Maciej W. Rozycki
2008-03-26 17:59         ` Daniel Jacobowitz
2008-03-27 17:13           ` Maciej W. Rozycki [this message]
2008-03-27 17:46             ` Daniel Jacobowitz
2008-03-28 17:16               ` Maciej W. Rozycki
2008-03-31 10:50                 ` Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.61.0803270953470.26878@perivale.mips.com \
    --to=macro@mips.com \
    --cc=chris@mips.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=macro@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox