This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


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

Re: i386 Linux signal trampoline support for gdb 4.18


In article <19990714045151.11323.qmail@daffy.airs.com>,
Ian Lance Taylor <ian@zembu.com> writes:

> On most systems signal trampoline code is simply a libc function, so
> it is comparatively easy to detect one.  The Linux kernel, however,
> builds the signal trampoline on the stack.  This patch works by
> looking for the particular set of instructions the Linux kernel places
> on the stack.  This test should rarely give a false positive, because
> the kernel builds instructions which invoke the sigreturn system call,
> which is only useful when returning from a signal handler.  It is of
> course possible that the kernel behaviour will change at some later
> date, in which case this test will have to be modified.

On the post 2.1 tree glibc has switched to a libc function and set 
SA_RESTORER (actually it did have the function since ages, but forgot
to set the flag so the kernel never used it). The functions are called
__restore and __restore_rt, I am not sure if they're exported though.
The code is basically similar except that __restore_rt calls 
rt_sigreturn instead of sigreturn for queued realtime signals in 2.2.
The kernel trampoline has a rt_sigreturn version too (syscall 173 instead of 
of 119), this should probably be handled. 

So post glibc 2.1 can be only handled by either adding lots of ptrace traffic
(checking  for the signature for every backtrace address), or by teaching
gdb about glibc internals.

The code needs to be changed to handle syscall 173 too, otherwie it'll
lose with RT signals.

-Andi


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