DDraceNetwork Documentation
Loading...
Searching...
No Matches
Debugging

Macros

#define dbg_assert(test, fmt, ...)
#define dbg_assert_failed(fmt, ...)

Typedefs

typedef std::function< void(const char *message)> DBG_ASSERT_HANDLER

Functions

void dbg_assert_imp (const char *filename, int line, const char *fmt,...)
bool dbg_assert_has_failed ()
void dbg_break ()
void dbg_assert_set_handler (DBG_ASSERT_HANDLER handler)
void dbg_msg (const char *sys, const char *fmt,...)

Detailed Description

Utilities for debugging.

Macro Definition Documentation

◆ dbg_assert

#define dbg_assert ( test,
fmt,
... )
Value:
do \
{ \
if(!(test)) \
{ \
dbg_assert_imp(__FILE__, __LINE__, fmt, ##__VA_ARGS__); \
} \
} while(false)

Breaks into the debugger based on a test.

Parameters
testResult of the test.
fmtA printf styled format message that should be printed if the test fails.
Remarks
Also works in release mode.
See also
dbg_break

◆ dbg_assert_failed

#define dbg_assert_failed ( fmt,
... )
Value:
dbg_assert_imp(__FILE__, __LINE__, fmt, ##__VA_ARGS__)
void dbg_assert_imp(const char *filename, int line, const char *fmt,...)
Definition dbg.cpp:21

Breaks into the debugger with a message.

Parameters
fmtA printf styled format message that should be printed in case the code is reached.
Remarks
Also works in release mode.
See also
dbg_break

Typedef Documentation

◆ DBG_ASSERT_HANDLER

typedef std::function<void(const char *message)> DBG_ASSERT_HANDLER

Callback function type for dbg_assert_set_handler.

Parameters
messageThe message that a dbg_assert is failing with.
See also
dbg_assert_set_handler

Function Documentation

◆ dbg_assert_has_failed()

bool dbg_assert_has_failed ( )

Checks whether the program is currently shutting down due to a failed assert.

Returns
indication whether the program is currently shutting down due to a failed assert.
See also
dbg_assert

◆ dbg_assert_imp()

void dbg_assert_imp ( const char * filename,
int line,
const char * fmt,
... )

Use the dbg_assert function instead!

See also
dbg_assert

◆ dbg_assert_set_handler()

void dbg_assert_set_handler ( DBG_ASSERT_HANDLER handler)

Sets a callback function that will be invoked before breaking into the debugger in dbg_assert.

Remarks
Also works in release mode.
See also
dbg_assert

◆ dbg_break()

void dbg_break ( )

Breaks into the debugger.

Remarks
Also works in release mode.
See also
dbg_assert

◆ dbg_msg()

void dbg_msg ( const char * sys,
const char * fmt,
... )

Prints a debug message.

Parameters
sysA string that describes what system the message belongs to.
fmtA printf styled format string.
Remarks
Also works in release mode.
Deprecated
Use log_* functions with appropriate severity instead.