Thread (71 messages) 71 messages, 8 authors, 2011-09-21

Re: [patch v3 19/36] Hexagon: Add ptrace support

From: Pedro Alves <hidden>
Date: 2011-09-21 18:04:35
Also in: lkml

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:
quoted
quoted
On Sat, Sep 10, 2011 at 12:29:57PM +0100, Pedro Alves wrote:
quoted
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. 
quoted
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.

[1]
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/amd64-linux-nat.c?rev=1.35&content-type=text/x-cvsweb-markup&cvsroot=src

-- 
Pedro Alves
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help