The Pedigree Project  0.1
assert.cc
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #include "pedigree/kernel/Log.h"
21 #include "pedigree/kernel/panic.h"
22 #include "pedigree/kernel/processor/Processor.h"
23 
24 extern "C" void _assert(bool b, const char *file, int line, const char *func)
25 {
26  if (b)
27  return;
28 
30  {
31  ERROR_NOLOCK("Assertion failed in file " << file);
32  ERROR_NOLOCK("In function '" << func << "'");
33  ERROR_NOLOCK("On line " << Dec << line << Hex << ".");
35 
36  ERROR_NOLOCK("You may not resume after a failed assertion.");
37  }
38 
39  // Best reason for a return is that the debugger isn't active. Either way,
40  // it's an error condition, panic.
41  panic("assertion failed");
42 }
void _assert(bool b, const char *file, int line, const char *func)
Definition: assert.cc:24
static size_t m_Initialised
Definition: Processor.h:371
Definition: Log.h:136
static void breakpoint()
Definition: Log.h:138
void EXPORTED_PUBLIC panic(const char *msg) NORETURN
Definition: panic.cc:121