[lkml]   [2011]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [patch v3 19/36] Hexagon: Add ptrace support
On Wednesday 21 September 2011 18:50:09, Linas Vepstas (Code Aurora) wrote:
> On Wed, Sep 21, 2011 at 05:15:20PM +0100, Pedro Alves wrote:
> > > On Sat, Sep 10, 2011 at 12:29:57PM +0100, Pedro Alves wrote:
> > > > Yes, the x86/x86-64 ports or gdb and gdbserver are already
> > > > using GET/SETREGSET even.
> Thanks; after a bit of initial confusion, I've gotten gdb to
> work with this, so I'm happy.
> > I wish there was an equivalent of PTRACE_GETREGSET for siginfo...
> How? Why?

One of the the cool features of PTRACE_GETREGSET is that it returns
the regset in the natural layout of the tracee. So when debugging a
32-bit process on a 64-bit kernel, PTRACE_GETREGSET returns the
regset in 32-bit layout. Recent enough GDBs can print the siginfo of a
caught signal (before its delivered with (PTRACE_CONT, sig).
Try "(gdb) p $_siginfo" on x86. Trouble is 32-bit processes on 64-bit
kernels or other biarch setups. PTRACE_GETSIGINFO returns the siginfo in
64-bit layout, so GDB gets to try to immitate what the kernel's 32-bit
compat layer does. Both for reading and writting siginfo.
See compat_siginfo_from_siginfo and siginfo_from_compat_siginfo
at [1].
The kernel already knows to convert siginfo to the native layout
of the process -- needed to pass to the user space signal handler
at least. But AFAIK, there's no way for the debugger to get at it
before the signal is actually delivered.


Pedro Alves

 \ /
  Last update: 2011-09-21 20:07    [W:0.085 / U:33.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site