This is the mail archive of the frysk@sourceware.org mailing list for the frysk 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: [RFC] initial support for watchpoints in frysk


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


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