Re: [PATCH 3/3] [PowerPC] Fix debug register issues in ppc-linux-nat

Ulrich Weigand
2019-08-21T15:31:42Z

> I don't think this is the way the interface was intended to be used (see
> linux/Documentation/powerpc/ptrace.txt),

You're right. Any attempt to be "clever" like this must necessarily
make assumptions that go beyond treating the return value of
PTRACE_SETHWDEBUG as opaque handle. I didn't realize this ...

> Is this an acceptable solution, or should we keep track of installed
> slots across clones and forks?

Given the above, I guess I now agree with your originally proposed
solution to keep track of installed slots across clones and forks.

The one question I still have is, given that we'll be deleting the
installed breakpoints after a clone/fork anyway, wouldn't it be
easier to just *delete* all breakpoints directly at the clone/fork
callback and start out the GDB "installed" structures as empty?
But that's just a minor detail ... whatever is easier to implement
is fine with me.

Since this really seems to be required on PowerPC due to the peculiar
ptrace interface, I'm fine with adding the common code clone hook.

Thanks,