Allow the user who calls doadump() from the kernel debugger

to not get a page fault if he has not defined a dump device.
Panic can often not do a dump as it can hang forever in some cases.
 The original PR was for amd64 only. This is a generalised version of
that change.

PR:		amd64/67712
Submitted by:	wjw@withagen.nl <Willen Jan Withagen>
This commit is contained in:
julian 2004-07-19 18:03:02 +00:00
parent 7127c711e8
commit 87bb4394b8

View File

@ -231,6 +231,16 @@ static void
doadump(void)
{
/*
* Sometimes people have to call this from the kernel debugger.
* (if 'panic' can not dump)
* Give them a clue as to why they can't dump.
*/
if (dumper.dumper == NULL) {
printf("cannot dump. No dump device defined.\n");
return;
}
savectx(&dumppcb);
dumptid = curthread->td_tid;
dumping++;
@ -378,8 +388,7 @@ boot(int howto)
*/
EVENTHANDLER_INVOKE(shutdown_post_sync, howto);
splhigh();
if ((howto & (RB_HALT|RB_DUMP)) == RB_DUMP &&
!cold && dumper.dumper != NULL && !dumping)
if ((howto & (RB_HALT|RB_DUMP)) == RB_DUMP && !cold && !dumping)
doadump();
/* Now that we're going to really halt the system... */