debug: move the panic code out of assert

This commit is contained in:
Danny Robson 2021-04-12 16:11:14 +10:00
parent 6f8197c0e2
commit 6de8ed4831
2 changed files with 33 additions and 33 deletions

View File

@ -6,35 +6,4 @@
* Copyright 2010-2019 Danny Robson <danny@nerdcruft.net>
*/
#include "./assert.hpp"
#include "../backtrace.hpp"
#include "../log.hpp"
#include <iostream>
////////////////////////////////////////////////////////////////////////////////
void
cruft::debug::detail::panic (const char *msg)
{
std::cerr << "PANIC: " << msg << "\n" << ::cruft::backtrace () << std::endl;
breakpoint ();
abort ();
}
////////////////////////////////////////////////////////////////////////////////
void
cruft::debug::detail::not_implemented (const char *msg)
{
panic (msg);
}
//-----------------------------------------------------------------------------
void
cruft::debug::detail::unreachable (const char *msg)
{
panic (msg);
}
#include "./assert.hpp"

View File

@ -1 +1,32 @@
#include "panic.hpp"
#include "panic.hpp"
#include "./debugger.hpp"
#include "../backtrace.hpp"
#include <iostream>
////////////////////////////////////////////////////////////////////////////////
void
cruft::debug::detail::panic (const char *msg)
{
std::cerr << "PANIC: " << msg << "\n" << ::cruft::backtrace () << std::endl;
breakpoint ();
abort ();
}
////////////////////////////////////////////////////////////////////////////////
void
cruft::debug::detail::not_implemented (const char *msg)
{
panic (msg);
}
//-----------------------------------------------------------------------------
void
cruft::debug::detail::unreachable (const char *msg)
{
panic (msg);
}