CVS commit: src/usr.sbin/crash

2024-04-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 26 22:07:32 UTC 2024

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Add ${TOOL_DATE} (Jan-Benedict Glaw)


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.50 src/usr.sbin/crash/Makefile:1.51
--- src/usr.sbin/crash/Makefile:1.50	Tue Nov 21 21:01:07 2023
+++ src/usr.sbin/crash/Makefile	Fri Apr 26 18:07:32 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.50 2023/11/22 02:01:07 thorpej Exp $
+#	$NetBSD: Makefile,v 1.51 2024/04/26 22:07:32 christos Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -119,7 +119,7 @@ NVFLAGS+=-R
 # vers.c
 SRCS+=	vers.c
 vers.c:	${S}/conf/newvers.sh ${_NETBSD_VERSION_DEPENDS}
-	${HOST_SH} ${S}/conf/newvers.sh ${NVFLAGS} -n -m ${MACHINE} -i CRASH
+	TOOL_DATE=${TOOL_DATE} ${HOST_SH} ${S}/conf/newvers.sh ${NVFLAGS} -n -m ${MACHINE} -i CRASH
 CLEANFILES+=	vers.c version
 
 .else# } {



CVS commit: src/usr.sbin/crash

2024-04-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 26 22:07:32 UTC 2024

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Add ${TOOL_DATE} (Jan-Benedict Glaw)


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2024-01-13 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sun Jan 14 00:40:21 UTC 2024

Modified Files:
src/usr.sbin/crash: crash.8

Log Message:
crash.8: add xref to savecore(8)


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/crash/crash.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/crash.8
diff -u src/usr.sbin/crash/crash.8:1.8 src/usr.sbin/crash/crash.8:1.9
--- src/usr.sbin/crash/crash.8:1.8	Sat Mar 23 02:07:32 2019
+++ src/usr.sbin/crash/crash.8	Sun Jan 14 00:40:21 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: crash.8,v 1.8 2019/03/23 02:07:32 mrg Exp $
+.\"	$NetBSD: crash.8,v 1.9 2024/01/14 00:40:21 gutteridge Exp $
 .\"
 .\" Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd March 22, 2019
+.Dd January 14, 2024
 .Dt CRASH 8
 .Os
 .Sh NAME
@@ -94,7 +94,8 @@ like the following:
 .Xr ps 1 ,
 .Xr vmstat 1 ,
 .Xr ddb 4 ,
-.Xr pstat 8
+.Xr pstat 8 ,
+.Xr savecore 8
 .Sh HISTORY
 The
 .Nm



CVS commit: src/usr.sbin/crash

2024-01-13 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sun Jan 14 00:40:21 UTC 2024

Modified Files:
src/usr.sbin/crash: crash.8

Log Message:
crash.8: add xref to savecore(8)


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/crash/crash.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 14:00:47 UTC 2023

Modified Files:
src/usr.sbin/crash: crash.c

Log Message:
Implement cngetc, don't abort.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/crash/crash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/crash.c
diff -u src/usr.sbin/crash/crash.c:1.15 src/usr.sbin/crash/crash.c:1.16
--- src/usr.sbin/crash/crash.c:1.15	Wed Apr 12 17:53:32 2023
+++ src/usr.sbin/crash/crash.c	Mon Dec 11 14:00:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: crash.c,v 1.15 2023/04/12 17:53:32 riastradh Exp $	*/
+/*	$NetBSD: crash.c,v 1.16 2023/12/11 14:00:47 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: crash.c,v 1.15 2023/04/12 17:53:32 riastradh Exp $");
+__RCSID("$NetBSD: crash.c,v 1.16 2023/12/11 14:00:47 mlelstv Exp $");
 #endif /* not lint */
 
 #include 
@@ -94,7 +94,6 @@ void lockdebug_lock_print(void) {
 }
 #endif
 
-
 static void
 cleanup(void)
 {
@@ -309,9 +308,11 @@ db_check_interrupt(void)
 int
 cngetc(void)
 {
+	char ch;
 
-	fprintf(stderr, "cngetc\n");
-	abort();
+	if (el_getc(elptr, ) <= 0)
+		return 0;
+	return (unsigned char)ch;
 }
 
 void



CVS commit: src/usr.sbin/crash

2023-12-11 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Dec 11 14:00:47 UTC 2023

Modified Files:
src/usr.sbin/crash: crash.c

Log Message:
Implement cngetc, don't abort.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/crash/crash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Nov 22 02:01:07 UTC 2023

Modified Files:
src/usr.sbin/crash: Makefile
Added Files:
src/usr.sbin/crash/arch: alpha.c

Log Message:
Add Alpha glue for crash(8).


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/usr.sbin/crash/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.sbin/crash/arch/alpha.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.49 src/usr.sbin/crash/Makefile:1.50
--- src/usr.sbin/crash/Makefile:1.49	Sun Jul  9 17:10:47 2023
+++ src/usr.sbin/crash/Makefile	Wed Nov 22 02:01:07 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.49 2023/07/09 17:10:47 riastradh Exp $
+#	$NetBSD: Makefile,v 1.50 2023/11/22 02:01:07 thorpej Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -21,11 +21,14 @@ DPADD+=	${LIBUTIL} ${LIBKVM} ${LIBEDIT} 
 || ${MACHINE_CPU} == "arm" \
 || ${MACHINE_CPU} == "aarch64" \
 || ${MACHINE_CPU} == "mips" \
+|| ${MACHINE_ARCH} == "alpha" \
 || ${MACHINE_ARCH} == "m68k" \
 || ${MACHINE_ARCH} == "powerpc" \
 || ${MACHINE_ARCH} == "powerpc64"
 SRCS+=	db_trace.c
-.if ${MACHINE_CPU} == "mips"
+.if ${MACHINE_ARCH} == "alpha"
+SRCS+=	db_interface.c
+.elif ${MACHINE_CPU} == "mips"
 SRCS+=	db_interface.c mips_stacktrace.c
 CPPFLAGS+=	-DDDB
 .elif ${MACHINE_ARCH} != "m68k" \

Added files:

Index: src/usr.sbin/crash/arch/alpha.c
diff -u /dev/null src/usr.sbin/crash/arch/alpha.c:1.1
--- /dev/null	Wed Nov 22 02:01:07 2023
+++ src/usr.sbin/crash/arch/alpha.c	Wed Nov 22 02:01:07 2023
@@ -0,0 +1,72 @@
+/*	$NetBSD: alpha.c,v 1.1 2023/11/22 02:01:07 thorpej Exp $	*/
+
+/*-
+ * Copyright (c) 2023 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+#ifndef lint
+__RCSID("$NetBSD: alpha.c,v 1.1 2023/11/22 02:01:07 thorpej Exp $");
+#endif /* not lint */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+#include "extern.h"
+
+struct pcb	pcb;
+struct trapframe ddb_regs;
+
+extern db_alpha_nlist db_alpha_nl[];
+
+void
+db_mach_init(kvm_t *kd)
+{
+
+	if (kvm_nlist(kd, db_alpha_nl) == -1) {
+		errx(EXIT_FAILURE, "kvm_nlist: %s", kvm_geterr(kd));
+	}
+	if ((size_t)kvm_read(kd, db_alpha_nl[SYM_dumppcb].n_value,
+			 , sizeof(pcb)) != sizeof(pcb)) {
+		warnx("cannot read dumppcb: %s", kvm_geterr(kd));
+	}
+
+	memcpy(_regs.tf_regs[FRAME_S0],
+	_context[0], 7 * sizeof(unsigned long));
+	ddb_regs.tf_regs[FRAME_RA] = pcb.pcb_context[7];
+	ddb_regs.tf_regs[FRAME_SP] = pcb.pcb_hw.apcb_ksp;
+	ddb_regp = _regs;
+}



CVS commit: src/usr.sbin/crash

2023-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Nov 22 02:01:07 UTC 2023

Modified Files:
src/usr.sbin/crash: Makefile
Added Files:
src/usr.sbin/crash/arch: alpha.c

Log Message:
Add Alpha glue for crash(8).


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/usr.sbin/crash/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.sbin/crash/arch/alpha.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2020-03-26 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri Mar 27 00:17:08 UTC 2020

Modified Files:
src/usr.sbin/crash: crash.c

Log Message:
No need for warnx() if !LOCKDEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/crash/crash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2020-03-26 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri Mar 27 00:17:08 UTC 2020

Modified Files:
src/usr.sbin/crash: crash.c

Log Message:
No need for warnx() if !LOCKDEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/crash/crash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/crash.c
diff -u src/usr.sbin/crash/crash.c:1.12 src/usr.sbin/crash/crash.c:1.13
--- src/usr.sbin/crash/crash.c:1.12	Mon Mar  9 01:54:31 2020
+++ src/usr.sbin/crash/crash.c	Fri Mar 27 00:17:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: crash.c,v 1.12 2020/03/09 01:54:31 christos Exp $	*/
+/*	$NetBSD: crash.c,v 1.13 2020/03/27 00:17:08 ad Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: crash.c,v 1.12 2020/03/09 01:54:31 christos Exp $");
+__RCSID("$NetBSD: crash.c,v 1.13 2020/03/27 00:17:08 ad Exp $");
 #endif /* not lint */
 
 #include 
@@ -427,17 +427,16 @@ main(int argc, char **argv)
 		errx(EXIT_FAILURE, "cannot read osrelease: %s",
 		kvm_geterr(kd));
 	}
-#ifdef LOCKDEBUG
-	if ((size_t)kvm_read(kd, nl[X_LOCKDEBUG].n_value, _all,
-	sizeof(ld_all)) != sizeof(ld_all))
-		warn("Cannot read ld_all (no LOCKDEBUG kernel?): %s",
-		kvm_geterr(kd));
-#endif
 	printf("Crash version %s, image version %s.\n", osrelease, imgrelease);
 	if (strcmp(osrelease, imgrelease) != 0) {
 		printf("WARNING: versions differ, you may not be able to "
 		"examine this image.\n");
 	}
+#ifdef LOCKDEBUG
+	if ((size_t)kvm_read(kd, nl[X_LOCKDEBUG].n_value, _all,
+	sizeof(ld_all)) != sizeof(ld_all))
+		printf("Kernel compiled without options LOCKDEBUG.\n");
+#endif
 
 	/*
 	 * Print the panic string, if any.



CVS commit: src/usr.sbin/crash

2020-03-08 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Mar  9 05:10:19 UTC 2020

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Restrict LOCKDEBUG support to archs with REALCRASH.
Fix build failure for other archs.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.43 src/usr.sbin/crash/Makefile:1.44
--- src/usr.sbin/crash/Makefile:1.43	Mon Mar  9 01:54:31 2020
+++ src/usr.sbin/crash/Makefile	Mon Mar  9 05:10:19 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.43 2020/03/09 01:54:31 christos Exp $
+#	$NetBSD: Makefile,v 1.44 2020/03/09 05:10:19 rin Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -30,10 +30,6 @@ REALCRASH=yes
 REALCRASH=no
 .endif
 
-CPPFLAGS +=-DLOCKDEBUG
-CPPFLAGS.subr_lockdebug.c += -DCRASH -DDDB
-SRCS += subr_lockdebug.c
-
 .if ${REALCRASH} != "no"	# {
 
 S=		${.CURDIR}/../../sys
@@ -58,6 +54,10 @@ SRCS+=	db_disasm.c
 SRCS+=	kern_timeout.c
 CPPFLAGS.kern_timeout.c += -DCRASH -DDDB
 
+CPPFLAGS +=-DLOCKDEBUG
+SRCS += subr_lockdebug.c
+CPPFLAGS.subr_lockdebug.c += -DCRASH -DDDB
+
 CPPFLAGS+=	-I${S}/arch
 
 . if${MACHINE} == "amd64" \



CVS commit: src/usr.sbin/crash

2020-03-08 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Mar  9 05:10:19 UTC 2020

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Restrict LOCKDEBUG support to archs with REALCRASH.
Fix build failure for other archs.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2020-03-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  9 01:54:31 UTC 2020

Modified Files:
src/usr.sbin/crash: Makefile crash.c

Log Message:
Add primitive LOCKDEBUG support.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/crash/Makefile
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/crash/crash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.42 src/usr.sbin/crash/Makefile:1.43
--- src/usr.sbin/crash/Makefile:1.42	Sun Oct 13 03:28:18 2019
+++ src/usr.sbin/crash/Makefile	Sun Mar  8 21:54:31 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.42 2019/10/13 07:28:18 mrg Exp $
+#	$NetBSD: Makefile,v 1.43 2020/03/09 01:54:31 christos Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -30,6 +30,10 @@ REALCRASH=yes
 REALCRASH=no
 .endif
 
+CPPFLAGS +=-DLOCKDEBUG
+CPPFLAGS.subr_lockdebug.c += -DCRASH -DDDB
+SRCS += subr_lockdebug.c
+
 .if ${REALCRASH} != "no"	# {
 
 S=		${.CURDIR}/../../sys

Index: src/usr.sbin/crash/crash.c
diff -u src/usr.sbin/crash/crash.c:1.11 src/usr.sbin/crash/crash.c:1.12
--- src/usr.sbin/crash/crash.c:1.11	Tue Jan 10 15:57:26 2017
+++ src/usr.sbin/crash/crash.c	Sun Mar  8 21:54:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: crash.c,v 1.11 2017/01/10 20:57:26 christos Exp $	*/
+/*	$NetBSD: crash.c,v 1.12 2020/03/09 01:54:31 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: crash.c,v 1.11 2017/01/10 20:57:26 christos Exp $");
+__RCSID("$NetBSD: crash.c,v 1.12 2020/03/09 01:54:31 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -73,9 +73,24 @@ static struct nlist nl[] = {
 	{ .n_name = "_osrelease" },
 #define	X_PANICSTR	1
 	{ .n_name = "_panicstr" },
+#ifdef LOCKDEBUG
+#define	X_LOCKDEBUG	2
+	{ .n_name = "ld_all" },
+#endif
 	{ .n_name = NULL },
 };
 
+#ifdef LOCKDEBUG
+struct lockdebug;
+TAILQ_HEAD(, lockdebug) ld_all;
+#else
+void lockdebug_lock_print(void);
+void lockdebug_lock_print(void) {
+	warnx("No lockdebug support compiled in");
+}
+#endif
+
+
 static void
 cleanup(void)
 {
@@ -412,6 +427,12 @@ main(int argc, char **argv)
 		errx(EXIT_FAILURE, "cannot read osrelease: %s",
 		kvm_geterr(kd));
 	}
+#ifdef LOCKDEBUG
+	if ((size_t)kvm_read(kd, nl[X_LOCKDEBUG].n_value, _all,
+	sizeof(ld_all)) != sizeof(ld_all))
+		warn("Cannot read ld_all (no LOCKDEBUG kernel?): %s",
+		kvm_geterr(kd));
+#endif
 	printf("Crash version %s, image version %s.\n", osrelease, imgrelease);
 	if (strcmp(osrelease, imgrelease) != 0) {
 		printf("WARNING: versions differ, you may not be able to "



CVS commit: src/usr.sbin/crash

2020-03-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  9 01:54:31 UTC 2020

Modified Files:
src/usr.sbin/crash: Makefile crash.c

Log Message:
Add primitive LOCKDEBUG support.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/crash/Makefile
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/crash/crash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2019-03-22 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Mar 23 02:07:32 UTC 2019

Modified Files:
src/usr.sbin/crash: crash.8

Log Message:
add an example shell pipeline that will print *all* kernel stack traces.
bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/crash/crash.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/crash.8
diff -u src/usr.sbin/crash/crash.8:1.7 src/usr.sbin/crash/crash.8:1.8
--- src/usr.sbin/crash/crash.8:1.7	Mon Jul  3 21:35:30 2017
+++ src/usr.sbin/crash/crash.8	Sat Mar 23 02:07:32 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: crash.8,v 1.7 2017/07/03 21:35:30 wiz Exp $
+.\"	$NetBSD: crash.8,v 1.8 2019/03/23 02:07:32 mrg Exp $
 .\"
 .\" Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 10, 2016
+.Dd March 22, 2019
 .Dt CRASH 8
 .Os
 .Sh NAME
@@ -83,6 +83,13 @@ For example:
 crash> ps | more
 crash> ps | grep ioflush
 .Ed
+.Sh EXAMPLES
+You can obtain a full list of all kernel stack traces with a shell pipeline
+like the following:
+.Bd -literal -offset abcd
+# echo ps | crash | grep '^[0-9]' | cut -c 30-46 | \\
+  sed 's,^,bt/a ,' | crash
+.Ed
 .Sh SEE ALSO
 .Xr ps 1 ,
 .Xr vmstat 1 ,



CVS commit: src/usr.sbin/crash

2019-03-22 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Mar 23 02:07:32 UTC 2019

Modified Files:
src/usr.sbin/crash: crash.8

Log Message:
add an example shell pipeline that will print *all* kernel stack traces.
bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/crash/crash.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash/arch

2018-08-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 12 16:00:41 UTC 2018

Modified Files:
src/usr.sbin/crash/arch: x86.c

Log Message:
i386 does not have a variable min address (yet)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/crash/arch/x86.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/arch/x86.c
diff -u src/usr.sbin/crash/arch/x86.c:1.3 src/usr.sbin/crash/arch/x86.c:1.4
--- src/usr.sbin/crash/arch/x86.c:1.3	Sun Aug 12 11:55:26 2018
+++ src/usr.sbin/crash/arch/x86.c	Sun Aug 12 12:00:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86.c,v 1.3 2018/08/12 15:55:26 christos Exp $	*/
+/*	$NetBSD: x86.c,v 1.4 2018/08/12 16:00:41 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: x86.c,v 1.3 2018/08/12 15:55:26 christos Exp $");
+__RCSID("$NetBSD: x86.c,v 1.4 2018/08/12 16:00:41 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -47,11 +47,15 @@ __RCSID("$NetBSD: x86.c,v 1.3 2018/08/12
 
 #include "extern.h"
 
+#ifdef VM_MIN_KERNEL_ADDRESS_DEFAULT
 vaddr_t vm_min_kernel_address = VM_MIN_KERNEL_ADDRESS_DEFAULT;
+#endif
 
 static struct nlist nl[] = {
 	{ .n_name = "_dumppcb" },
+#ifdef VM_MIN_KERNEL_ADDRESS_DEFAULT
 	{ .n_name = "vm_min_kernel_address" },
+#endif
 	{ .n_name = NULL },
 };
 
@@ -68,11 +72,13 @@ db_mach_init(kvm_t *kd)
 	sizeof(pcb)) {
 		errx(EXIT_FAILURE, "cannot read dumppcb: %s", kvm_geterr(kd));
 	}
+#ifdef VM_MIN_KERNEL_ADDRESS_DEFAULT
 	if ((size_t)kvm_read(kd, nl[1].n_value, _min_kernel_address,
 	sizeof(vm_min_kernel_address)) != sizeof(vm_min_kernel_address)) {
 		errx(EXIT_FAILURE, "cannot read vm_min_kernel_address: %s",
 		kvm_geterr(kd));
 	}
+#endif
 ddb_regs.tf_sp = pcb.pcb_sp;
 ddb_regs.tf_bp = pcb.pcb_bp;
 if (ddb_regs.tf_bp != 0 && ddb_regs.tf_sp != 0) {



CVS commit: src/usr.sbin/crash/arch

2018-08-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 12 16:00:41 UTC 2018

Modified Files:
src/usr.sbin/crash/arch: x86.c

Log Message:
i386 does not have a variable min address (yet)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/crash/arch/x86.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash/arch

2018-08-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 12 15:55:27 UTC 2018

Modified Files:
src/usr.sbin/crash/arch: x86.c

Log Message:
reorder


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/crash/arch/x86.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/arch/x86.c
diff -u src/usr.sbin/crash/arch/x86.c:1.2 src/usr.sbin/crash/arch/x86.c:1.3
--- src/usr.sbin/crash/arch/x86.c:1.2	Sun Aug 12 11:05:13 2018
+++ src/usr.sbin/crash/arch/x86.c	Sun Aug 12 11:55:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86.c,v 1.2 2018/08/12 15:05:13 christos Exp $	*/
+/*	$NetBSD: x86.c,v 1.3 2018/08/12 15:55:26 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: x86.c,v 1.2 2018/08/12 15:05:13 christos Exp $");
+__RCSID("$NetBSD: x86.c,v 1.3 2018/08/12 15:55:26 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -50,8 +50,8 @@ __RCSID("$NetBSD: x86.c,v 1.2 2018/08/12
 vaddr_t vm_min_kernel_address = VM_MIN_KERNEL_ADDRESS_DEFAULT;
 
 static struct nlist nl[] = {
-	{ .n_name = "vm_min_kernel_address" },
 	{ .n_name = "_dumppcb" },
+	{ .n_name = "vm_min_kernel_address" },
 	{ .n_name = NULL },
 };
 



CVS commit: src/usr.sbin/crash/arch

2018-08-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 12 15:55:27 UTC 2018

Modified Files:
src/usr.sbin/crash/arch: x86.c

Log Message:
reorder


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/crash/arch/x86.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash/arch

2018-08-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 12 15:05:13 UTC 2018

Modified Files:
src/usr.sbin/crash/arch: x86.c

Log Message:
make things link again.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/crash/arch/x86.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/arch/x86.c
diff -u src/usr.sbin/crash/arch/x86.c:1.1 src/usr.sbin/crash/arch/x86.c:1.2
--- src/usr.sbin/crash/arch/x86.c:1.1	Sat Apr 30 12:57:58 2011
+++ src/usr.sbin/crash/arch/x86.c	Sun Aug 12 11:05:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86.c,v 1.1 2011/04/30 16:57:58 christos Exp $	*/
+/*	$NetBSD: x86.c,v 1.2 2018/08/12 15:05:13 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: x86.c,v 1.1 2011/04/30 16:57:58 christos Exp $");
+__RCSID("$NetBSD: x86.c,v 1.2 2018/08/12 15:05:13 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -47,7 +47,10 @@ __RCSID("$NetBSD: x86.c,v 1.1 2011/04/30
 
 #include "extern.h"
 
+vaddr_t vm_min_kernel_address = VM_MIN_KERNEL_ADDRESS_DEFAULT;
+
 static struct nlist nl[] = {
+	{ .n_name = "vm_min_kernel_address" },
 	{ .n_name = "_dumppcb" },
 	{ .n_name = NULL },
 };
@@ -65,6 +68,11 @@ db_mach_init(kvm_t *kd)
 	sizeof(pcb)) {
 		errx(EXIT_FAILURE, "cannot read dumppcb: %s", kvm_geterr(kd));
 	}
+	if ((size_t)kvm_read(kd, nl[1].n_value, _min_kernel_address,
+	sizeof(vm_min_kernel_address)) != sizeof(vm_min_kernel_address)) {
+		errx(EXIT_FAILURE, "cannot read vm_min_kernel_address: %s",
+		kvm_geterr(kd));
+	}
 ddb_regs.tf_sp = pcb.pcb_sp;
 ddb_regs.tf_bp = pcb.pcb_bp;
 if (ddb_regs.tf_bp != 0 && ddb_regs.tf_sp != 0) {



CVS commit: src/usr.sbin/crash/arch

2018-08-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 12 15:05:13 UTC 2018

Modified Files:
src/usr.sbin/crash/arch: x86.c

Log Message:
make things link again.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/crash/arch/x86.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2018-05-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May 20 03:09:02 UTC 2018

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Fix reproducible builds
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2018-05-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun May 20 03:09:02 UTC 2018

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Fix reproducible builds
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.39 src/usr.sbin/crash/Makefile:1.40
--- src/usr.sbin/crash/Makefile:1.39	Sun Mar  4 02:15:37 2018
+++ src/usr.sbin/crash/Makefile	Sat May 19 23:09:02 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.39 2018/03/04 07:15:37 mlelstv Exp $
+#	$NetBSD: Makefile,v 1.40 2018/05/20 03:09:02 christos Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -84,10 +84,18 @@ SRCS+=	generic.c
 
 COPTS.db_output.c += -Wno-format-nonliteral
 
+.if ${MKREPRO} == "yes"
+.   if ${MKREPRO_TIMESTAMP:U0} != 0
+NVFLAGS+=-r ${MKREPRO_TIMESTAMP}
+.   else
+NVFLAGS+=-R
+.   endif
+.endif
+
 # vers.c
 SRCS+=	vers.c
 vers.c:	${S}/conf/newvers.sh ${_NETBSD_VERSION_DEPENDS}
-	${HOST_SH} ${S}/conf/newvers.sh -r -n
+	${HOST_SH} ${S}/conf/newvers.sh ${NVFLAGS} -n -m ${MACHINE} -i CRASH
 CLEANFILES+=	vers.c version
 
 .else# } {



CVS commit: src/usr.sbin/crash

2018-03-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Mar  4 07:15:37 UTC 2018

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Align with DDB.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.38 src/usr.sbin/crash/Makefile:1.39
--- src/usr.sbin/crash/Makefile:1.38	Wed Jan 24 09:04:46 2018
+++ src/usr.sbin/crash/Makefile	Sun Mar  4 07:15:37 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.38 2018/01/24 09:04:46 skrll Exp $
+#	$NetBSD: Makefile,v 1.39 2018/03/04 07:15:37 mlelstv Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -40,6 +40,7 @@ CPPFLAGS+=	-UDB_MACHINE_COMMANDS
 # ddb files from kernel
 .PATH:	$S/ddb
 SRCS+=	db_command.c db_lwp.c db_proc.c db_xxx.c db_cpu.c
+SRCS+=  db_autoconf.c
 SRCS+=	db_access.c db_elf.c db_examine.c
 SRCS+=	db_expr.c db_lex.c db_output.c db_print.c
 SRCS+=	db_sym.c db_variables.c db_write_cmd.c



CVS commit: src/usr.sbin/crash

2018-03-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Mar  4 07:15:37 UTC 2018

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Align with DDB.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2017-07-21 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Fri Jul 21 20:58:44 UTC 2017

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
sparc has db_machdep.c now.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2017-07-21 Thread Takeshi Nakayama
Module Name:src
Committed By:   nakayama
Date:   Fri Jul 21 20:58:44 UTC 2017

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
sparc has db_machdep.c now.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.36 src/usr.sbin/crash/Makefile:1.37
--- src/usr.sbin/crash/Makefile:1.36	Mon Apr 10 12:05:52 2017
+++ src/usr.sbin/crash/Makefile	Fri Jul 21 20:58:44 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.36 2017/04/10 12:05:52 christos Exp $
+#	$NetBSD: Makefile,v 1.37 2017/07/21 20:58:44 nakayama Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -21,9 +21,7 @@ DPADD+=	${LIBUTIL} ${LIBKVM} ${LIBEDIT} 
 || (${MACHINE_CPU} == "arm" && ${MACHINE} != "acorn26") \
 || ${MACHINE_ARCH} == "m68k"
 SRCS+=	db_trace.c
-.if ${MACHINE_ARCH} == "sparc"
-SRCS+=	db_interface.c
-.elif ${MACHINE_ARCH} != "m68k"
+.if ${MACHINE_ARCH} != "m68k"
 SRCS+=	db_machdep.c
 .endif
 REALCRASH=yes



CVS commit: src/usr.sbin/crash

2017-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 10 12:05:52 UTC 2017

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Protect the right part.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.35 src/usr.sbin/crash/Makefile:1.36
--- src/usr.sbin/crash/Makefile:1.35	Sun Apr  9 17:57:59 2017
+++ src/usr.sbin/crash/Makefile	Mon Apr 10 08:05:52 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.35 2017/04/09 21:57:59 christos Exp $
+#	$NetBSD: Makefile,v 1.36 2017/04/10 12:05:52 christos Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -97,12 +97,12 @@ SRCS+=	unsupported.c
 
 .endif# }
 
+.if  ${MACHINE} == "sparc" \
+|| ${MACHINE} == "sparc64"
 COPTS.kern_timeout.c += -Wno-stack-protector
+.endif
 
-.if  ${MACHINE} == "sparc"
-|| ${MACHINE} == "sparc64"
 .include "../../compat/exec.mk"
-.endif
 
 .include 
 .include 



CVS commit: src/usr.sbin/crash

2017-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 10 12:05:52 UTC 2017

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Protect the right part.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2017-04-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr  9 21:57:59 UTC 2017

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
fix syntax


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2017-04-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr  9 21:57:59 UTC 2017

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
fix syntax


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.34 src/usr.sbin/crash/Makefile:1.35
--- src/usr.sbin/crash/Makefile:1.34	Sun Apr  9 16:34:00 2017
+++ src/usr.sbin/crash/Makefile	Sun Apr  9 17:57:59 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.34 2017/04/09 20:34:00 christos Exp $
+#	$NetBSD: Makefile,v 1.35 2017/04/09 21:57:59 christos Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -99,8 +99,8 @@ SRCS+=	unsupported.c
 
 COPTS.kern_timeout.c += -Wno-stack-protector
 
-.if  ${MACHINE} == "sparc" ||
-${MACHINE} == "sparc64" ||
+.if  ${MACHINE} == "sparc"
+|| ${MACHINE} == "sparc64"
 .include "../../compat/exec.mk"
 .endif
 



CVS commit: src/usr.sbin/crash

2017-04-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr  9 20:34:00 UTC 2017

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
stack protector issue on sparc


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.33 src/usr.sbin/crash/Makefile:1.34
--- src/usr.sbin/crash/Makefile:1.33	Fri Dec 23 05:19:57 2016
+++ src/usr.sbin/crash/Makefile	Sun Apr  9 16:34:00 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.33 2016/12/23 10:19:57 mrg Exp $
+#	$NetBSD: Makefile,v 1.34 2017/04/09 20:34:00 christos Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -97,7 +97,12 @@ SRCS+=	unsupported.c
 
 .endif# }
 
+COPTS.kern_timeout.c += -Wno-stack-protector
+
+.if  ${MACHINE} == "sparc" ||
+${MACHINE} == "sparc64" ||
 .include "../../compat/exec.mk"
+.endif
 
 .include 
 .include 



CVS commit: src/usr.sbin/crash

2017-04-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr  9 20:34:00 UTC 2017

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
stack protector issue on sparc


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2017-01-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 10 20:57:26 UTC 2017

Modified Files:
src/usr.sbin/crash: crash.c

Log Message:
need 


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/crash/crash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/crash.c
diff -u src/usr.sbin/crash/crash.c:1.10 src/usr.sbin/crash/crash.c:1.11
--- src/usr.sbin/crash/crash.c:1.10	Tue Jun 16 19:48:20 2015
+++ src/usr.sbin/crash/crash.c	Tue Jan 10 15:57:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: crash.c,v 1.10 2015/06/16 23:48:20 christos Exp $	*/
+/*	$NetBSD: crash.c,v 1.11 2017/01/10 20:57:26 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,13 +31,14 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: crash.c,v 1.10 2015/06/16 23:48:20 christos Exp $");
+__RCSID("$NetBSD: crash.c,v 1.11 2017/01/10 20:57:26 christos Exp $");
 #endif /* not lint */
 
 #include 
 
 #include 
 #include 
+#include 
 #include 
 
 #include 



CVS commit: src/usr.sbin/crash

2016-12-10 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Dec 10 23:21:02 UTC 2016

Modified Files:
src/usr.sbin/crash: crash.8

Log Message:
note that crash/sparc is unstable


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/crash/crash.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2016-12-10 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Dec 10 23:21:02 UTC 2016

Modified Files:
src/usr.sbin/crash: crash.8

Log Message:
note that crash/sparc is unstable


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/crash/crash.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/crash.8
diff -u src/usr.sbin/crash/crash.8:1.5 src/usr.sbin/crash/crash.8:1.6
--- src/usr.sbin/crash/crash.8:1.5	Sun Oct  5 23:08:01 2014
+++ src/usr.sbin/crash/crash.8	Sat Dec 10 23:21:02 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: crash.8,v 1.5 2014/10/05 23:08:01 wiz Exp $
+.\"	$NetBSD: crash.8,v 1.6 2016/12/10 23:21:02 mrg Exp $
 .\"
 .\" Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 5, 2014
+.Dd December 10, 2016
 .Dt CRASH 8
 .Os
 .Sh NAME
@@ -93,3 +93,7 @@ The
 .Nm
 command appeared in
 .Nx 6.0 .
+.Sh BUGS
+The
+.Nm
+command for the sparc port is unstable.



CVS commit: src/usr.sbin/crash

2016-12-10 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Dec 10 10:42:43 UTC 2016

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
enable sparc crash(8) builds.
it's not very stable yet but it's not 100% useless.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.31 src/usr.sbin/crash/Makefile:1.32
--- src/usr.sbin/crash/Makefile:1.31	Tue Jun 16 23:48:20 2015
+++ src/usr.sbin/crash/Makefile	Sat Dec 10 10:42:43 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.31 2015/06/16 23:48:20 christos Exp $
+#	$NetBSD: Makefile,v 1.32 2016/12/10 10:42:43 mrg Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -16,11 +16,14 @@ DPADD+=	${LIBUTIL} ${LIBKVM} ${LIBEDIT} 
 .if${MACHINE} == "amd64" \
 || ${MACHINE} == "hppa" \
 || ${MACHINE} == "i386" \
+|| ${MACHINE} == "sparc" \
 || ${MACHINE} == "sparc64" \
 || (${MACHINE_CPU} == "arm" && ${MACHINE} != "acorn26") \
 || ${MACHINE_ARCH} == "m68k"
 SRCS+=	db_trace.c
-.if ${MACHINE_ARCH} != "m68k"
+.if ${MACHINE_ARCH} == "sparc"
+SRCS+=	db_interface.c
+.elif ${MACHINE_ARCH} != "m68k"
 SRCS+=	db_machdep.c
 .endif
 REALCRASH=yes
@@ -56,8 +59,7 @@ CPPFLAGS+=	-I${S}/arch
 . if${MACHINE} == "amd64" \
  || ${MACHINE} == "i386"
 MACHINE_FAMILY = x86
-. elif${MACHINE} == "sparc64" \
- || ${MACHINE} == "sparc64"
+. elif  ${MACHINE} == "sparc64"
 MACHINE_FAMILY = sparc
 . else
 MACHINE_FAMILY = ${MACHINE_CPU}



CVS commit: src/usr.sbin/crash

2015-06-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jun 16 23:48:20 UTC 2015

Modified Files:
src/usr.sbin/crash: Makefile crash.c

Log Message:
revert kernhist patch accidentally committed


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/crash/Makefile
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/crash/crash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.30 src/usr.sbin/crash/Makefile:1.31
--- src/usr.sbin/crash/Makefile:1.30	Tue Jun 16 19:04:14 2015
+++ src/usr.sbin/crash/Makefile	Tue Jun 16 19:48:20 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.30 2015/06/16 23:04:14 christos Exp $
+#	$NetBSD: Makefile,v 1.31 2015/06/16 23:48:20 christos Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -34,7 +34,7 @@ S=		${.CURDIR}/../../sys
 
 CPPFLAGS+=	-I${.CURDIR} -I${.OBJDIR} -I${S} -fno-strict-aliasing
 CPPFLAGS+=	-DDDB_VERBOSE_HELP -DDB_MAX_LINE=1000 -D_KMEMUSER
-CPPFLAGS+=	-UDB_MACHINE_COMMANDS -DKERNHIST -DDDB
+CPPFLAGS+=	-UDB_MACHINE_COMMANDS
 
 # ddb files from kernel
 .PATH:	$S/ddb

Index: src/usr.sbin/crash/crash.c
diff -u src/usr.sbin/crash/crash.c:1.9 src/usr.sbin/crash/crash.c:1.10
--- src/usr.sbin/crash/crash.c:1.9	Tue Jun 16 19:04:14 2015
+++ src/usr.sbin/crash/crash.c	Tue Jun 16 19:48:20 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: crash.c,v 1.9 2015/06/16 23:04:14 christos Exp $	*/
+/*	$NetBSD: crash.c,v 1.10 2015/06/16 23:48:20 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: crash.c,v 1.9 2015/06/16 23:04:14 christos Exp $);
+__RCSID($NetBSD: crash.c,v 1.10 2015/06/16 23:48:20 christos Exp $);
 #endif /* not lint */
 
 #include ddb/ddb.h
@@ -39,7 +39,6 @@ __RCSID($NetBSD: crash.c,v 1.9 2015/06/
 #include sys/fcntl.h
 #include sys/mman.h
 #include sys/ioctl.h
-#include sys/kernhist.h
 
 #include machine/frame.h
 
@@ -73,8 +72,6 @@ static struct nlist nl[] = {
 	{ .n_name = _osrelease },
 #define	X_PANICSTR	1
 	{ .n_name = _panicstr },
-#define	X_KERN_HISTORIES	2
-	{ .n_name = _kern_histories },
 	{ .n_name = NULL },
 };
 
@@ -304,50 +301,6 @@ cnputc(int c)
 	putc(c, ofp);
 }
 
-#define FMTLEN 1024
-#define FNLEN 128
-
-void
-kernhist_dump(struct kern_history *l)
-{
-	unsigned int lcv;
-	struct kern_history kh;
-	struct kern_history_ent ke;
-	char fmt[FMTLEN];
-	char fn[FNLEN];
-
-	db_read_bytes((db_addr_t)l, sizeof(kh), (char *)kh);
-	lcv = kh.f;
-	do {
-		db_read_bytes((db_addr_t)kh.e[lcv], sizeof(ke), (char *)ke);
-		if (ke.fmt) {
-			db_read_bytes((db_addr_t)ke.fmt, sizeof(fmt), fmt);
-			db_read_bytes((db_addr_t)ke.fn, sizeof(fn), fn);
-			fmt[sizeof(fmt) - 1] = '\0';
-			fn[sizeof(fmt) - 1] = '\0';
-			ke.fmt = fmt;
-			ke.fn = fn;
-			kernhist_entry_print(ke);
-		}
-		lcv = (lcv + 1) % kh.n;
-	} while (lcv != kh.f);
-}
-
-void
-kernhist_print(void (*pr)(const char *, ...))
-{
-	struct kern_history_head khh;
-
-	if (nl[X_KERN_HISTORIES].n_value == 0) {
-		warnx(kernhist is not available);
-		return;
-	}
-
-	db_read_bytes(nl[X_KERN_HISTORIES].n_value, sizeof(khh), (char *)khh);
-
-	kernhist_dump(LIST_FIRST(khh));
-}
-
 __dead static void
 usage(void)
 {



CVS commit: src/usr.sbin/crash

2015-06-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jun 16 23:48:20 UTC 2015

Modified Files:
src/usr.sbin/crash: Makefile crash.c

Log Message:
revert kernhist patch accidentally committed


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/crash/Makefile
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/crash/crash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2015-02-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb  9 17:48:07 UTC 2015

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Only define the extra flags for kern_timeout.c


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.28 src/usr.sbin/crash/Makefile:1.29
--- src/usr.sbin/crash/Makefile:1.28	Sun Feb  8 14:42:12 2015
+++ src/usr.sbin/crash/Makefile	Mon Feb  9 12:48:07 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.28 2015/02/08 19:42:12 christos Exp $
+#	$NetBSD: Makefile,v 1.29 2015/02/09 17:48:07 christos Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -34,7 +34,7 @@ S=		${.CURDIR}/../../sys
 
 CPPFLAGS+=	-I${.CURDIR} -I${.OBJDIR} -I${S} -fno-strict-aliasing
 CPPFLAGS+=	-DDDB_VERBOSE_HELP -DDB_MAX_LINE=1000 -D_KMEMUSER
-CPPFLAGS+=	-UDB_MACHINE_COMMANDS -DCRASH -DDDB
+CPPFLAGS+=	-UDB_MACHINE_COMMANDS
 
 # ddb files from kernel
 .PATH:	$S/ddb
@@ -49,6 +49,7 @@ SRCS+=	db_disasm.c
 
 .PATH:  $S/kern
 SRCS+=	kern_timeout.c
+CPPFLAGS.kern_timeout.c += -DCRASH -DDDB
 
 CPPFLAGS+=	-I${S}/arch
 



CVS commit: src/usr.sbin/crash

2015-02-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb  9 17:48:07 UTC 2015

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Only define the extra flags for kern_timeout.c


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2015-02-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb  8 19:42:12 UTC 2015

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
add kern_timeout.c for show callout


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2015-02-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb  8 19:42:12 UTC 2015

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
add kern_timeout.c for show callout


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.27 src/usr.sbin/crash/Makefile:1.28
--- src/usr.sbin/crash/Makefile:1.27	Sun Mar 30 03:29:22 2014
+++ src/usr.sbin/crash/Makefile	Sun Feb  8 14:42:12 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.27 2014/03/30 07:29:22 skrll Exp $
+#	$NetBSD: Makefile,v 1.28 2015/02/08 19:42:12 christos Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -34,7 +34,7 @@ S=		${.CURDIR}/../../sys
 
 CPPFLAGS+=	-I${.CURDIR} -I${.OBJDIR} -I${S} -fno-strict-aliasing
 CPPFLAGS+=	-DDDB_VERBOSE_HELP -DDB_MAX_LINE=1000 -D_KMEMUSER
-CPPFLAGS+=	-UDB_MACHINE_COMMANDS
+CPPFLAGS+=	-UDB_MACHINE_COMMANDS -DCRASH -DDDB
 
 # ddb files from kernel
 .PATH:	$S/ddb
@@ -47,6 +47,9 @@ SRCS+=	db_sym.c db_variables.c db_write_
 .PATH:	${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
 SRCS+=	db_disasm.c
 
+.PATH:  $S/kern
+SRCS+=	kern_timeout.c
+
 CPPFLAGS+=	-I${S}/arch
 
 . if${MACHINE} == amd64 \



CVS commit: src/usr.sbin/crash

2014-10-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Oct  6 13:14:36 UTC 2014

Modified Files:
src/usr.sbin/crash: crash.c

Log Message:
mention the default for core too.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/crash/crash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/crash.c
diff -u src/usr.sbin/crash/crash.c:1.7 src/usr.sbin/crash/crash.c:1.8
--- src/usr.sbin/crash/crash.c:1.7	Sun Oct  5 19:08:01 2014
+++ src/usr.sbin/crash/crash.c	Mon Oct  6 09:14:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: crash.c,v 1.7 2014/10/05 23:08:01 wiz Exp $	*/
+/*	$NetBSD: crash.c,v 1.8 2014/10/06 13:14:36 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: crash.c,v 1.7 2014/10/05 23:08:01 wiz Exp $);
+__RCSID($NetBSD: crash.c,v 1.8 2014/10/06 13:14:36 christos Exp $);
 #endif /* not lint */
 
 #include ddb/ddb.h
@@ -307,7 +307,7 @@ usage(void)
 
 	fprintf(stderr,
 	usage: %s [-w] [-M core] [-N kernel]\n\n
-	-M core\tspecify memory file\n
+	-M core\tspecify memory file (default /dev/mem)\n
 	-N kernel\tspecify name list file (default /dev/ksyms)\n,
 	getprogname());
 	exit(EXIT_FAILURE);



CVS commit: src/usr.sbin/crash

2014-10-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Oct  6 13:14:36 UTC 2014

Modified Files:
src/usr.sbin/crash: crash.c

Log Message:
mention the default for core too.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/crash/crash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2014-10-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct  5 22:58:43 UTC 2014

Modified Files:
src/usr.sbin/crash: crash.8 crash.c

Log Message:
add -w


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/crash/crash.8
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/crash/crash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/crash.8
diff -u src/usr.sbin/crash/crash.8:1.3 src/usr.sbin/crash/crash.8:1.4
--- src/usr.sbin/crash/crash.8:1.3	Sun Apr 10 18:49:52 2011
+++ src/usr.sbin/crash/crash.8	Sun Oct  5 18:58:43 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: crash.8,v 1.3 2011/04/10 22:49:52 pgoyette Exp $
+.\	$NetBSD: crash.8,v 1.4 2014/10/05 22:58:43 christos Exp $
 .\
 .\ Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd March 7, 2009
+.Dd October 5, 2014
 .Dt CRASH 8
 .Os
 .Sh NAME
@@ -37,6 +37,7 @@
 .Nm
 .Op Fl M Ar core
 .Op Fl N Ar kernel
+.Op Fl w
 .Sh DESCRIPTION
 The
 .Nm
@@ -58,6 +59,8 @@ and must be uncompressed.
 .It Fl N Ar kernel
 Extract the name list from the specified kernel instead of the default
 .Pa /dev/ksyms .
+.It Fl w
+Enable writing.
 .El
 .Pp
 The command syntax used by

Index: src/usr.sbin/crash/crash.c
diff -u src/usr.sbin/crash/crash.c:1.5 src/usr.sbin/crash/crash.c:1.6
--- src/usr.sbin/crash/crash.c:1.5	Sun Mar 10 15:32:29 2013
+++ src/usr.sbin/crash/crash.c	Sun Oct  5 18:58:43 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: crash.c,v 1.5 2013/03/10 19:32:29 christos Exp $	*/
+/*	$NetBSD: crash.c,v 1.6 2014/10/05 22:58:43 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: crash.c,v 1.5 2013/03/10 19:32:29 christos Exp $);
+__RCSID($NetBSD: crash.c,v 1.6 2014/10/05 22:58:43 christos Exp $);
 #endif /* not lint */
 
 #include ddb/ddb.h
@@ -329,19 +329,20 @@ main(int argc, char **argv)
 	struct stat sb;
 	size_t sz;
 	void *elf;
-	int fd, ch;
+	int fd, ch, flags;
 	char c;
 
 	nlistf = _PATH_KSYMS;
 	memf = _PATH_MEM;
 	ofp = stdout;
+	flags = O_RDONLY;
 
 	setprogname(argv[0]);
 
 	/*
 	 * Parse options.
 	 */
-	while ((ch = getopt(argc, argv, M:N:)) != -1) {
+	while ((ch = getopt(argc, argv, M:N:w)) != -1) {
 		switch (ch) {
 		case 'M':
 			memf = optarg;
@@ -349,6 +350,9 @@ main(int argc, char **argv)
 		case 'N':
 			nlistf = optarg;
 			break;
+		case 'w':
+			flags = O_RDWR;
+			break;
 		default:
 			usage();
 		}
@@ -364,7 +368,7 @@ main(int argc, char **argv)
 	/*
 	 * Open the images (crash dump and symbol table).
 	 */
-	kd = kvm_open(nlistf, memf, NULL, O_RDONLY, getprogname());
+	kd = kvm_open(nlistf, memf, NULL, flags, getprogname());
 	if (kd == NULL) {
 		return EXIT_FAILURE;
 	}



CVS commit: src/usr.sbin/crash

2014-10-05 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Oct  5 23:08:01 UTC 2014

Modified Files:
src/usr.sbin/crash: crash.8 crash.c

Log Message:
usage police
XXX: is the program usage correct? (/dev/ksyms)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/crash/crash.8
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/crash/crash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/crash.8
diff -u src/usr.sbin/crash/crash.8:1.4 src/usr.sbin/crash/crash.8:1.5
--- src/usr.sbin/crash/crash.8:1.4	Sun Oct  5 22:58:43 2014
+++ src/usr.sbin/crash/crash.8	Sun Oct  5 23:08:01 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: crash.8,v 1.4 2014/10/05 22:58:43 christos Exp $
+.\	$NetBSD: crash.8,v 1.5 2014/10/05 23:08:01 wiz Exp $
 .\
 .\ Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -35,9 +35,9 @@
 .Nd examine and debug system images
 .Sh SYNOPSIS
 .Nm
+.Op Fl w
 .Op Fl M Ar core
 .Op Fl N Ar kernel
-.Op Fl w
 .Sh DESCRIPTION
 The
 .Nm

Index: src/usr.sbin/crash/crash.c
diff -u src/usr.sbin/crash/crash.c:1.6 src/usr.sbin/crash/crash.c:1.7
--- src/usr.sbin/crash/crash.c:1.6	Sun Oct  5 22:58:43 2014
+++ src/usr.sbin/crash/crash.c	Sun Oct  5 23:08:01 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: crash.c,v 1.6 2014/10/05 22:58:43 christos Exp $	*/
+/*	$NetBSD: crash.c,v 1.7 2014/10/05 23:08:01 wiz Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: crash.c,v 1.6 2014/10/05 22:58:43 christos Exp $);
+__RCSID($NetBSD: crash.c,v 1.7 2014/10/05 23:08:01 wiz Exp $);
 #endif /* not lint */
 
 #include ddb/ddb.h
@@ -306,9 +306,9 @@ usage(void)
 {
 
 	fprintf(stderr,
-	usage: %s [options]\n\n
-	-M mem\tspecify memory file\n
-	-N nlist\tspecify name list file (default /dev/ksyms)\n,
+	usage: %s [-w] [-M core] [-N kernel]\n\n
+	-M core\tspecify memory file\n
+	-N kernel\tspecify name list file (default /dev/ksyms)\n,
 	getprogname());
 	exit(EXIT_FAILURE);
 }



CVS commit: src/usr.sbin/crash

2014-10-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct  5 22:58:43 UTC 2014

Modified Files:
src/usr.sbin/crash: crash.8 crash.c

Log Message:
add -w


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/crash/crash.8
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/crash/crash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2014-10-05 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Oct  5 23:08:01 UTC 2014

Modified Files:
src/usr.sbin/crash: crash.8 crash.c

Log Message:
usage police
XXX: is the program usage correct? (/dev/ksyms)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/crash/crash.8
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/crash/crash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2014-03-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Mar 30 07:29:22 UTC 2014

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Build everything on all arm variants


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.26 src/usr.sbin/crash/Makefile:1.27
--- src/usr.sbin/crash/Makefile:1.26	Sat Mar 29 09:36:18 2014
+++ src/usr.sbin/crash/Makefile	Sun Mar 30 07:29:22 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.26 2014/03/29 09:36:18 skrll Exp $
+#	$NetBSD: Makefile,v 1.27 2014/03/30 07:29:22 skrll Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -9,13 +9,15 @@ CWARNFLAGS.clang+=	-Wno-format
 LDADD+=	-lutil -lkvm -ledit -lterminfo
 DPADD+=	${LIBUTIL} ${LIBKVM} ${LIBEDIT} ${LIBTERMINFO}
 
+.include bsd.own.mk
+
 # some ddb kernel components need limited modifications.  for now,
 # punt if not noted as implemented here.
 .if${MACHINE} == amd64 \
 || ${MACHINE} == hppa \
 || ${MACHINE} == i386 \
 || ${MACHINE} == sparc64 \
-|| (${MACHINE_ARCH} == arm  ${MACHINE} != acorn26) \
+|| (${MACHINE_CPU} == arm  ${MACHINE} != acorn26) \
 || ${MACHINE_ARCH} == m68k
 SRCS+=	db_trace.c
 .if ${MACHINE_ARCH} != m68k
@@ -54,10 +56,10 @@ MACHINE_FAMILY = x86
  || ${MACHINE} == sparc64
 MACHINE_FAMILY = sparc
 . else
-MACHINE_FAMILY = ${MACHINE}
+MACHINE_FAMILY = ${MACHINE_CPU}
 . endif
 
-.if ${MACHINE_ARCH} == arm
+.if ${MACHINE_CPU} == arm
 .PATH:	${S}/arch/arm/arm32
 SRCS+=disassem.c cpufunc_asm.S
 .endif



CVS commit: src/usr.sbin/crash

2014-03-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Mar 30 07:29:22 UTC 2014

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Build everything on all arm variants


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2014-03-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Mar 29 09:36:18 UTC 2014

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Simplify


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.25 src/usr.sbin/crash/Makefile:1.26
--- src/usr.sbin/crash/Makefile:1.25	Mon Feb 24 07:23:44 2014
+++ src/usr.sbin/crash/Makefile	Sat Mar 29 09:36:18 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.25 2014/02/24 07:23:44 skrll Exp $
+#	$NetBSD: Makefile,v 1.26 2014/03/29 09:36:18 skrll Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -50,9 +50,6 @@ CPPFLAGS+=	-I${S}/arch
 . if${MACHINE} == amd64 \
  || ${MACHINE} == i386
 MACHINE_FAMILY = x86
-. elif  ${MACHINE_ARCH} == m68k \
- || ${MACHINE_ARCH} == arm
-MACHINE_FAMILY = ${MACHINE_ARCH}
 . elif${MACHINE} == sparc64 \
  || ${MACHINE} == sparc64
 MACHINE_FAMILY = sparc



CVS commit: src/usr.sbin/crash

2014-03-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Mar 29 09:36:18 UTC 2014

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Simplify


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2013-03-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 10 19:32:29 UTC 2013

Modified Files:
src/usr.sbin/crash: crash.c

Log Message:
add MAP_PRIVATE


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/crash/crash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/crash.c
diff -u src/usr.sbin/crash/crash.c:1.4 src/usr.sbin/crash/crash.c:1.5
--- src/usr.sbin/crash/crash.c:1.4	Wed Aug 31 09:32:36 2011
+++ src/usr.sbin/crash/crash.c	Sun Mar 10 15:32:29 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: crash.c,v 1.4 2011/08/31 13:32:36 joerg Exp $	*/
+/*	$NetBSD: crash.c,v 1.5 2013/03/10 19:32:29 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: crash.c,v 1.4 2011/08/31 13:32:36 joerg Exp $);
+__RCSID($NetBSD: crash.c,v 1.5 2013/03/10 19:32:29 christos Exp $);
 #endif /* not lint */
 
 #include ddb/ddb.h
@@ -390,7 +390,7 @@ main(int argc, char **argv)
 		}
 	} else {
 		sz = sb.st_size;
-		elf = mmap(NULL, sz, PROT_READ, MAP_FILE, fd, 0);
+		elf = mmap(NULL, sz, PROT_READ, MAP_PRIVATE|MAP_FILE, fd, 0);
 		if (elf == MAP_FAILED) {
 			err(EXIT_FAILURE, mmap `%s', nlistf);
 		}



CVS commit: src/usr.sbin/crash

2013-03-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 10 19:32:29 UTC 2013

Modified Files:
src/usr.sbin/crash: crash.c

Log Message:
add MAP_PRIVATE


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/crash/crash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2013-03-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  4 20:10:51 UTC 2013

Modified Files:
src/usr.sbin/crash: Makefile
Added Files:
src/usr.sbin/crash/arch: sparc.c

Log Message:
make crash traces work on sparc64


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/crash/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.sbin/crash/arch/sparc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.23 src/usr.sbin/crash/Makefile:1.24
--- src/usr.sbin/crash/Makefile:1.23	Sun Nov  4 06:12:32 2012
+++ src/usr.sbin/crash/Makefile	Mon Mar  4 15:10:50 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.23 2012/11/04 11:12:32 apb Exp $
+#	$NetBSD: Makefile,v 1.24 2013/03/04 20:10:50 christos Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -53,6 +53,9 @@ MACHINE_FAMILY = x86
 . elif  ${MACHINE_ARCH} == m68k \
  || ${MACHINE_ARCH} == arm
 MACHINE_FAMILY = ${MACHINE_ARCH}
+. elif${MACHINE} == sparc64 \
+ || ${MACHINE} == sparc64
+MACHINE_FAMILY = sparc
 . else
 MACHINE_FAMILY = ${MACHINE}
 . endif

Added files:

Index: src/usr.sbin/crash/arch/sparc.c
diff -u /dev/null src/usr.sbin/crash/arch/sparc.c:1.1
--- /dev/null	Mon Mar  4 15:10:51 2013
+++ src/usr.sbin/crash/arch/sparc.c	Mon Mar  4 15:10:51 2013
@@ -0,0 +1,66 @@
+/*	$NetBSD: sparc.c,v 1.1 2013/03/04 20:10:51 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+#ifndef lint
+__RCSID($NetBSD: sparc.c,v 1.1 2013/03/04 20:10:51 christos Exp $);
+#endif /* not lint */
+
+#include ddb/ddb.h
+
+#include kvm.h
+#include nlist.h
+#include err.h
+#include stdlib.h
+
+#include machine/pcb.h
+
+#include extern.h
+
+static struct nlist nl[] = {
+	{ .n_name = dumppcb },
+	{ .n_name = NULL },
+};
+
+struct pcb	pcb;
+
+void
+db_mach_init(kvm_t *kd)
+{
+
+	if (kvm_nlist(kd, nl) == -1) {
+		errx(EXIT_FAILURE, kvm_nlist: %s, kvm_geterr(kd));
+	}
+	if ((size_t)kvm_read(kd, nl[0].n_value, pcb, sizeof(pcb)) !=
+	sizeof(pcb)) {
+		errx(EXIT_FAILURE, cannot read dumppcb: %s, kvm_geterr(kd));
+	}
+}



CVS commit: src/usr.sbin/crash

2013-03-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  4 20:10:51 UTC 2013

Modified Files:
src/usr.sbin/crash: Makefile
Added Files:
src/usr.sbin/crash/arch: sparc.c

Log Message:
make crash traces work on sparc64


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/crash/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.sbin/crash/arch/sparc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/usr.sbin/crash

2012-02-18 Thread Izumi Tsutsui
 In article 20120217122414.7254417...@cvs.netbsd.org,
 Martin Husemann source-changes-d@NetBSD.org wrote:
 -=-=-=-=-=-
 
 Module Name: src
 Committed By:martin
 Date:Fri Feb 17 12:24:14 UTC 2012
 
 Modified Files:
  src/usr.sbin/crash: Makefile
 
 Log Message:
 Fix build for sparc64
 
 I'd rather re-organize the contents of the files so that sparc64 is not
 different than everyone else.

m68k and arm didn't have db_machdep.c in old Makefile and
they are also broken, so sparc64 is not alone ;-p
http://releng.netbsd.org/builds/HEAD/201202171310Z/

What checks did you do before committing your refactoring?
---
Izumi Tsutsui


Re: CVS commit: src/usr.sbin/crash

2012-02-18 Thread Izumi Tsutsui
 http://releng.netbsd.org/builds/HEAD/201202171310Z/
 
 What checks did you do before committing your refactoring?
 
 None, this is why I waited after the branch. I am fixing sparc64 now.

Can you also fix arm and m68k? Or should I put kludge?
On m68k only sun3 (which has different pmap) has db_machdep.c.

---
Izumi Tsutsui


Re: CVS commit: src/usr.sbin/crash

2012-02-18 Thread Christos Zoulas
On Feb 19,  1:08am, tsut...@ceres.dti.ne.jp (Izumi Tsutsui) wrote:
-- Subject: Re: CVS commit: src/usr.sbin/crash

|  http://releng.netbsd.org/builds/HEAD/201202171310Z/
|  
|  What checks did you do before committing your refactoring?
|  
|  None, this is why I waited after the branch. I am fixing sparc64 now.
| 
| Can you also fix arm and m68k? Or should I put kludge?
| On m68k only sun3 (which has different pmap) has db_machdep.c.

I thought arm works. I am fixing mvme68k now. I am trying to make things
work without the kludge that is why I left it broken.

christos


CVS commit: src/usr.sbin/crash

2012-02-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb 18 15:57:06 UTC 2012

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
revert sparc64 hack


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.19 src/usr.sbin/crash/Makefile:1.20
--- src/usr.sbin/crash/Makefile:1.19	Fri Feb 17 07:24:13 2012
+++ src/usr.sbin/crash/Makefile	Sat Feb 18 10:57:06 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.19 2012/02/17 12:24:13 martin Exp $
+#	$NetBSD: Makefile,v 1.20 2012/02/18 15:57:06 christos Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -18,11 +18,7 @@ DPADD+=	${LIBUTIL} ${LIBKVM} ${LIBEDIT} 
 || (${MACHINE_ARCH} == arm  ${MACHINE} != acorn26) \
 || ${MACHINE_ARCH} == m68k
 SRCS+=	db_trace.c
-.if ${MACHINE} == sparc64
-SRCS+=	db_interface.c
-.else
 SRCS+=	db_machdep.c
-.endif
 REALCRASH=yes
 .else
 REALCRASH=no



CVS commit: src/usr.sbin/crash

2012-02-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb 18 15:57:06 UTC 2012

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
revert sparc64 hack


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2012-02-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb 18 17:56:49 UTC 2012

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
m68k does not have or need db_machdep.c


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/usr.sbin/crash

2012-02-17 Thread Martin Husemann
On Fri, Feb 17, 2012 at 02:15:33PM +, Christos Zoulas wrote:
 I'd rather re-organize the contents of the files so that sparc64 is not
 different than everyone else.

I just needed a quick build fix - feel free to rename/move...

Martin


CVS commit: src/usr.sbin/crash

2012-02-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 17 12:24:14 UTC 2012

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Fix build for sparc64


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2012-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 16 20:36:13 UTC 2012

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
use -n too, so that we don't get a dup note.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.17 src/usr.sbin/crash/Makefile:1.18
--- src/usr.sbin/crash/Makefile:1.17	Wed Feb 15 21:37:43 2012
+++ src/usr.sbin/crash/Makefile	Thu Feb 16 15:36:13 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.17 2012/02/16 02:37:43 christos Exp $
+#	$NetBSD: Makefile,v 1.18 2012/02/16 20:36:13 christos Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -78,7 +78,7 @@ COPTS.db_output.c += -Wno-format-nonlite
 # vers.c
 SRCS+=	vers.c
 vers.c:	${S}/conf/newvers.sh
-	${HOST_SH} ${S}/conf/newvers.sh -r
+	${HOST_SH} ${S}/conf/newvers.sh -r -n
 CLEANFILES+=	vers.c version
 
 .else# } {



CVS commit: src/usr.sbin/crash

2012-02-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 16 20:36:13 UTC 2012

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
use -n too, so that we don't get a dup note.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2012-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 16 02:37:43 UTC 2012

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
- make this work for arm32
- factor out duplicated ifdefs


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.16 src/usr.sbin/crash/Makefile:1.17
--- src/usr.sbin/crash/Makefile:1.16	Tue Jan 31 16:17:57 2012
+++ src/usr.sbin/crash/Makefile	Wed Feb 15 21:37:43 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.16 2012/01/31 21:17:57 mlelstv Exp $
+#	$NetBSD: Makefile,v 1.17 2012/02/16 02:37:43 christos Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -15,7 +15,10 @@ DPADD+=	${LIBUTIL} ${LIBKVM} ${LIBEDIT} 
 || ${MACHINE} == hp700 \
 || ${MACHINE} == i386 \
 || ${MACHINE} == sparc64 \
+|| (${MACHINE_ARCH} == arm  ${MACHINE} != acorn26) \
 || ${MACHINE_ARCH} == m68k
+SRCS+=	db_trace.c
+SRCS+=	db_machdep.c
 REALCRASH=yes
 .else
 REALCRASH=no
@@ -40,30 +43,24 @@ SRCS+=	db_sym.c db_variables.c db_write_
 .PATH:	${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
 SRCS+=	db_disasm.c
 
+CPPFLAGS+=	-I${S}/arch
+
 . if${MACHINE} == amd64 \
  || ${MACHINE} == i386
 MACHINE_FAMILY = x86
-.PATH:	${S}/arch/x86/x86
-SRCS+=	db_trace.c
-SRCS+=	db_machdep.c
+. elif  ${MACHINE_ARCH} == m68k \
+ || ${MACHINE_ARCH} == arm
+MACHINE_FAMILY = ${MACHINE_ARCH}
 . else
 MACHINE_FAMILY = ${MACHINE}
 . endif
 
-. if ${MACHINE} == hp700
-SRCS+=	db_trace.c db_machdep.c
-. endif
-
-. if ${MACHINE} == sparc64
-SRCS+=	db_trace.c db_interface.c
-. endif
+.if ${MACHINE_ARCH} == arm
+.PATH:	${S}/arch/arm/arm32
+SRCS+=disassem.c setstack.S cpufunc_asm.S
+.endif
 
-. if	${MACHINE_ARCH} == m68k
-MACHINE_FAMILY = m68k
-.PATH:	${S}/arch/m68k/m68k
-CPPFLAGS+=	-I${S}/arch
-SRCS+=	db_trace.c db_interface.c
-. endif
+.PATH:	${S}/arch/${MACHINE_FAMILY}/${MACHINE_FAMILY}
 
 # crash main source
 SRCS+=	crash.c



CVS commit: src/usr.sbin/crash

2012-02-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb 16 02:37:43 UTC 2012

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
- make this work for arm32
- factor out duplicated ifdefs


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2012-01-17 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 17 18:44:25 UTC 2012

Modified Files:
src/usr.sbin/crash: Makefile
Removed Files:
src/usr.sbin/crash: ldscript.crash

Log Message:
Remove workaround for old binutils.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/crash/Makefile
cvs rdiff -u -r1.1 -r0 src/usr.sbin/crash/ldscript.crash

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.13 src/usr.sbin/crash/Makefile:1.14
--- src/usr.sbin/crash/Makefile:1.13	Tue Aug 16 08:07:12 2011
+++ src/usr.sbin/crash/Makefile	Tue Jan 17 18:44:24 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.13 2011/08/16 08:07:12 christos Exp $
+#	$NetBSD: Makefile,v 1.14 2012/01/17 18:44:24 skrll Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -6,7 +6,7 @@ RUMPKERNEL=	yes	# XXX: Avoid -mcmodel=ke
 
 CWARNFLAGS.clang+=	-Wno-format
 
-LDADD+=	-lutil -lkvm -ledit -lterminfo -T${.CURDIR}/ldscript.crash
+LDADD+=	-lutil -lkvm -ledit -lterminfo
 DPADD+=	${LIBUTIL} ${LIBKVM} ${LIBEDIT} ${LIBTERMINFO}
 
 # some ddb kernel components need limited modifications.  for now,



CVS commit: src/usr.sbin/crash

2012-01-17 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 17 18:44:25 UTC 2012

Modified Files:
src/usr.sbin/crash: Makefile
Removed Files:
src/usr.sbin/crash: ldscript.crash

Log Message:
Remove workaround for old binutils.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/crash/Makefile
cvs rdiff -u -r1.1 -r0 src/usr.sbin/crash/ldscript.crash

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2011-08-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 16 08:07:12 UTC 2011

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
document non-literal format


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.12 src/usr.sbin/crash/Makefile:1.13
--- src/usr.sbin/crash/Makefile:1.12	Thu May 26 08:56:33 2011
+++ src/usr.sbin/crash/Makefile	Tue Aug 16 04:07:12 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.12 2011/05/26 12:56:33 joerg Exp $
+#	$NetBSD: Makefile,v 1.13 2011/08/16 08:07:12 christos Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -62,6 +62,8 @@
 SRCS+=	generic.c
 . endif
 
+COPTS.db_output.c += -Wno-format-nonliteral
+
 # vers.c
 SRCS+=	vers.c
 vers.c:	${S}/conf/newvers.sh



CVS commit: src/usr.sbin/crash

2011-08-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 16 08:07:12 UTC 2011

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
document non-literal format


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2011-04-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 30 16:57:59 UTC 2011

Modified Files:
src/usr.sbin/crash: Makefile
Added Files:
src/usr.sbin/crash/arch: x86.c
Removed Files:
src/usr.sbin/crash/arch: i386.c

Log Message:
Share the amd64 and i386 files.
XXX: Is there a better way to get the cpu family?


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/crash/Makefile
cvs rdiff -u -r1.1 -r0 src/usr.sbin/crash/arch/i386.c
cvs rdiff -u -r0 -r1.1 src/usr.sbin/crash/arch/x86.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.10 src/usr.sbin/crash/Makefile:1.11
--- src/usr.sbin/crash/Makefile:1.10	Thu Apr 14 04:21:06 2011
+++ src/usr.sbin/crash/Makefile	Sat Apr 30 12:57:58 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2011/04/14 08:21:06 mrg Exp $
+#	$NetBSD: Makefile,v 1.11 2011/04/30 16:57:58 christos Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -37,9 +37,12 @@
 
 . if${MACHINE} == amd64 \
  || ${MACHINE} == i386
+MACHINE_FAMILY = x86
 .PATH:	${S}/arch/x86/x86
 SRCS+=	db_trace.c
 SRCS+=	db_machdep.c
+. else
+MACHINE_FAMILY = ${MACHINE}
 . endif
 
 . if ${MACHINE} == sparc64
@@ -51,8 +54,8 @@
 
 # arch.c
 .PATH:	${.CURDIR}/arch
-. if (exists(${.CURDIR}/arch/${MACHINE_ARCH}.c))
-SRCS+=	${MACHINE_ARCH}.c
+. if (exists(${.CURDIR}/arch/${MACHINE_FAMILY}.c))
+SRCS+=	${MACHINE_FAMILY}.c
 . else
 SRCS+=	generic.c
 . endif

Added files:

Index: src/usr.sbin/crash/arch/x86.c
diff -u /dev/null src/usr.sbin/crash/arch/x86.c:1.1
--- /dev/null	Sat Apr 30 12:57:59 2011
+++ src/usr.sbin/crash/arch/x86.c	Sat Apr 30 12:57:58 2011
@@ -0,0 +1,73 @@
+/*	$NetBSD: x86.c,v 1.1 2011/04/30 16:57:58 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+#ifndef lint
+__RCSID($NetBSD: x86.c,v 1.1 2011/04/30 16:57:58 christos Exp $);
+#endif /* not lint */
+
+#include ddb/ddb.h
+
+#include kvm.h
+#include nlist.h
+#include err.h
+#include stdlib.h
+
+#include machine/frame.h
+#include machine/pcb.h
+#include x86/db_machdep.h
+
+#include extern.h
+
+static struct nlist nl[] = {
+	{ .n_name = _dumppcb },
+	{ .n_name = NULL },
+};
+
+struct pcb	pcb;
+
+void
+db_mach_init(kvm_t *kd)
+{
+
+	if (kvm_nlist(kd, nl) == -1) {
+		errx(EXIT_FAILURE, kvm_nlist: %s, kvm_geterr(kd));
+	}
+	if ((size_t)kvm_read(kd, nl[0].n_value, pcb, sizeof(pcb)) !=
+	sizeof(pcb)) {
+		errx(EXIT_FAILURE, cannot read dumppcb: %s, kvm_geterr(kd));
+	}
+ddb_regs.tf_sp = pcb.pcb_sp;
+ddb_regs.tf_bp = pcb.pcb_bp;
+if (ddb_regs.tf_bp != 0  ddb_regs.tf_sp != 0) {
+	printf(Backtrace from time of crash is available.\n);
+	}
+}



CVS commit: src/usr.sbin/crash

2011-04-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr 30 16:57:59 UTC 2011

Modified Files:
src/usr.sbin/crash: Makefile
Added Files:
src/usr.sbin/crash/arch: x86.c
Removed Files:
src/usr.sbin/crash/arch: i386.c

Log Message:
Share the amd64 and i386 files.
XXX: Is there a better way to get the cpu family?


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/crash/Makefile
cvs rdiff -u -r1.1 -r0 src/usr.sbin/crash/arch/i386.c
cvs rdiff -u -r0 -r1.1 src/usr.sbin/crash/arch/x86.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2011-04-14 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Apr 14 08:21:06 UTC 2011

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
enable crash(8) for sparc64.  it's still sort of minimal and segvs
on some commands, but it sort of works and isn't useless.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.9 src/usr.sbin/crash/Makefile:1.10
--- src/usr.sbin/crash/Makefile:1.9	Tue Apr 12 01:47:20 2011
+++ src/usr.sbin/crash/Makefile	Thu Apr 14 08:21:06 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2011/04/12 01:47:20 mrg Exp $
+#	$NetBSD: Makefile,v 1.10 2011/04/14 08:21:06 mrg Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -9,10 +9,15 @@
 
 # some ddb kernel components need limited modifications.  for now,
 # punt if not noted as implemented here.
-.if${MACHINE} != amd64 \
- ${MACHINE} != i386
-SRCS+=	unsupported.c
+.if${MACHINE} == amd64 \
+|| ${MACHINE} == i386 \
+|| ${MACHINE} == sparc64
+REALCRASH=yes
 .else
+REALCRASH=no
+.endif
+
+.if ${REALCRASH} != no	# {
 
 S=		${.CURDIR}/../../sys
 
@@ -28,11 +33,17 @@
 SRCS+=	db_sym.c db_variables.c db_write_cmd.c
 
 .PATH:	${S}/arch/${MACHINE}/${MACHINE}
-SRCS+=	db_machdep.c db_disasm.c
+SRCS+=	db_disasm.c
 
-. if empty(${MACHINE:C/(amd64|i386)//})
+. if${MACHINE} == amd64 \
+ || ${MACHINE} == i386
 .PATH:	${S}/arch/x86/x86
 SRCS+=	db_trace.c
+SRCS+=	db_machdep.c
+. endif
+
+. if ${MACHINE} == sparc64
+SRCS+=	db_trace.c db_interface.c
 . endif
 
 # crash main source
@@ -52,7 +63,11 @@
 	${HOST_SH} ${S}/conf/newvers.sh -r
 CLEANFILES+=	vers.c version
 
-.endif
+.else# } {
+
+SRCS+=	unsupported.c
+
+.endif# }
 
 .include bsd.prog.mk
 .include bsd.klinks.mk



CVS commit: src/usr.sbin/crash

2011-04-14 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Apr 14 08:21:06 UTC 2011

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
enable crash(8) for sparc64.  it's still sort of minimal and segvs
on some commands, but it sort of works and isn't useless.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2011-04-11 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Apr 12 01:47:20 UTC 2011

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
replace a non-working make construct with a working one.
now crash only builds unsupported.c on non-x86 systems again.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.8 src/usr.sbin/crash/Makefile:1.9
--- src/usr.sbin/crash/Makefile:1.8	Mon Apr 11 04:22:32 2011
+++ src/usr.sbin/crash/Makefile	Tue Apr 12 01:47:20 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.8 2011/04/11 04:22:32 mrg Exp $
+#	$NetBSD: Makefile,v 1.9 2011/04/12 01:47:20 mrg Exp $
 
 PROG=		crash
 MAN=		crash.8
@@ -9,7 +9,8 @@
 
 # some ddb kernel components need limited modifications.  for now,
 # punt if not noted as implemented here.
-.if !empty(${MACHINE:C/(amd64|i386)//})
+.if${MACHINE} != amd64 \
+ ${MACHINE} != i386
 SRCS+=	unsupported.c
 .else
 



CVS commit: src/usr.sbin/crash

2011-04-11 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Apr 12 01:47:20 UTC 2011

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
replace a non-working make construct with a working one.
now crash only builds unsupported.c on non-x86 systems again.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2011-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 20:39:43 UTC 2011

Modified Files:
src/usr.sbin/crash: Makefile crash.c

Log Message:
- amd64 support
- fix end of file handling
From: Vladimir Kirillov proger at wilab dot org dot ua


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/crash/Makefile
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/crash/crash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.6 src/usr.sbin/crash/Makefile:1.7
--- src/usr.sbin/crash/Makefile:1.6	Mon Mar 21 01:09:33 2011
+++ src/usr.sbin/crash/Makefile	Sun Apr 10 16:39:42 2011
@@ -1,24 +1,23 @@
-#	$NetBSD: Makefile,v 1.6 2011/03/21 05:09:33 joerg Exp $
+#	$NetBSD: Makefile,v 1.7 2011/04/10 20:39:42 christos Exp $
 
-PROG=	crash
-MAN=	crash.8
+PROG=		crash
+MAN=		crash.8
 RUMPKERNEL=	yes	# XXX: Avoid -mcmodel=kernel
 
-LDADD+=	-lkvm -ledit -lterminfo -T${.CURDIR}/ldscript.crash
-DPADD+=	${LIBKVM} ${LIBEDIT} ${LIBTERMINFO}
+LDADD+=	-lutil -lkvm -ledit -lterminfo -T${.CURDIR}/ldscript.crash
+DPADD+=	${LIBUTIL} ${LIBKVM} ${LIBEDIT} ${LIBTERMINFO}
 
 # some ddb kernel components need limited modifications.  for now,
 # punt if not noted as implemented here.
-.if (${MACHINE} != i386)
-
+.if !empty(${MACHINE:C/(amd64|i386)//})
 SRCS+=	unsupported.c
-
 .else
 
-S=	${.CURDIR}/../../sys
+S=		${.CURDIR}/../../sys
 
 CPPFLAGS+=	-I${.CURDIR} -I${.OBJDIR} -I${S} -fno-strict-aliasing
 CPPFLAGS+=	-DDDB_VERBOSE_HELP -DDB_MAX_LINE=1000 -D_KMEMUSER
+CPPFLAGS+=	-DDB_AOUT_SYMBOLS -UDB_MACHINE_COMMANDS
 
 # ddb files from kernel
 .PATH:	$S/ddb
@@ -27,24 +26,24 @@
 SRCS+=	db_expr.c db_lex.c db_output.c db_print.c
 SRCS+=	db_sym.c db_variables.c db_write_cmd.c
 
-# db_trace.c, db_disasm.c
-.PATH:	${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}
-.for i in ${i} db_disasm db_trace
-. if (exists(${S}/arch/${MACHINE_ARCH}/${MACHINE_ARCH}/${i}.c))
-SRCS+=	${i}.c
+.PATH:	${S}/arch/${MACHINE}/${MACHINE}
+SRCS+=	db_machdep.c db_disasm.c
+
+. if empty(${MACHINE:C/(amd64|i386)//})
+.PATH:	${S}/arch/x86/x86
+SRCS+=	db_trace.c
 . endif
-.endfor
 
 # crash main source
 SRCS+=	crash.c
 
 # arch.c
 .PATH:	${.CURDIR}/arch
-.if (exists(${.CURDIR}/arch/${MACHINE_ARCH}.c))
+. if (exists(${.CURDIR}/arch/${MACHINE_ARCH}.c))
 SRCS+=	${MACHINE_ARCH}.c
-.else
+. else
 SRCS+=	generic.c
-.endif
+. endif
 
 # vers.c
 SRCS+=	vers.c

Index: src/usr.sbin/crash/crash.c
diff -u src/usr.sbin/crash/crash.c:1.2 src/usr.sbin/crash/crash.c:1.3
--- src/usr.sbin/crash/crash.c:1.2	Thu Apr 16 02:52:08 2009
+++ src/usr.sbin/crash/crash.c	Sun Apr 10 16:39:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: crash.c,v 1.2 2009/04/16 06:52:08 lukem Exp $	*/
+/*	$NetBSD: crash.c,v 1.3 2011/04/10 20:39:42 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: crash.c,v 1.2 2009/04/16 06:52:08 lukem Exp $);
+__RCSID($NetBSD: crash.c,v 1.3 2011/04/10 20:39:42 christos Exp $);
 #endif /* not lint */
 
 #include ddb/ddb.h
@@ -52,18 +52,20 @@
 #include kvm.h
 #include err.h
 #include ctype.h
+#include util.h
 
 #include extern.h
 
 #define	MAXSTAB	(16 * 1024 * 1024)
 
-static kvm_t	*kd;
 db_regs_t	ddb_regs;
-History		*hist;
-HistEvent	he;
-EditLine	*elptr;
-char		imgrelease[16];
-FILE		*ofp;
+
+static kvm_t		*kd;
+static History		*hist;
+static HistEvent	he;
+static EditLine		*elptr;
+static char		imgrelease[16];
+static FILE		*ofp;
 
 static struct nlist nl[] = {
 #define	X_OSRELEASE	0
@@ -73,6 +75,18 @@
 	{ .n_name = NULL },
 };
 
+static void
+cleanup(void)
+{
+	if (ofp != stdout) {
+		(void)fflush(ofp);
+		(void)pclose(ofp);
+		ofp = stdout;
+	}
+	el_end(elptr);
+	history_end(hist);
+}
+
 void
 db_vprintf(const char *fmt, va_list ap)
 {
@@ -121,14 +135,14 @@
 db_alloc(size_t sz)
 {
 
-	return malloc(sz);
+	return emalloc(sz);
 }
 
 void *
 db_zalloc(size_t sz)
 {
 
-	return calloc(1, sz);
+	return ecalloc(1, sz);
 }
 
 void
@@ -231,9 +245,8 @@
 
 	/* Read next command. */
 	el = el_gets(elptr, cnt);
-	if (el == NULL) {
-		*lstart = '\0';
-		return 0;
+	if (el == NULL) {	/* EOF */
+		exit(EXIT_SUCCESS);
 	}
 
 	/* Save to history, and copy to caller's buffer. */
@@ -255,7 +268,7 @@
 
 	/* Open a pipe to specified command, redirect output. */
 	assert(ofp == stdout);
-	for (*pcmd++ = '\0'; isspace((int)*pcmd); pcmd++) {
+	for (*pcmd++ = '\0'; isspace((unsigned char)*pcmd); pcmd++) {
 		/* nothing */
 	}
 	errno = 0;
@@ -323,6 +336,8 @@
 	memf = _PATH_MEM;
 	ofp = stdout;
 
+	setprogname(argv[0]);
+
 	/*
 	 * Parse options.
 	 */
@@ -354,31 +369,30 @@
 		return EXIT_FAILURE;
 	}
 	fd = open(nlistf, O_RDONLY);
-	if (fd  0)  {
-		err(EXIT_FAILURE, open(%s), nlistf);
+	if (fd == -1)  {
+		err(EXIT_FAILURE, open `%s', nlistf);
 	}
-	if (fstat(fd, sb)  0) {
-		err(EXIT_FAILURE, stat(%s), nlistf);
+	if (fstat(fd, sb) == -1) {
+		

CVS commit: src/usr.sbin/crash

2011-04-10 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Apr 10 22:49:52 UTC 2011

Modified Files:
src/usr.sbin/crash: crash.8

Log Message:
Synchronize -N option name in Synopsis with that in the Description


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/crash/crash.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/crash.8
diff -u src/usr.sbin/crash/crash.8:1.2 src/usr.sbin/crash/crash.8:1.3
--- src/usr.sbin/crash/crash.8:1.2	Sun Mar 15 21:43:28 2009
+++ src/usr.sbin/crash/crash.8	Sun Apr 10 22:49:52 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: crash.8,v 1.2 2009/03/15 21:43:28 wiz Exp $
+.\	$NetBSD: crash.8,v 1.3 2011/04/10 22:49:52 pgoyette Exp $
 .\
 .\ Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -36,7 +36,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl M Ar core
-.Op Fl N Ar system
+.Op Fl N Ar kernel
 .Sh DESCRIPTION
 The
 .Nm



CVS commit: src/usr.sbin/crash

2011-04-10 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Apr 10 22:49:52 UTC 2011

Modified Files:
src/usr.sbin/crash: crash.8

Log Message:
Synchronize -N option name in Synopsis with that in the Description


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/crash/crash.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2011-03-20 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Mar 21 05:09:34 UTC 2011

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Create vers.c with -r, there is no point in embedding an ever changing
token that isn't even used.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.5 src/usr.sbin/crash/Makefile:1.6
--- src/usr.sbin/crash/Makefile:1.5	Fri Apr 23 02:10:01 2010
+++ src/usr.sbin/crash/Makefile	Mon Mar 21 05:09:33 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2010/04/23 02:10:01 christos Exp $
+#	$NetBSD: Makefile,v 1.6 2011/03/21 05:09:33 joerg Exp $
 
 PROG=	crash
 MAN=	crash.8
@@ -49,7 +49,7 @@
 # vers.c
 SRCS+=	vers.c
 vers.c:	${S}/conf/newvers.sh
-	${HOST_SH} ${S}/conf/newvers.sh
+	${HOST_SH} ${S}/conf/newvers.sh -r
 CLEANFILES+=	vers.c version
 
 .endif



CVS commit: src/usr.sbin/crash

2011-03-20 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Mar 21 05:09:34 UTC 2011

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Create vers.c with -r, there is no point in embedding an ever changing
token that isn't even used.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




CVS commit: src/usr.sbin/crash

2010-04-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 23 02:10:02 UTC 2010

Modified Files:
src/usr.sbin/crash: Makefile
Added Files:
src/usr.sbin/crash: ldscript.crash

Log Message:
workaround for MKPIE=yes until binutils-2.20.1 is imported. From Piotr Meyer


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/crash/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.sbin/crash/ldscript.crash

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.4 src/usr.sbin/crash/Makefile:1.5
--- src/usr.sbin/crash/Makefile:1.4	Wed Feb  3 10:34:46 2010
+++ src/usr.sbin/crash/Makefile	Thu Apr 22 22:10:01 2010
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.4 2010/02/03 15:34:46 roy Exp $
+#	$NetBSD: Makefile,v 1.5 2010/04/23 02:10:01 christos Exp $
 
 PROG=	crash
 MAN=	crash.8
 RUMPKERNEL=	yes	# XXX: Avoid -mcmodel=kernel
 
-LDADD+=	-lkvm -ledit -lterminfo
+LDADD+=	-lkvm -ledit -lterminfo -T${.CURDIR}/ldscript.crash
 DPADD+=	${LIBKVM} ${LIBEDIT} ${LIBTERMINFO}
 
 # some ddb kernel components need limited modifications.  for now,

Added files:

Index: src/usr.sbin/crash/ldscript.crash
diff -u /dev/null src/usr.sbin/crash/ldscript.crash:1.1
--- /dev/null	Thu Apr 22 22:10:02 2010
+++ src/usr.sbin/crash/ldscript.crash	Thu Apr 22 22:10:01 2010
@@ -0,0 +1,9 @@
+
+SECTIONS
+{
+  .note.netbsd.ident :
+  { 
+KEEP(*(.note.netbsd.ident));
+  }
+}
+INSERT AFTER .gnu.version_r;



CVS commit: src/usr.sbin/crash

2010-04-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr 23 02:10:02 UTC 2010

Modified Files:
src/usr.sbin/crash: Makefile
Added Files:
src/usr.sbin/crash: ldscript.crash

Log Message:
workaround for MKPIE=yes until binutils-2.20.1 is imported. From Piotr Meyer


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/crash/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.sbin/crash/ldscript.crash

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/crash

2009-06-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun  4 12:19:35 UTC 2009

Modified Files:
src/usr.sbin/crash: Makefile

Log Message:
Avoid -mcmodel=kernel so that we can build in PIC mode.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/crash/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/Makefile
diff -u src/usr.sbin/crash/Makefile:1.2 src/usr.sbin/crash/Makefile:1.3
--- src/usr.sbin/crash/Makefile:1.2	Wed Apr 22 11:23:02 2009
+++ src/usr.sbin/crash/Makefile	Thu Jun  4 08:19:35 2009
@@ -1,7 +1,8 @@
-#	$NetBSD: Makefile,v 1.2 2009/04/22 15:23:02 lukem Exp $
+#	$NetBSD: Makefile,v 1.3 2009/06/04 12:19:35 christos Exp $
 
 PROG=	crash
 MAN=	crash.8
+RUMPKERNEL=	yes	# XXX: Avoid -mcmodel=kernel
 
 LDADD+=	-lkvm -ledit -ltermcap
 DPADD+=	${LIBKVM} ${LIBEDIT} ${LIBTERMCAP}



CVS commit: src/usr.sbin/crash

2009-04-16 Thread Luke Mewburn
Module Name:src
Committed By:   lukem
Date:   Thu Apr 16 06:52:08 UTC 2009

Modified Files:
src/usr.sbin/crash: crash.c

Log Message:
Fix -Wsign-compare issues


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/crash/crash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/crash/crash.c
diff -u src/usr.sbin/crash/crash.c:1.1 src/usr.sbin/crash/crash.c:1.2
--- src/usr.sbin/crash/crash.c:1.1	Sat Mar  7 22:08:08 2009
+++ src/usr.sbin/crash/crash.c	Thu Apr 16 06:52:08 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: crash.c,v 1.1 2009/03/07 22:08:08 ad Exp $	*/
+/*	$NetBSD: crash.c,v 1.2 2009/04/16 06:52:08 lukem Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: crash.c,v 1.1 2009/03/07 22:08:08 ad Exp $);
+__RCSID($NetBSD: crash.c,v 1.2 2009/04/16 06:52:08 lukem Exp $);
 #endif /* not lint */
 
 #include ddb/ddb.h
@@ -99,7 +99,7 @@
 db_write_bytes(db_addr_t addr, size_t size, const char *str)
 {
 
-	if (kvm_write(kd, addr, str, size) != size) {
+	if ((size_t)kvm_write(kd, addr, str, size) != size) {
 		warnx(kvm_write(%p, %zd): %s, (void *)addr, size,
 		kvm_geterr(kd));
 		longjmp(db_recover);
@@ -110,7 +110,7 @@
 db_read_bytes(db_addr_t addr, size_t size, char *str)
 {
 
-	if (kvm_read(kd, addr, str, size) != size) {
+	if ((size_t)kvm_read(kd, addr, str, size) != size) {
 		warnx(kvm_read(%p, %zd): %s, (void *)addr, size,
 		kvm_geterr(kd));
 		longjmp(db_recover);