Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Stan Sieler <sieler@allegro.com>
To: dave@hiauly1.hia.nrc.ca (John David Anglin)
Cc: rhirst@linuxcare.com (Richard Hirst),
	parisc-linux@puffin.external.hp.com
Subject: Re: [parisc-linux] Single-stepping
Date: Wed, 15 Nov 2000 13:08:15 -0800 (PST)	[thread overview]
Message-ID: <200011152108.NAA23252@opus.allegro.com> (raw)
In-Reply-To: <200011151949.OAA22929@hiauly1.hia.nrc.ca> from "John David Anglin" at Nov 15, 2000 02:49:02 PM

Re:

> > The basic approach is to use the recovery counter to generate
> > a trap every instruction.  The scheme is complicated because a
...

> I really don't know enough to comment on the implementation choice.  Why
> did you decide on this approach as opposed to inserting breaks and

MPE/iX (which runs on PA-RISC hardware), has successfully used
the Recovery Counter to implement single step for many, many years.

BTW, in addition to single step, it's a great tool for counting the
number of instructions a procedure (or code path) takes,
assuming an adequately powerful debugger:

   1) stop (perhaps via a breakpoint) at the start of the code
      you want to count.

   2) set a breakpoint at the end of the code you want to count
      (e.g., if you're counting a procedure, set a breakpoint at
      the procedure exit)

   3) instead of "continue", do:   s 1000000

      (i.e., tell Debug/iX to "singlestep" 1000000 instructions)

   4) if you hit the breakpoint, enter:

          = 1000000 - rctr

      that's how many instructions your code took!  (Not counting
      instructions executed by interrupt handlers, of course.)

   5) if you *didn't* hit the breakpoint, then 1000000 wasn't
      enough instructions (and why are you trying to count so high?)

This works because MPE's debug "s" command sets the Recovery Counter
to the number of instructions you wanted to step.  Normally, that's 
one (for just "s").  If you said "s 3", it would set the Recovery Counter
to 3.  If you say "s 1000000", and then execute 123 instructions,
and then hit a breakpoint, Debug captures the entire register state
as of the breakpoint: including the Recovery Counter (which has 
1000000 - 123 in it).

Tip: if you're looking at instruction-level debugging, look at Debug/iX
to see how to do it right!


> It would appear that the recovery
> counter was intended to provide software recovery from hardware faults

The 1986 PA-RISC Instruction manual simply says "The Recovery
Counter (CR 0) can be used to provide software recovery of hardware
faults in fault tolerant systems".  (I.e., "can", not "must" ...
and there's no explanation of how one would use it for this.)


-- 
Stan Sieler                                           sieler@allegro.com
www.allegro.com/sieler/wanted/index.html                  www.sieler.com        

  parent reply	other threads:[~2000-11-15 21:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-15 18:48 [parisc-linux] Single-stepping Richard Hirst
2000-11-15 19:49 ` John David Anglin
2000-11-15 20:30   ` law
2000-11-15 21:16     ` Frank Rowand
2000-11-15 21:47       ` Stan Sieler
2000-11-15 21:08   ` Stan Sieler [this message]
2000-11-16 12:09   ` Richard Hirst

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=200011152108.NAA23252@opus.allegro.com \
    --to=sieler@allegro.com \
    --cc=dave@hiauly1.hia.nrc.ca \
    --cc=parisc-linux@puffin.external.hp.com \
    --cc=rhirst@linuxcare.com \
    /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