Allow kdump to print the names for machine dependent ptrace ops.

(This requires <machine/ptrace.h> to define PT_MACHDEP_STRINGS
which corresponds to the machdep ops).
This commit is contained in:
matt 2004-05-06 22:51:38 +00:00
parent fba1aa540d
commit 10efbfd5c3
1 changed files with 17 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kdump.c,v 1.77 2004/03/07 17:20:53 dsl Exp $ */
/* $NetBSD: kdump.c,v 1.78 2004/05/06 22:51:38 matt Exp $ */
/*-
* Copyright (c) 1988, 1993
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1993\n\
#if 0
static char sccsid[] = "@(#)kdump.c 8.4 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: kdump.c,v 1.77 2004/03/07 17:20:53 dsl Exp $");
__RCSID("$NetBSD: kdump.c,v 1.78 2004/05/06 22:51:38 matt Exp $");
#endif
#endif /* not lint */
@ -78,13 +78,18 @@ int emul_changed = 0;
#define eqs(s1, s2) (strcmp((s1), (s2)) == 0)
#define small(v) (((long)(v) >= 0) && ((long)(v) < 10))
static const char *ptrace_ops[] = {
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_KILL", "PT_ATTACH", "PT_DETACH", "PT_IO",
"PT_DUMPCORE", "PT_LWPINFO"
};
static const char *linux_ptrace_ops[] = {
#ifdef PT_MACHDEP_STRINGS
static const char * const ptrace_machdep_ops[] = { PT_MACHDEP_STRINGS };
#endif
static const char * const linux_ptrace_ops[] = {
"PTRACE_TRACEME",
"PTRACE_PEEKTEXT", "PTRACE_PEEKDATA", "PTRACE_PEEKUSER",
"PTRACE_POKETEXT", "PTRACE_POKEDATA", "PTRACE_POKEUSER",
@ -474,6 +479,13 @@ ktrsyscall(ktr)
if (*ap >= 0 && *ap <
sizeof(ptrace_ops) / sizeof(ptrace_ops[0]))
(void)printf("%s", ptrace_ops[*ap]);
#ifdef PT_MACHDEP_STRINGS
else if (*ap >= PT_FIRSTMACH &&
*ap - PT_FIRSTMACH <
sizeof(ptrace_machdep_ops) /
sizeof(ptrace_machdep_ops[0]))
(void)printf("%s", ptrace_machdep_ops[*ap - PT_FIRSTMACH]);
#endif
else
output_long((long)*ap, 1);
}