我想更好地理解 sigaction 并且我已经使用 gdb 达到了这条指令。
0x73xxxxxxxx: bl 0x73xxxxxxxx <sigaction@plt>
如果我要探索它的参数,
x0 0x0e 14
x1 0x7fxxxxxxxx xxxxxxxxxxxx
x2 0x0
如果我进一步探索x1,
(gdb) x/16gx 0x7fxxxxxxxx
0x7fe5xxxxc0: 0x0000000000000004 0x0000007365xxxxxx
0x7fe5xxxxd0: 0xffffffffffffffff 0x0000000000000000
0x7fe5xxxxe0: 0x0000000000000020 0x0000003800030015
0x7fe5xxxxf0: 0x0000003800020015 0x0000003800010015
0x7fe5xxxx00: 0x000000380f000015 0x0000000c00000020
0x7fe5xxxx10: 0x0000007300020015 0x0000007304000025
0x7fe5xxxx20: 0x000000730b030025 0x0000000800000020
每个 qword 的含义是什么?我知道第二个 qword (0x7365xxxxxx) 应该引用信号的处理函数,但如何将其余的 qword 映射到 sigaction 结构?
如何将其余的 qword 映射到 sigaction 结构?
您可以查看定义的任何标头
struct sigaction
。
使用
echo "#include <signal.h>" | gcc -xc - -E
可以帮助您找到该标题和定义。
在我的系统上,这是
/usr/include/x86_64-linux-gnu/bits/sigaction.h
,它包含:
struct sigaction
{
union
{
__sighandler_t sa_handler;
void (*sa_sigaction) (int, siginfo_t *, void *);
}
__sigaction_handler;
__sigset_t sa_mask;
int sa_flags;
void (*sa_restorer) (void);
};
但在您的系统上,这会有所不同(也许
sa_flags
在 sa_handler
之前)。