diff options
author | Rich Felker <dalias@aerifal.cx> | 2016-11-12 19:43:37 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2016-11-12 19:54:43 -0500 |
commit | 54991729fd1e3d3a0cb71884d758d86afe6da9e0 (patch) | |
tree | 220f219af4477a552995f66de3d26a71e603c26b /arch/x32/ksigaction.h | |
parent | 15094943050eb9a564f409323070e50b40f78816 (diff) | |
download | musl-54991729fd1e3d3a0cb71884d758d86afe6da9e0.tar.gz musl-54991729fd1e3d3a0cb71884d758d86afe6da9e0.tar.xz musl-54991729fd1e3d3a0cb71884d758d86afe6da9e0.zip |
work around gdb issues recognizing sigreturn trampoline on x86_64
gdb can only backtrace/unwind across signal handlers if it recognizes the sa_restorer trampoline. for x86_64, gdb first attempts to determine the symbol name for the function in which the program counter resides and match it against "__restore_rt". if no name can be found (e.g. in the case of a stripped binary), the exact instruction sequence is matched instead. when matching the function name, however, gdb's unwind code wrongly considers the interval [sym,sym+size] rather than [sym,sym+size). thus, if __restore_rt begins immediately after another function, gdb wrongly identifies pc as lying within the previous adjacent function. this patch adds a nop before __restore_rt to preclude that possibility. it also removes the symbol name __restore and replaces it with a macro since the stability of whether gdb identifies the function as __restore_rt or __restore is not clear. for the no-symbols case, the instruction sequence is changed to use %rax rather than %eax to match what gdb expects. based on patch by Szabolcs Nagy, with extended description and corresponding x32 changes added.
Diffstat (limited to 'arch/x32/ksigaction.h')
-rw-r--r-- | arch/x32/ksigaction.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/x32/ksigaction.h b/arch/x32/ksigaction.h new file mode 100644 index 00000000..7743c5c6 --- /dev/null +++ b/arch/x32/ksigaction.h @@ -0,0 +1,9 @@ +struct k_sigaction { + void (*handler)(int); + unsigned long flags; + void (*restorer)(void); + unsigned mask[2]; +}; + +void __restore_rt(); +#define __restore __restore_rt |