To: None <firstname.lastname@example.org>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
Date: 11/05/1994 06:25:41
Sun has a PTRACE_SYSCALL option to ptrace(2), which allows stopping a
process on occurrence of a syscall.
NetBSD doesn't. I wanted it for syscall tracing - ktrace is nice, but
it doesn't permit inspection of what pointer arguments point to, or any
sort of tweaking of anything. (The NAMI tracing helps, but there are
plenty of non-pathname pointer arguments, and some pathname pointer
arguments don't get passed to namei (eg, symlink()).)
I have added PT_SYSCALL to NetBSD/sparc. It seems to basically work; I
need to test it more thoroughly, but it is close enough I no longer
have any doubt I can get it fully working. (It is more functional than
What should I do with the code? Would anyone be interested in it once
I get it cleaned up? Has this already been done but not put into the
release sources? The changes are fairly small; I had to touch
kern/sys_process.c (for ptrace()) and arch/sparc/sparc/trap.c (for
syscall()). I added PT_SYSCALL to sys/ptrace.h, though the cleanup
will among other things move it to arch/sparc/include/ptrace.h instead.
I grew the mdproc struct in arch/sparc/include/proc.h, for the sake of
a convenient place for user-land to find the syscall stuff with
PT_READ_U and modify it with PT_WRITE_U; I also had to tweak the
PT_WRITE_U code slightly to make this work.
Comments, requests, flames, suggestions, etc welcome.