Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Enable build of crash(8) for m86k platforms.
details: https://anonhg.NetBSD.org/src/rev/2157d85d6a54
branches: trunk
changeset: 773357:2157d85d6a54
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Tue Jan 31 21:17:57 2012 +0000
description:
Enable build of crash(8) for m86k platforms.
diffstat:
sys/arch/m68k/include/db_machdep.h | 8 +++-
sys/arch/m68k/m68k/db_disasm.c | 9 +++-
sys/arch/m68k/m68k/db_interface.c | 11 ++++-
sys/arch/m68k/m68k/db_trace.c | 72 +++++++++++++++++--------------------
usr.sbin/crash/Makefile | 12 +++++-
5 files changed, 66 insertions(+), 46 deletions(-)
diffs (truncated from 320 to 300 lines):
diff -r 79583a12db27 -r 2157d85d6a54 sys/arch/m68k/include/db_machdep.h
--- a/sys/arch/m68k/include/db_machdep.h Tue Jan 31 21:12:03 2012 +0000
+++ b/sys/arch/m68k/include/db_machdep.h Tue Jan 31 21:17:57 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.h,v 1.30 2011/05/26 15:34:13 joerg Exp $ */
+/* $NetBSD: db_machdep.h,v 1.31 2012/01/31 21:17:57 mlelstv Exp $ */
/*
* Mach Operating System
@@ -32,6 +32,12 @@
#ifndef _M68K_DB_MACHDEP_H_
#define _M68K_DB_MACHDEP_H_
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+#include <stddef.h>
+#include <stdbool.h>
+#include <string.h>
+#endif /* _KERNEL || _STANDALONE */
+
#include <sys/types.h>
/*
diff -r 79583a12db27 -r 2157d85d6a54 sys/arch/m68k/m68k/db_disasm.c
--- a/sys/arch/m68k/m68k/db_disasm.c Tue Jan 31 21:12:03 2012 +0000
+++ b/sys/arch/m68k/m68k/db_disasm.c Tue Jan 31 21:17:57 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_disasm.c,v 1.38 2007/02/21 22:59:46 thorpej Exp $ */
+/* $NetBSD: db_disasm.c,v 1.39 2012/01/31 21:17:57 mlelstv Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -63,10 +63,12 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.38 2007/02/21 22:59:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.39 2012/01/31 21:17:57 mlelstv Exp $");
#include <sys/param.h>
+#ifdef _KERNEL
#include <sys/systm.h>
+#endif
#include <machine/db_machdep.h>
@@ -168,6 +170,9 @@
static const char *const fpregs[8] = {
"fp0","fp1","fp2","fp3","fp4","fp5","fp6","fp7" };
static const char *const fpcregs[3] = { "fpiar", "fpsr", "fpcr" };
+#ifndef _KERNEL
+static const char hexdigits[] = "0123456789abcdef";
+#endif
/*
* Disassemble intruction at location ``loc''.
diff -r 79583a12db27 -r 2157d85d6a54 sys/arch/m68k/m68k/db_interface.c
--- a/sys/arch/m68k/m68k/db_interface.c Tue Jan 31 21:12:03 2012 +0000
+++ b/sys/arch/m68k/m68k/db_interface.c Tue Jan 31 21:17:57 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.34 2007/02/22 17:09:44 thorpej Exp $ */
+/* $NetBSD: db_interface.c,v 1.35 2012/01/31 21:17:57 mlelstv Exp $ */
/*
* Mach Operating System
@@ -31,9 +31,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.34 2007/02/22 17:09:44 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.35 2012/01/31 21:17:57 mlelstv Exp $");
+#ifdef _KERNEL_OPT
#include "opt_ddb.h"
+#endif
#include <sys/param.h>
#include <sys/proc.h>
@@ -49,12 +51,14 @@
#include <ddb/db_command.h>
#include <ddb/db_sym.h>
+#ifdef _KERNEL
#include <ddb/db_extern.h>
-
+#endif
int db_active = 0;
db_regs_t ddb_regs;
+#ifdef _KERNEL
static void kdbprinttrap(int, int);
/*
@@ -155,3 +159,4 @@
__asm ("trap #15");
}
+#endif
diff -r 79583a12db27 -r 2157d85d6a54 sys/arch/m68k/m68k/db_trace.c
--- a/sys/arch/m68k/m68k/db_trace.c Tue Jan 31 21:12:03 2012 +0000
+++ b/sys/arch/m68k/m68k/db_trace.c Tue Jan 31 21:17:57 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.56 2010/07/01 02:38:27 rmind Exp $ */
+/* $NetBSD: db_trace.c,v 1.57 2012/01/31 21:17:57 mlelstv Exp $ */
/*
* Mach Operating System
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.56 2010/07/01 02:38:27 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.57 2012/01/31 21:17:57 mlelstv Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -39,7 +39,6 @@
#include <ddb/db_output.h>
#include <ddb/db_access.h>
#include <ddb/db_sym.h>
-#include <ddb/db_extern.h>
#include <ddb/db_variables.h>
/*
@@ -49,26 +48,26 @@
const struct db_variable db_regs[] = {
/* D0-D7 */
- { "d0", (long *)&ddb_regs.tf_regs[0], FCN_NULL },
- { "d1", (long *)&ddb_regs.tf_regs[1], FCN_NULL },
- { "d2", (long *)&ddb_regs.tf_regs[2], FCN_NULL },
- { "d3", (long *)&ddb_regs.tf_regs[3], FCN_NULL },
- { "d4", (long *)&ddb_regs.tf_regs[4], FCN_NULL },
- { "d5", (long *)&ddb_regs.tf_regs[5], FCN_NULL },
- { "d6", (long *)&ddb_regs.tf_regs[6], FCN_NULL },
- { "d7", (long *)&ddb_regs.tf_regs[7], FCN_NULL },
+ { "d0", (long *)&ddb_regs.tf_regs[0], FCN_NULL, NULL },
+ { "d1", (long *)&ddb_regs.tf_regs[1], FCN_NULL, NULL },
+ { "d2", (long *)&ddb_regs.tf_regs[2], FCN_NULL, NULL },
+ { "d3", (long *)&ddb_regs.tf_regs[3], FCN_NULL, NULL },
+ { "d4", (long *)&ddb_regs.tf_regs[4], FCN_NULL, NULL },
+ { "d5", (long *)&ddb_regs.tf_regs[5], FCN_NULL, NULL },
+ { "d6", (long *)&ddb_regs.tf_regs[6], FCN_NULL, NULL },
+ { "d7", (long *)&ddb_regs.tf_regs[7], FCN_NULL, NULL },
/* A0-A7 */
- { "a0", (long *)&ddb_regs.tf_regs[8+0], FCN_NULL },
- { "a1", (long *)&ddb_regs.tf_regs[8+1], FCN_NULL },
- { "a2", (long *)&ddb_regs.tf_regs[8+2], FCN_NULL },
- { "a3", (long *)&ddb_regs.tf_regs[8+3], FCN_NULL },
- { "a4", (long *)&ddb_regs.tf_regs[8+4], FCN_NULL },
- { "a5", (long *)&ddb_regs.tf_regs[8+5], FCN_NULL },
- { "a6", (long *)&ddb_regs.tf_regs[8+6], FCN_NULL },
- { "sp", (long *)&ddb_regs.tf_regs[8+7], FCN_NULL },
+ { "a0", (long *)&ddb_regs.tf_regs[8+0], FCN_NULL, NULL },
+ { "a1", (long *)&ddb_regs.tf_regs[8+1], FCN_NULL, NULL },
+ { "a2", (long *)&ddb_regs.tf_regs[8+2], FCN_NULL, NULL },
+ { "a3", (long *)&ddb_regs.tf_regs[8+3], FCN_NULL, NULL },
+ { "a4", (long *)&ddb_regs.tf_regs[8+4], FCN_NULL, NULL },
+ { "a5", (long *)&ddb_regs.tf_regs[8+5], FCN_NULL, NULL },
+ { "a6", (long *)&ddb_regs.tf_regs[8+6], FCN_NULL, NULL },
+ { "sp", (long *)&ddb_regs.tf_regs[8+7], FCN_NULL, NULL },
/* misc. */
- { "pc", (long *)&ddb_regs.tf_pc, FCN_NULL },
- { "sr", (long *)&ddb_regs.tf_sr, db_var_short }
+ { "pc", (long *)&ddb_regs.tf_pc, FCN_NULL, NULL },
+ { "sr", (long *)&ddb_regs.tf_sr, db_var_short, NULL }
};
const struct db_variable * const db_eregs =
db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
@@ -107,9 +106,11 @@
};
static void findentry(struct stackpos *, void (*)(const char *, ...));
+#ifdef _KERNEL
static void findregs(struct stackpos *, db_addr_t);
static int nextframe(struct stackpos *, struct pcb *, int,
void (*)(const char *, ...));
+#endif
static void stacktop(db_regs_t *, struct stackpos *,
void (*)(const char *, ...));
@@ -174,6 +175,7 @@
static struct nlist * funcsym = 0;
#endif
+#ifdef _KERNEL
static int
nextframe(struct stackpos *sp, struct pcb *pcb, int kerneltrace,
void (*pr)(const char *, ...))
@@ -222,10 +224,11 @@
} else
findentry(sp, pr);
- if (sp->k_fp == 0 || oldfp == sp->k_fp)
+ if (sp->k_fp == 0 || oldfp == (db_addr_t)sp->k_fp)
return 0;
return sp->k_fp;
}
+#endif
static void
findentry(struct stackpos *sp, void (*pr)(const char *, ...))
@@ -239,19 +242,6 @@
int instruc;
int val;
db_addr_t addr, nextword;
- label_t db_jmpbuf;
- label_t *savejmp;
-
- savejmp = db_recover;
- db_recover = &db_jmpbuf;
- if (setjmp(&db_jmpbuf)) {
- /* oops -- we touched something we ought not to have */
- /* cannot trace caller of "start" */
- sp->k_entry = MAXINT;
- sp->k_nargs = 0;
- db_recover = savejmp;
- return;
- }
addr = get(sp->k_fp + FR_SAVPC, DSP);
if (addr == 0) {
@@ -259,14 +249,11 @@
/* cannot trace caller of "start" */
sp->k_entry = MAXINT;
sp->k_nargs = 0;
- db_recover = savejmp;
return;
}
instruc = get(addr - 6, ISP);
nextword = get(addr - 4, ISP);
- db_recover = savejmp;
-
if ((instruc & HIWORD) == (JSR | LONGBIT)) {
/* longword offset here */
sp->k_caller = addr - 6;
@@ -328,6 +315,7 @@
sp->k_nargs = val / 4;
}
+#ifdef _KERNEL
/*
* Look at the procedure prolog of the current called procedure.
* Figure out which registers we saved, and where they are
@@ -390,6 +378,7 @@
}
/* else no registers saved */
}
+#endif
/*
* Frame tracing.
@@ -436,6 +425,7 @@
(*pr)("trace: pid %d ", p->p_pid);
} else {
(*pr)("trace: pid %d ", (int)addr);
+#ifdef _KERNEL
p = proc_find_raw(addr);
if (p == NULL) {
(*pr)("not found\n");
@@ -443,6 +433,10 @@
}
l = LIST_FIRST(&p->p_lwps);
KASSERT(l != NULL);
+#else
+ (*pr)("no proc_find_raw() in crash\n");
+ return;
+#endif
}
(*pr)("lid %d ", l->l_lid);
pcb = lwp_getpcb(l);
@@ -550,6 +544,7 @@
else
(*pr)(") + %lx\n", val);
+#if _KERNEL
/*
* Stop tracing if frame ptr no longer points into kernel
* stack.
@@ -559,5 +554,6 @@
break;
if (nextframe(&pos, pcb, kernel_only, pr) == 0)
break;
+#endif
}
}
diff -r 79583a12db27 -r 2157d85d6a54 usr.sbin/crash/Makefile
--- a/usr.sbin/crash/Makefile Tue Jan 31 21:12:03 2012 +0000
+++ b/usr.sbin/crash/Makefile Tue Jan 31 21:17:57 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.15 2012/01/18 09:35:48 skrll Exp $
+# $NetBSD: Makefile,v 1.16 2012/01/31 21:17:57 mlelstv Exp $
PROG= crash
MAN= crash.8
@@ -14,7 +14,8 @@
.if ${MACHINE} == "amd64" \
|| ${MACHINE} == "hp700" \
|| ${MACHINE} == "i386" \
Home |
Main Index |
Thread Index |
Old Index