File:  [Isaki's NoNo m68k/m88k emulator] / nono / lib / panic.cpp
Revision 1.1.1.3 (vendor branch): download - view: text, annotated - select for diffs
Wed Apr 29 17:05:26 2026 UTC (2 months, 3 weeks ago) by root
Branches: MAIN, Isaki
CVS tags: v027, v026, v025, v024, v023, v022, v021, v020, HEAD
nono 1.0.0

//
// nono
// Copyright (C) 2022 nono project
// Licensed under nono-license.txt
//

//
// パニック
//

#include "nono.h"
#include "mpu.h"

// パニック (PC を表示しない)
void
panic_func(const char *funcname, const char *fmt, ...)
{
	char fmtbuf[1024];
	va_list ap;

	va_start(ap, fmt);
	vsnprintf(fmtbuf, sizeof(fmtbuf), fmt, ap);
	va_end(ap);

	// panic の場合ここでプロセス終了するのでログではなく stderr に出力
	fprintf(stderr, "panic! %s at %s\n", fmtbuf, funcname);
	abort();
}

// VM 用パニック (PC を表示する)
void
vmpanic_func(const char *funcname, const char *fmt, ...)
{
	char fmtbuf[1024];
	va_list ap;

	va_start(ap, fmt);
	vsnprintf(fmtbuf, sizeof(fmtbuf), fmt, ap);
	va_end(ap);

	// panic の場合ここでプロセス終了するのでログではなく stderr に出力
	auto mpu = GetMPUDevice();
	fprintf(stderr, "panic! PC=$%08x %s at %s\n",
		mpu->GetPPC(), fmtbuf, funcname);
	abort();
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.