From 24be4e62489f3acfaeef8406b50a275a34b77a1f Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Mon, 9 Apr 2007 19:16:24 +0000 Subject: [PATCH] Remove static ptrace_ops array and extract ptrace op names from sys/ptrace.h with mksubr. --- usr.bin/kdump/kdump.c | 38 ++------------------------------------ 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 24979d9c299..508eb5c3bcb 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -57,7 +57,6 @@ extern int errno; #include #include #include -#include #include #include #include @@ -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 4231aab48be..22db1253062 100644 --- a/usr.bin/kdump/mksubr +++ b/usr.bin/kdump/mksubr @@ -141,6 +141,7 @@ cat <<_EOF_ #include #include #include +#include #include #include #include @@ -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_ /*