add kprobes provider for dt
authorjasper <jasper@openbsd.org>
Fri, 3 Sep 2021 16:45:44 +0000 (16:45 +0000)
committerjasper <jasper@openbsd.org>
Fri, 3 Sep 2021 16:45:44 +0000 (16:45 +0000)
commit840df46fd94f20eb816a52fce31f3e76ee2f59fc
tree9cd6298d09df543689165e88b9f62e09f373c1dc
parente4c12d7a863e1916b1a171487174679e25ab965c
add kprobes provider for dt

this allows us to dynamically trace function boundaries with btrace by patching
prologues and epilogues with a breakpoint upon which the handler records the data,
sends it back to userland for btrace to consume.
currently it's hidden behind DDBPROF, and there is still a lot to cleanup and
improve, but basic scripts that observe return codes from a probed function
work.

from Tom Rollet, with various changes by me
feedback and ok mpi@
12 files changed:
sys/arch/amd64/amd64/vector.S
sys/arch/i386/i386/locore.s
sys/conf/files
sys/ddb/db_prof.c
sys/dev/dt/dt_dev.c
sys/dev/dt/dt_prov_kprobe.c [new file with mode: 0644]
sys/dev/dt/dt_prov_profile.c
sys/dev/dt/dt_prov_static.c
sys/dev/dt/dt_prov_syscall.c
sys/dev/dt/dtvar.h
sys/kern/subr_prof.c
usr.sbin/btrace/btrace.c