From: Phil Muldoon <pmuldoon@redhat.com>
To: Thiago Jung Bauermann <bauerman@br.ibm.com>
Cc: frysk ml <frysk@sourceware.org>
Subject: Re: [RFC] initial support for watchpoints in frysk
Date: Wed, 14 May 2008 17:31:00 -0000 [thread overview]
Message-ID: <482A999F.7030107@redhat.com> (raw)
In-Reply-To: <1210733704.617.55.camel@localhost.localdomain>
Thiago Jung Bauermann wrote:
> Hi,
>
Hi Thiago,
> Since fhpd is complaining rather loudly about not supporting watchpoints
> in Power, I decided to add such support. :-)
>
> I'd like to ask your opinion, especially regarding two
> methods I had to add to frysk.sys.Ptrace and
> frysk.proc.live.LinuxPtraceTask: setDebugReg and getDebugReg. They are
> necessary because on the PowerPC architecture, debug registers are a
> priviledged resource, and userland need to access them via
> PTRACE_SET_DEBUGREG and PTRACE_GET_DEBUGREG. What do you think, are
> these changes ok?
>
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.
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?
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.
> Now regarding why the patch doesn't work: in order to verify if the
> process stopped because of the hardware watchpoint, I need to examine
> the siginfo structure which comes with the SIGTRAP. This information is
> not available to Frysk yet, so I'd like your opinion on the following
> approach:
>
>
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. What data are you looking for in there?
> 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).
Regards
Phil
next prev parent reply other threads:[~2008-05-14 7:50 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 [this message]
2008-05-15 4:07 ` Thiago Jung Bauermann
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:
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=482A999F.7030107@redhat.com \
--to=pmuldoon@redhat.com \
--cc=bauerman@br.ibm.com \
--cc=frysk@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).