kdump/truss: decode new _umtx_op flags
In both cases, print the flag bits first followed by the command. Output now looks something like this: (ktrace) _umtx_op(0x8605f7008,0xf<UMTX_OP_WAIT_UINT_PRIVATE>,0,0,0) _umtx_op(0x9fffdce8,0x80000003<UMTX_OP__32BIT|UMTX_OP_WAKE>,0x1,0,0) (truss) _umtx_op(0x7fffffffda50,UMTX_OP_WAKE,0x1,0x0,0x0) = 0 (0x0) _umtx_op(0x9fffdd08,UMTX_OP__32BIT|UMTX_OP_WAKE,0x1,0x0,0x0) = 0 (0x0) Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D27325
This commit is contained in:
parent
3b27074b25
commit
c2679dd779
@ -254,14 +254,21 @@ print_integer_arg_valid(const char *(*decoder)(int), int value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
print_mask_arg_part(bool (*decoder)(FILE *, int, int *), int value, int *rem)
|
||||||
|
{
|
||||||
|
|
||||||
|
printf("%#x<", value);
|
||||||
|
return (decoder(stdout, value, rem));
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_mask_arg(bool (*decoder)(FILE *, int, int *), int value)
|
print_mask_arg(bool (*decoder)(FILE *, int, int *), int value)
|
||||||
{
|
{
|
||||||
bool invalid;
|
bool invalid;
|
||||||
int rem;
|
int rem;
|
||||||
|
|
||||||
printf("%#x<", value);
|
invalid = !print_mask_arg_part(decoder, value, &rem);
|
||||||
invalid = !decoder(stdout, value, &rem);
|
|
||||||
printf(">");
|
printf(">");
|
||||||
if (invalid)
|
if (invalid)
|
||||||
printf("<invalid>%u", rem);
|
printf("<invalid>%u", rem);
|
||||||
@ -1455,10 +1462,16 @@ ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags)
|
|||||||
ip++;
|
ip++;
|
||||||
narg--;
|
narg--;
|
||||||
break;
|
break;
|
||||||
case SYS__umtx_op:
|
case SYS__umtx_op: {
|
||||||
|
int op;
|
||||||
|
|
||||||
print_number(ip, narg, c);
|
print_number(ip, narg, c);
|
||||||
putchar(',');
|
putchar(',');
|
||||||
print_integer_arg(sysdecode_umtx_op, *ip);
|
if (print_mask_arg_part(sysdecode_umtx_op_flags,
|
||||||
|
*ip, &op))
|
||||||
|
putchar('|');
|
||||||
|
print_integer_arg(sysdecode_umtx_op, op);
|
||||||
|
putchar('>');
|
||||||
switch (*ip) {
|
switch (*ip) {
|
||||||
case UMTX_OP_CV_WAIT:
|
case UMTX_OP_CV_WAIT:
|
||||||
ip++;
|
ip++;
|
||||||
@ -1478,6 +1491,7 @@ ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags)
|
|||||||
ip++;
|
ip++;
|
||||||
narg--;
|
narg--;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case SYS_ftruncate:
|
case SYS_ftruncate:
|
||||||
case SYS_truncate:
|
case SYS_truncate:
|
||||||
print_number(ip, narg, c);
|
print_number(ip, narg, c);
|
||||||
|
@ -888,12 +888,20 @@ print_integer_arg(const char *(*decoder)(int), FILE *fp, int value)
|
|||||||
fprintf(fp, "%d", value);
|
fprintf(fp, "%d", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
print_mask_arg_part(bool (*decoder)(FILE *, int, int *), FILE *fp, int value,
|
||||||
|
int *rem)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (decoder(fp, value, rem));
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_mask_arg(bool (*decoder)(FILE *, int, int *), FILE *fp, int value)
|
print_mask_arg(bool (*decoder)(FILE *, int, int *), FILE *fp, int value)
|
||||||
{
|
{
|
||||||
int rem;
|
int rem;
|
||||||
|
|
||||||
if (!decoder(fp, value, &rem))
|
if (!print_mask_arg_part(decoder, fp, value, &rem))
|
||||||
fprintf(fp, "0x%x", rem);
|
fprintf(fp, "0x%x", rem);
|
||||||
else if (rem != 0)
|
else if (rem != 0)
|
||||||
fprintf(fp, "|0x%x", rem);
|
fprintf(fp, "|0x%x", rem);
|
||||||
@ -2303,9 +2311,15 @@ print_arg(struct syscall_args *sc, unsigned long *args, register_t *retval,
|
|||||||
case Procctl:
|
case Procctl:
|
||||||
print_integer_arg(sysdecode_procctl_cmd, fp, args[sc->offset]);
|
print_integer_arg(sysdecode_procctl_cmd, fp, args[sc->offset]);
|
||||||
break;
|
break;
|
||||||
case Umtxop:
|
case Umtxop: {
|
||||||
print_integer_arg(sysdecode_umtx_op, fp, args[sc->offset]);
|
int rem;
|
||||||
|
|
||||||
|
if (print_mask_arg_part(sysdecode_umtx_op_flags, fp,
|
||||||
|
args[sc->offset], &rem))
|
||||||
|
fprintf(fp, "|");
|
||||||
|
print_integer_arg(sysdecode_umtx_op, fp, rem);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case Atfd:
|
case Atfd:
|
||||||
print_integer_arg(sysdecode_atfd, fp, args[sc->offset]);
|
print_integer_arg(sysdecode_atfd, fp, args[sc->offset]);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user