Subject: [PATCH v2 23/31] arm64: Debugging support

From: [email-masked] (Arnd Bergmann)
Date: Fri, 17 Aug 2012 07:06:07 +0000

On Thursday 16 August 2012, Arnd Bergmann wrote:
> On Thursday 16 August 2012, Will Deacon wrote:
> > On Wed, Aug 15, 2012 at 04:07:36PM +0100, Arnd Bergmann wrote:
> > > On Tuesday 14 August 2012, Catalin Marinas wrote:
> 
> > > From what I can tell, there is no support for 32 bit processes debugging
> > > 64 bit ones. Is that something you plan to add in the future, or do you
> > > consider that out of scope? In either case, a comment would be helpful.
> > 
> > That can't really work because the debugger won't be able to manipulate
> > child pointers properly without us adding a new ptrace interface (and then,
> > I still wonder about how feasible it really is). I can add a comment.
> 
> You can already have a 32 bit gdb that is able to do remote debugging of
> 64 bit processes using a gdb server process. I guess it wouldn't be
> too strange to have a ptrace extension to allow the native case as well.
> I agree it's not a high priority.
> 
> > > > +long arch_ptrace(struct task_struct *child, long request,
> > > > +		 unsigned long addr, unsigned long data)
> > > > +{
> > > > +	int ret;
> > > > +	unsigned long *datap = (unsigned long __user *)data;
> > > > +
> > > > +	switch (request) {
> > > > +		case PTRACE_GET_THREAD_AREA:
> > > > +			ret = put_user(child->thread.tp_value, datap);
> > > > +			break;
> > > > +
> > > > +#ifdef CONFIG_HAVE_HW_BREAKPOINT
> > > > +		case PTRACE_GETHBPREGS:
> > > > +			ret = ptrace_gethbpregs(child, addr, datap);
> > > > +			break;
> > > > +
> > > > +		case PTRACE_SETHBPREGS:
> > > > +			ret = ptrace_sethbpregs(child, addr, datap);
> > > > +			break;
> > > > +#endif
> > > > +
> > > > +		default:
> > > > +			ret = ptrace_request(child, request, addr, data);
> > > > +			break;
> > > > +	}
> > > > +
> > > > +	return ret;
> > > > +}
> > > 
> > > Is there a reaons why these are not regsets but have their own ptrace
> > > commands? I believe new architectures should generally not add ptrace
> > > commands any more.
> > 
> > I could probably add some regset wrappers about the hbp accessors (which we
> > have to keep for the compat ptrace interface). I'll have a think as it might
> > even make sense to have different regsets for breakpoints and watchpoints.
> > 
> > As for the the tls, is it worth having a regset with only one register?
> 
> Better ask the gdb folks. I'm adding Uli to Cc, maybe he has some insight.

Sorry for the dumb question, but why do you even need PTRACE_GET_THREAD_AREA
for 64 bit tasks? I thought the thread pointer is a GPR, or is this just
for compat tasks?

	Arnd