gem5  v21.1.0.2
Macros
The Logger API.

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

Macros

#define panic(...)   exit_message(::gem5::Logger::getPanic(), __VA_ARGS__)
 This implements a cprintf based panic() function. More...
 
#define fatal(...)   exit_message(::gem5::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(::gem5::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 (GEM5_UNLIKELY(!(cond))) \
panic("assert(" # cond ") failed: %s", \
::gem5::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 301 of file logging.hh.

◆ fatal

#define fatal (   ...)    exit_message(::gem5::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 189 of file logging.hh.

◆ fatal_if

#define fatal_if (   cond,
  ... 
)
Value:
do { \
if (GEM5_UNLIKELY(cond)) { \
fatal("fatal condition " # cond " occurred: %s", \
::gem5::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 225 of file logging.hh.

◆ hack_once

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

Definition at line 253 of file logging.hh.

◆ panic

#define panic (   ...)    exit_message(::gem5::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 177 of file logging.hh.

◆ panic_if

#define panic_if (   cond,
  ... 
)
Value:
do { \
if (GEM5_UNLIKELY(cond)) { \
panic("panic condition " # cond " occurred: %s", \
::gem5::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 203 of file logging.hh.

◆ warn_if_once

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

Definition at line 278 of file logging.hh.

gem5::csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:161
gem5::ArmISA::cond
cond
Definition: pcstate.hh:62

Generated on Tue Sep 21 2021 12:27:01 for gem5 by doxygen 1.8.17