gem5  v20.1.0.0
Macros
The Logger API.

These methods and macros provide access to gem5's logging system. More...

Macros

#define panic(...)   exit_message(::Logger::getPanic(), __VA_ARGS__)
 This implements a cprintf based panic() function. More...
 
#define fatal(...)   exit_message(::Logger::getFatal(), __VA_ARGS__)
 This implements a cprintf based fatal() function. More...
 
#define panic_if(cond, ...)
 Conditional panic macro that checks the supplied condition and only panics if the condition is true and allows the programmer to specify diagnostic printout. More...
 
#define fatal_if(cond, ...)
 Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condition is true and allows the programmer to specify diagnostic printout. More...
 
#define chatty_assert(cond, ...)
 The chatty assert macro will function like a normal assert, but will allow the specification of additional, helpful material to aid debugging why the assertion actually failed. More...
 
#define hack_once(...)   base_message_once(::Logger::getHack(), __VA_ARGS__)
 
#define warn_if_once(cond, ...)
 

Detailed Description

These methods and macros provide access to gem5's logging system.

Macro Definition Documentation

◆ chatty_assert

#define chatty_assert (   cond,
  ... 
)
Value:
do { \
if (!(cond)) \
panic("assert(" # cond ") failed: %s", csprintf(__VA_ARGS__)); \
} while (0)

The chatty assert macro will function like a normal assert, but will allow the specification of additional, helpful material to aid debugging why the assertion actually failed.

NDEBUG.

Like the normal assertion, the chatty_assert will not be active in fast builds.

Parameters
condCondition that is checked; if false -> assert
...Printf-based format string with arguments, extends printout.

Definition at line 292 of file logging.hh.

◆ fatal

#define fatal (   ...)    exit_message(::Logger::getFatal(), __VA_ARGS__)

This implements a cprintf based fatal() function.

fatal() should be called when the simulation cannot continue due to some condition that is the user's fault (bad configuration, invalid arguments, etc.) and not a simulator bug. fatal() might call exit, unlike panic().

Definition at line 183 of file logging.hh.

◆ fatal_if

#define fatal_if (   cond,
  ... 
)
Value:
do { \
if ((cond)) { \
fatal("fatal condition " # cond " occurred: %s", \
csprintf(__VA_ARGS__)); \
} \
} while (0)

Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condition is true and allows the programmer to specify diagnostic printout.

Useful to replace if + fatal, or if + print + assert, etc.

Parameters
condCondition that is checked; if true -> fatal
...Printf-based format string with arguments, extends printout.

Definition at line 219 of file logging.hh.

◆ hack_once

#define hack_once (   ...)    base_message_once(::Logger::getHack(), __VA_ARGS__)

Definition at line 245 of file logging.hh.

◆ panic

#define panic (   ...)    exit_message(::Logger::getPanic(), __VA_ARGS__)

This implements a cprintf based panic() function.

panic() should be called when something happens that should never ever happen regardless of what the user does (i.e., an acutal m5 bug). panic() might call abort which can dump core or enter the debugger.

Definition at line 171 of file logging.hh.

◆ panic_if

#define panic_if (   cond,
  ... 
)
Value:
do { \
if ((cond)) { \
panic("panic condition " # cond " occurred: %s", \
csprintf(__VA_ARGS__)); \
} \
} while (0)

Conditional panic macro that checks the supplied condition and only panics if the condition is true and allows the programmer to specify diagnostic printout.

Useful to replace if + panic, or if + print + assert, etc.

Parameters
condCondition that is checked; if true -> panic
...Printf-based format string with arguments, extends printout.

Definition at line 197 of file logging.hh.

◆ warn_if_once

#define warn_if_once (   cond,
  ... 
)
Value:
do { \
if ((cond)) \
warn_once(__VA_ARGS__); \
} while (0)

Definition at line 269 of file logging.hh.

ArmISA::cond
cond
Definition: types.hh:61
csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:158

Generated on Wed Sep 30 2020 14:02:20 for gem5 by doxygen 1.8.17