Store formatted panic string in static buffer to make it available later

for savecore.
Previous code give only panic format to savecore
This commit is contained in:
Andrey A. Chernov 1998-09-06 06:25:18 +00:00
parent 85a5d7a93d
commit 99237364cc
3 changed files with 22 additions and 7 deletions

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94
* $Id: kern_shutdown.c,v 1.36 1998/08/19 20:20:52 des Exp $
* $Id: kern_shutdown.c,v 1.37 1998/08/23 14:18:08 des Exp $
*/
#include "opt_ddb.h"
@ -399,6 +399,7 @@ panic(const char *fmt, ...)
{
int bootopt;
va_list ap;
static char buf[256];
bootopt = RB_AUTOBOOT | RB_DUMP;
if (panicstr)
@ -406,11 +407,12 @@ panic(const char *fmt, ...)
else
panicstr = fmt;
printf("panic: ");
va_start(ap, fmt);
vprintf(fmt, ap);
(void)vsprintf(buf, fmt, ap);
if (panicstr == fmt)
panicstr = buf;
va_end(ap);
printf("\n");
printf("panic: %s\n", buf);
#ifdef SMP
/* three seperate prints in case of an unmapped page and trap */
printf("mp_lock = %08x; ", mp_lock);
@ -499,4 +501,3 @@ rm_at_shutdown(bootlist_fn function, void *arg)
}
return (count);
}

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)subr_prf.c 8.3 (Berkeley) 1/21/94
* $Id: subr_prf.c,v 1.48 1998/07/15 02:32:11 bde Exp $
* $Id: subr_prf.c,v 1.49 1998/08/10 14:27:34 bde Exp $
*/
#include <sys/param.h>
@ -315,6 +315,19 @@ sprintf(char *buf, const char *cfmt, ...)
return retval;
}
/*
* Scaled down version of vsprintf(3).
*/
int
vsprintf(char *buf, const char *cfmt, va_list ap)
{
int retval;
retval = kvprintf(cfmt, NULL, (void *)buf, 10, ap);
buf[retval] = '\0';
return retval;
}
/*
* Put a number (base <= 16) in a buffer in reverse order; return an
* optional length and a pointer to the NULL terminated (preceded?)

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)systm.h 8.7 (Berkeley) 3/29/95
* $Id: systm.h,v 1.73 1998/07/13 06:45:17 bde Exp $
* $Id: systm.h,v 1.74 1998/08/05 18:18:06 bde Exp $
*/
#ifndef _SYS_SYSTM_H_
@ -110,6 +110,7 @@ int printf __P((const char *, ...)) __printflike(1, 2);
int sprintf __P((char *buf, const char *, ...)) __printflike(2, 3);
void uprintf __P((const char *, ...)) __printflike(1, 2);
void vprintf __P((const char *, _BSD_VA_LIST_)) __printflike(1, 0);
int vsprintf __P((char *buf, const char *, _BSD_VA_LIST_)) __printflike(2, 0);
void ttyprintf __P((struct tty *, const char *, ...)) __printflike(2, 3);
void bcopy __P((const void *from, void *to, size_t len));