我正在尝试获取生成sigsys信号的系统调用的地址!但是我从gcc收到以下错误:
gcc emulator.c -fms-extensions
error: ‘siginfo_t’ has no member named ‘si_call_addr’
我正在使用的代码是:
static void emulator(int nr, siginfo_t *siginfo, void *void_context)
{
ucontext_t *ctx = (ucontext_t *)(void_context);
int syscall;
char *buf;
ssize_t bytes;
size_t len;
if (siginfo->si_code != SYS_SECCOMP)
return;
if (!ctx)
return;
syscall = ctx->uc_mcontext.gregs[REG_SYSCALL];
printf("System call %d ADDR %X\n", syscall, siginfo->si_call_addr);
setcontext(ctx);
return;
}
si_call_addr被定义为siginfo_t中的匿名结构。
答案 0 :(得分:0)
siginfo_t中没有si_call_addr
。您可能正在寻找si_addr
成员。
这是linux提供的siginfo_t:
siginfo_t {
int si_signo; /* Signal number */
int si_errno; /* An errno value */
int si_code; /* Signal code */
int si_trapno; /* Trap number that caused
hardware-generated signal
(unused on most architectures) */
pid_t si_pid; /* Sending process ID */
uid_t si_uid; /* Real user ID of sending process */
int si_status; /* Exit value or signal */
clock_t si_utime; /* User time consumed */
clock_t si_stime; /* System time consumed */
sigval_t si_value; /* Signal value */
int si_int; /* POSIX.1b signal */
void *si_ptr; /* POSIX.1b signal */
int si_overrun; /* Timer overrun count; POSIX.1b timers */
int si_timerid; /* Timer ID; POSIX.1b timers */
void *si_addr; /* Memory location which caused fault */
long si_band; /* Band event (was int in
glibc 2.3.2 and earlier) */
int si_fd; /* File descriptor */
short si_addr_lsb; /* Least significant bit of address
(since kernel 2.6.32) */
}