public inbox for
 help / color / mirror / Atom feed
From: Thiago Jung Bauermann <>
To: Phil Muldoon <>
Cc: frysk ml <>
Subject: Re: [RFC] initial support for watchpoints in frysk
Date: Thu, 15 May 2008 04:07:00 -0000	[thread overview]
Message-ID: <1210786270.617.75.camel@localhost.localdomain> (raw)
In-Reply-To: <>

Hi Phil,

Thanks for your comments.

On Wed, 2008-05-14 at 08:49 +0100, Phil Muldoon wrote:
> The watchpoint specific code looks ok. I just added an alignment check 
> yesterday to x86 and x8664, so if this is important to PPC then should 
> add the check too.

Yes, I saw that and put the same in powerpc. Thanks for the heads up.

> I'm a bit worried about the live.LinuxPtraceTask setDebugReg and 
> getDebugReg. This is a PPC specific function but it is in a non-ISA 
> class. So I think it would lead to confusion. If you were to call this 
> on x86 and x8664 what would happen?

Right, I just found out that powerpc is the only Linux arch with

> Access to the x86 and x8664 debug status registers are performed as follows:
>     return task.getRegister(X8664Registers.DEBUG_STATUS);
> I think this call eventually resolves to 
> RegisterBanks.getBankArrayRegister() which again resolves into ISA 
> specific methods to get the register. Andrew who did the register code 
> would know better here.

I can create a debugregs() method in the frysk.sys.ptrace.RegisterSet
class (or in a subclass, perhaps?) and then use the
RegisterSetByteBuffer to use the infrastructure you mention. It's a
somehwat involved solution for just one register, but it does fit better
the Frysk registers framework.

> On x86/x8664 we can just look at the bits in the debug status register 
> when a stop event/sigtrap has arrived to see if  it is a watchpoint 
> event. If you look at the handleTrappedEvent in the Running and the 
> Stepping states you can see there is a very specific sequence of checks 
> here. I'm guessing this won't work on the PPC then as you need to 
> examine the siginfo structure.

I just looked at Running.checkWatchpoint (I believe that is what you are
referring to) and it will work fine for powerpc. The siginfo check would
take place inside WatchpointFunctions.hasWatchpointTriggered method, so
it's encapsulated. I just need checkWatchpoint to pass the Signal object
to it (and also, I need the object to have the siginfo information).

>  What data are you looking for in there?

I need to examine siginfo.si_code to verify that it's a trap originated
from a hardware watchpoint. I can also look at siginfo.si_addr to get
the exact address which triggered it (since the watchpoint looks at an 8
byte range).

> > If my understanding is correct, this would make the siginfo available to
> > LinuxPtraceTaskState.Running.handleStoppedEvent, 
> Should that be LinuxPtraceTaskState.Running.handleTrappedEvent and 
> LinuxPtraceTaskState.Stepping.handleTrappedEvent? These two states right 
> now are the only states that handle watchpoints. (ie sigtrap occurs, 
> check if it is a watchpoint, if not, pass the sigtrap along).

Right, my mistake.
Thiago Jung Bauermann
Software Engineer
IBM Linux Technology Center

  reply	other threads:[~2008-05-14 17:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-14  7:50 Thiago Jung Bauermann
2008-05-14 17:31 ` Phil Muldoon
2008-05-15  4:07   ` Thiago Jung Bauermann [this message]
2008-05-15 15:41     ` Thiago Jung Bauermann

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:

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

  git send-email \
    --in-reply-to=1210786270.617.75.camel@localhost.localdomain \ \ \ \

* 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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).