diff options
author | emaste <emaste@FreeBSD.org> | 2007-04-09 19:16:24 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2007-04-09 19:16:24 +0000 |
commit | 41417ac6faed26514e046221d4c9760c90d85bbc (patch) | |
tree | b2f43cd1d9d733f705b126c30a15ebb78c6773fb /usr.bin | |
parent | d695cc22453463b168bc6a56a409a53dd7e31362 (diff) | |
download | FreeBSD-src-41417ac6faed26514e046221d4c9760c90d85bbc.zip FreeBSD-src-41417ac6faed26514e046221d4c9760c90d85bbc.tar.gz |
Remove static ptrace_ops array and extract ptrace op names from
sys/ptrace.h with mksubr.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/kdump/kdump.c | 38 | ||||
-rw-r--r-- | usr.bin/kdump/mksubr | 2 |
2 files changed, 4 insertions, 36 deletions
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index 24979d9..508eb5c 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -57,7 +57,6 @@ extern int errno; #include <sys/uio.h> #include <sys/ktrace.h> #include <sys/ioctl.h> -#include <sys/ptrace.h> #include <sys/socket.h> #include <dlfcn.h> #include <err.h> @@ -303,12 +302,6 @@ dumpheader(struct ktr_header *kth) #undef KTRACE int nsyscalls = sizeof (syscallnames) / sizeof (syscallnames[0]); -static const char *ptrace_ops[] = { - "PT_TRACE_ME", "PT_READ_I", "PT_READ_D", "PT_READ_U", - "PT_WRITE_I", "PT_WRITE_D", "PT_WRITE_U", "PT_CONTINUE", - "PT_KILL", "PT_STEP", "PT_ATTACH", "PT_DETACH", -}; - void ktrsyscall(struct ktr_syscall *ktr) { @@ -349,35 +342,8 @@ ktrsyscall(struct ktr_syscall *ktr) ip++; narg--; } else if (ktr->ktr_code == SYS_ptrace) { - if ((size_t)*ip < sizeof(ptrace_ops) / - sizeof(ptrace_ops[0]) && *ip >= 0) - (void)printf("(%s", ptrace_ops[*ip]); -#ifdef PT_GETREGS - else if (*ip == PT_GETREGS) - (void)printf("(%s", "PT_GETREGS"); -#endif -#ifdef PT_SETREGS - else if (*ip == PT_SETREGS) - (void)printf("(%s", "PT_SETREGS"); -#endif -#ifdef PT_GETFPREGS - else if (*ip == PT_GETFPREGS) - (void)printf("(%s", "PT_GETFPREGS"); -#endif -#ifdef PT_SETFPREGS - else if (*ip == PT_SETFPREGS) - (void)printf("(%s", "PT_SETFPREGS"); -#endif -#ifdef PT_GETDBREGS - else if (*ip == PT_GETDBREGS) - (void)printf("(%s", "PT_GETDBREGS"); -#endif -#ifdef PT_SETDBREGS - else if (*ip == PT_SETDBREGS) - (void)printf("(%s", "PT_SETDBREGS"); -#endif - else - (void)printf("(%ld", (long)*ip); + (void)putchar('('); + ptraceopname ((int)*ip); c = ','; ip++; narg--; diff --git a/usr.bin/kdump/mksubr b/usr.bin/kdump/mksubr index 4231aab..22db1253 100644 --- a/usr.bin/kdump/mksubr +++ b/usr.bin/kdump/mksubr @@ -141,6 +141,7 @@ cat <<_EOF_ #include <netinet/in.h> #include <sys/param.h> #include <sys/mount.h> +#include <sys/ptrace.h> #include <sys/resource.h> #include <sys/reboot.h> #include <sched.h> @@ -339,6 +340,7 @@ auto_if_type "sockdomainname" "PF_[[:alnum:]]+[[:space:]]+" "sys/socket.h" auto_if_type "sockipprotoname" "IPPROTO_[[:alnum:]]+[[:space:]]+" "netinet/in.h" auto_switch_type "sockoptname" "SO_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h" auto_switch_type "socktypename" "SOCK_[A-Z]+[[:space:]]+[1-9]+[0-9]*" "sys/socket.h" +auto_switch_type "ptraceopname" "PT_[[:alnum:]]+[[:space:]]+[0-9]+" "sys/ptrace.h" cat <<_EOF_ /* |