Those are the SimGrid version of the good ol' assert macro.
You can pass them a format message and arguments, just as if it where a printf. It is converted to a XBT_CRITICAL logging request. Be careful: the boolean expression that you want to test should not have side effects, because assertions are disabled at compile time if NDEBUG is set.
◆ xbt_assert
#define xbt_assert |
( |
|
... | ) |
|
The condition which failed will be displayed.
- Examples:
- examples/msg/app-masterworker/app-masterworker.c, examples/msg/network-ns3/network-ns3.c, examples/msg/process-create/process-create.c, examples/msg/trace-categories/trace-categories.c, examples/msg/trace-host-user-variables/trace-host-user-variables.c, examples/msg/trace-link-user-variables/trace-link-user-variables.c, examples/msg/trace-masterworker/trace-masterworker.c, examples/msg/trace-process-migration/trace-process-migration.c, examples/msg/trace-route-user-variables/trace-route-user-variables.c, examples/s4u/actor-join/s4u-actor-join.cpp, examples/s4u/actor-kill/s4u-actor-kill.cpp, examples/s4u/actor-lifetime/s4u-actor-lifetime.cpp, examples/s4u/actor-migration/s4u-actor-migration.cpp, examples/s4u/actor-suspend/s4u-actor-suspend.cpp, examples/s4u/actor-yield/s4u-actor-yield.cpp, examples/s4u/app-bittorrent/s4u-bittorrent.cpp, examples/s4u/app-masterworker/s4u-app-masterworker.cpp, examples/s4u/app-pingpong/s4u-app-pingpong.cpp, examples/s4u/app-token-ring/s4u-app-token-ring.cpp, examples/s4u/async-wait/s4u-async-wait.cpp, examples/s4u/async-waitall/s4u-async-waitall.cpp, examples/s4u/async-waitany/s4u-async-waitany.cpp, examples/s4u/dht-chord/s4u-dht-chord.cpp, examples/s4u/energy-boot/s4u-energy-boot.cpp, examples/s4u/energy-exec/s4u-energy-exec.cpp, examples/s4u/energy-link/s4u-energy-link.cpp, examples/s4u/exec-basic/s4u-exec-basic.cpp, examples/s4u/exec-dvfs/s4u-exec-dvfs.cpp, examples/s4u/exec-ptask/s4u-exec-ptask.cpp, examples/s4u/platform-properties/s4u-platform-properties.cpp, examples/s4u/replay-comm/s4u-replay-comm.cpp, and examples/s4u/replay-storage/s4u-replay-storage.cpp.
◆ _xbt_assert_ARG1
#define _xbt_assert_ARG1 |
( |
|
cond | ) |
_xbt_assert_ARGN(cond, "Assertion %s failed", #cond) |
◆ _xbt_assert_ARGN
#define _xbt_assert_ARGN |
( |
|
cond, |
|
|
|
... |
|
) |
| |
Value:do { \
if (!(cond)) { \
XBT_CCRITICAL(
root, __VA_ARGS__); \
xbt_backtrace_display_current(); \
abort(); \
} \
} while (0)
void int MPI_Datatype int MPI_Aint int MPI_Datatype MPI_Op MPI_Win win void int MPI_Datatype void int MPI_Datatype MPI_Comm comm MPI_Aint MPI_Info void baseptr void int MPI_Datatype void int MPI_Datatype MPI_Comm comm MPI_Comm int keyval MPI_Comm int void attr_value void int MPI_Datatype int root
Definition: smpi_mpi.cpp:50
int xbt_log_no_loc
Definition: log.c:27
◆ xbt_die
Value:do { \
XBT_CCRITICAL(xbt, __VA_ARGS__); \
xbt_abort(); \
} while (0)
Kill the program with an error message.
- Parameters
-
... | a format string and its arguments |
Things are so messed up that the only thing to do now, is to stop the program.
The message is handled by a CRITICAL logging request, and may consist of a format string with arguments.
- Examples:
- examples/s4u/dht-chord/s4u-dht-chord.cpp.
◆ xbt_abort()
Kill the program in silence.