mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
Decode signal information returned by system calls.
Specifically, decode the siginfo structure returned by sigtimedwait(), sigwaitinfo(), and wait6(). While here, also decode the signal number returned in the second argument to sigwait().
This commit is contained in:
parent
3cc32ea655
commit
13e5e6b616
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=323021
@ -35,4 +35,5 @@ extern int print_line_prefix(struct trussinfo *);
|
||||
extern void setup_and_wait(struct trussinfo *, char **);
|
||||
extern void start_tracing(struct trussinfo *, pid_t);
|
||||
extern void restore_proc(int);
|
||||
extern void decode_siginfo(FILE *, siginfo_t *);
|
||||
extern void eventloop(struct trussinfo *);
|
||||
|
@ -584,7 +584,7 @@ report_new_child(struct trussinfo *info)
|
||||
fprintf(info->outfile, "<new process>\n");
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
decode_siginfo(FILE *fp, siginfo_t *si)
|
||||
{
|
||||
const char *str;
|
||||
|
@ -52,6 +52,7 @@ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHex, Name, Ptr, Stat, Stat11
|
||||
Sockoptname, Msgflags, CapRights, PUInt, PQuadHex, Acltype,
|
||||
Extattrnamespace, Minherit, Mlockall, Mountflags, Msync, Priowhich,
|
||||
Ptraceop, Quotactlcmd, Reboothowto, Rtpriofunc, Schedpolicy, Schedparam,
|
||||
PSig, Siginfo,
|
||||
|
||||
CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags,
|
||||
CloudABIFDStat, CloudABIFileStat, CloudABIFileType,
|
||||
|
@ -462,11 +462,12 @@ static struct syscall decoded_syscalls[] = {
|
||||
{ .name = "sigsuspend", .ret_type = 1, .nargs = 1,
|
||||
.args = { { Sigset | IN, 0 } } },
|
||||
{ .name = "sigtimedwait", .ret_type = 1, .nargs = 3,
|
||||
.args = { { Sigset | IN, 0 }, { Ptr, 1 }, { Timespec | IN, 2 } } },
|
||||
.args = { { Sigset | IN, 0 }, { Siginfo | OUT, 1 },
|
||||
{ Timespec | IN, 2 } } },
|
||||
{ .name = "sigwait", .ret_type = 1, .nargs = 2,
|
||||
.args = { { Sigset | IN, 0 }, { Ptr, 1 } } },
|
||||
.args = { { Sigset | IN, 0 }, { PSig | OUT, 1 } } },
|
||||
{ .name = "sigwaitinfo", .ret_type = 1, .nargs = 2,
|
||||
.args = { { Sigset | IN, 0 }, { Ptr, 1 } } },
|
||||
.args = { { Sigset | IN, 0 }, { Siginfo | OUT, 1 } } },
|
||||
{ .name = "socket", .ret_type = 1, .nargs = 3,
|
||||
.args = { { Sockdomain, 0 }, { Socktype, 1 }, { Sockprotocol, 2 } } },
|
||||
{ .name = "stat", .ret_type = 1, .nargs = 2,
|
||||
@ -510,7 +511,8 @@ static struct syscall decoded_syscalls[] = {
|
||||
{ Rusage | OUT, 3 } } },
|
||||
{ .name = "wait6", .ret_type = 1, .nargs = 6,
|
||||
.args = { { Idtype, 0 }, { Quad, 1 }, { ExitStatus | OUT, 2 },
|
||||
{ Waitoptions, 3 }, { Rusage | OUT, 4 }, { Ptr, 5 } } },
|
||||
{ Waitoptions, 3 }, { Rusage | OUT, 4 },
|
||||
{ Siginfo | OUT, 5 } } },
|
||||
{ .name = "write", .ret_type = 1, .nargs = 3,
|
||||
.args = { { Int, 0 }, { BinString | IN, 1 }, { Sizet, 2 } } },
|
||||
|
||||
@ -2164,6 +2166,28 @@ print_arg(struct syscall_args *sc, unsigned long *args, long *retval,
|
||||
fprintf(fp, "0x%lx", args[sc->offset]);
|
||||
break;
|
||||
}
|
||||
case PSig: {
|
||||
int sig;
|
||||
|
||||
if (get_struct(pid, (void *)args[sc->offset], &sig,
|
||||
sizeof(sig)) == 0)
|
||||
fprintf(fp, "{ %s }", strsig2(sig));
|
||||
else
|
||||
fprintf(fp, "0x%lx", args[sc->offset]);
|
||||
break;
|
||||
}
|
||||
case Siginfo: {
|
||||
siginfo_t si;
|
||||
|
||||
if (get_struct(pid, (void *)args[sc->offset], &si,
|
||||
sizeof(si)) != -1) {
|
||||
fprintf(fp, "{ signo=%s", strsig2(si.si_signo));
|
||||
decode_siginfo(fp, &si);
|
||||
fprintf(fp, " }");
|
||||
} else
|
||||
fprintf(fp, "0x%lx", args[sc->offset]);
|
||||
break;
|
||||
}
|
||||
|
||||
case CloudABIAdvice:
|
||||
fputs(xlookup(cloudabi_advice, args[sc->offset]), fp);
|
||||
|
Loading…
Reference in New Issue
Block a user