Page MenuHomeFreeBSD

dtrace: Add a "regs" variable
ClosedPublic

Authored by markj on Sep 29 2022, 5:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Mar 11, 10:34 AM
Unknown Object (File)
Sat, Mar 9, 3:55 AM
Unknown Object (File)
Sat, Mar 9, 3:55 AM
Unknown Object (File)
Fri, Mar 8, 12:21 AM
Unknown Object (File)
Jan 12 2024, 2:30 PM
Unknown Object (File)
Jan 3 2024, 10:59 PM
Unknown Object (File)
Jan 3 2024, 10:47 PM
Unknown Object (File)
Nov 22 2023, 12:03 PM
Subscribers

Details

Summary

This allows invop-based providers (i.e., fbt and kinst) to expose the
register file of the CPU at the point where the probe fired. It does
not work for SDT providers because their probes are implemented as plain
function calls and so don't save registers. It's not clear what
semantics "regs" should have for them anyway.

This is akin to "uregs", which nominally provides access to the
userspace registers. In fact, DIF already had a DIF_VAR_REGS variable
defined, it was simply unimplemented.

Usage example: print the contents of %rdi upon each call to
amd64_syscall():

fbt::amd64_syscall:entry {printf("%x", regs[R_RDI]);}

Note that the R_* constants are defined in /usr/lib/dtrace/regs_x86.d.
Currently there are no similar definitions for non-x86 platforms.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 47613
Build 44500: arc lint + arc unit