Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/ktruss Catch up in ktruss(1) with ptrace descriptive...
details: https://anonhg.NetBSD.org/src/rev/67975e798796
branches: trunk
changeset: 1006416:67975e798796
user: kamil <kamil%NetBSD.org@localhost>
date: Tue Jan 14 11:28:35 2020 +0000
description:
Catch up in ktruss(1) with ptrace descriptive operation names
Switch to dynamic string lists PT_STRINGS and PT_MACHDEP_STRINGS.
Reuse the code and approach from kdump(1).
diffstat:
usr.bin/ktruss/dump.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diffs (51 lines):
diff -r bc27b67078be -r 67975e798796 usr.bin/ktruss/dump.c
--- a/usr.bin/ktruss/dump.c Tue Jan 14 09:49:26 2020 +0000
+++ b/usr.bin/ktruss/dump.c Tue Jan 14 11:28:35 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dump.c,v 1.46 2020/01/04 22:22:34 mlelstv Exp $ */
+/* $NetBSD: dump.c,v 1.47 2020/01/14 11:28:35 kamil Exp $ */
/*-
* Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)kdump.c 8.4 (Berkeley) 4/28/95";
#endif
-__RCSID("$NetBSD: dump.c,v 1.46 2020/01/04 22:22:34 mlelstv Exp $");
+__RCSID("$NetBSD: dump.c,v 1.47 2020/01/14 11:28:35 kamil Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -74,11 +74,13 @@
#include <sys/syscall.h>
static const char *const 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_ATTACH", "PT_DETACH",
+ PT_STRINGS
};
+#ifdef PT_MACHDEP_STRINGS
+static const char * const ptrace_machdep_ops[] = { PT_MACHDEP_STRINGS };
+#endif
+
struct ktr_entry {
TAILQ_ENTRY(ktr_entry) kte_list;
struct ktr_header kte_kth;
@@ -578,8 +580,14 @@
case SYS_ptrace :
if ((long)*ap >= 0 &&
- *ap < (register_t)(sizeof(ptrace_ops) / sizeof(ptrace_ops[0])))
+ *ap < (register_t)__arraycount(ptrace_ops))
xwprintf("(%s", ptrace_ops[*ap]);
+#ifdef PT_MACHDEP_STRINGS
+ else if (*ap >= PT_FIRSTMACH &&
+ *ap - PT_FIRSTMACH < (register_t)
+ __arraycount(ptrace_machdep_ops))
+ xwprintf("(%s", ptrace_machdep_ops[*ap - PT_FIRSTMACH]);
+#endif
else
xwprintf("(%ld", (long)*ap);
ap++;
Home |
Main Index |
Thread Index |
Old Index