cadets / freebsd-old

FreeBSD src tree http://www.FreeBSD.org/
Other
12 stars 7 forks source link

Can not use typed args[x] in script #154

Open lc525 opened 2 years ago

lc525 commented 2 years ago

Using args[x] triggers an error that looks like this:

failed to infer a type for 1
dtrace: failed to infer a type for 1

The minimal script triggering this is:

nfssrv:nfs3:read:done
{
  printf("%d", args[3]);
}

here, args[3] is a simple uint32_t

Output of running the script above with -Ses:

DIFO 0x801c554a0 returns D type (integer) (size 4)
OFF OPCODE      INSTRUCTION
00: 25000001    setx DT_INTEGER[0], %r1         ! 0x5
01: 28000101    ldga DT_VAR(0), %r1, %r1
02: 25000102    setx DT_INTEGER[1], %r2         ! 0x20
03: 04010201    sll  %r1, %r2, %r1
04: 2e010201    sra  %r1, %r2, %r1
05: 23000001    ret  %r1