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 Elischer 2004-07-19 18:03:02 +00:00
parent 36dd5f47d9
commit f6449d9d31
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=132412

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... */