Skip to content

File debug_log.h

FileList > muda > tools > debug_log.h

Go to the source code of this file

  • #include <cstdlib>
  • #include <cassert>
  • #include <muda/tools/fuzzy.h>
  • #include <muda/assert.h>
  • #include <muda/print.h>
  • #include <muda/muda_config.h>
  • #include <muda/muda_def.h>

Macros

Type Name
define MUDA_ASSERT (res, fmt, ...) MUDA_KERNEL_ASSERT(res, fmt, ##__VA_ARGS__)
define MUDA_DEBUG_TRAP ()
define MUDA_ERROR (fmt, ...) MUDA_KERNEL_ERROR(fmt, ##__VA_ARGS__)
define MUDA_ERROR_WITH_LOCATION (fmt, ...) MUDA_KERNEL_ERROR_WITH_LOCATION(fmt, ##__VA_ARGS__)
define MUDA_KERNEL_ASSERT (res, fmt, ...)
define MUDA_KERNEL_CHECK (res, fmt, ...)
define MUDA_KERNEL_ERROR (fmt, ...)
define MUDA_KERNEL_ERROR_WITH_LOCATION (fmt, ...)
define MUDA_KERNEL_PRINT (fmt, ...)
define MUDA_KERNEL_WARN (fmt, ...)
define MUDA_KERNEL_WARN_WITH_LOCATION (fmt, ...)

Macro Definition Documentation

define MUDA_ASSERT

#define MUDA_ASSERT (
    res,
    fmt,
    ...
) MUDA_KERNEL_ASSERT(res, fmt, ##__VA_ARGS__)

define MUDA_DEBUG_TRAP

#define MUDA_DEBUG_TRAP (

) {                                                                          \
        if constexpr(::muda::TRAP_ON_ERROR)                                    \
            ::muda::trap();                                                    \
    }

define MUDA_ERROR

#define MUDA_ERROR (
    fmt,
    ...
) MUDA_KERNEL_ERROR(fmt, ##__VA_ARGS__)

define MUDA_ERROR_WITH_LOCATION

#define MUDA_ERROR_WITH_LOCATION (
    fmt,
    ...
) MUDA_KERNEL_ERROR_WITH_LOCATION(fmt, ##__VA_ARGS__)

define MUDA_KERNEL_ASSERT

#define MUDA_KERNEL_ASSERT (
    res,
    fmt,
    ...
) {                                                                             \
        if constexpr(::muda::RUNTIME_CHECK_ON)                                    \
        {                                                                         \
            if(!(res))                                                            \
            {                                                                     \
                MUDA_KERNEL_PRINT("%s(%d): %s:\n <assert> " #res " failed. " fmt, \
                                  __FILE__,                                       \
                                  __LINE__,                                       \
                                  MUDA_FUNCTION_SIG,                              \
                                  ##__VA_ARGS__);                                 \
                MUDA_DEBUG_TRAP();                                                \
            }                                                                     \
        }                                                                         \
    }

define MUDA_KERNEL_CHECK

#define MUDA_KERNEL_CHECK (
    res,
    fmt,
    ...
) {                                                                            \
        if constexpr(::muda::RUNTIME_CHECK_ON)                                   \
        {                                                                        \
            if(!(res))                                                           \
            {                                                                    \
                MUDA_KERNEL_PRINT("%s(%d): %s:\n <check> " #res " failed. " fmt, \
                                  __FILE__,                                      \
                                  __LINE__,                                      \
                                  MUDA_FUNCTION_SIG,                             \
                                  ##__VA_ARGS__);                                \
            }                                                                    \
        }                                                                        \
    }

define MUDA_KERNEL_ERROR

#define MUDA_KERNEL_ERROR (
    fmt,
    ...
) {                                                                          \
        MUDA_KERNEL_PRINT("<error> " fmt, ##__VA_ARGS__);                      \
        MUDA_DEBUG_TRAP();                                                     \
    }

define MUDA_KERNEL_ERROR_WITH_LOCATION

#define MUDA_KERNEL_ERROR_WITH_LOCATION (
    fmt,
    ...
) {                                                                                                          \
        MUDA_KERNEL_PRINT("%s(%d): %s:\n <error> " fmt, __FILE__, __LINE__, MUDA_FUNCTION_SIG, ##__VA_ARGS__); \
        MUDA_DEBUG_TRAP();                                                                                     \
    }

define MUDA_KERNEL_PRINT

#define MUDA_KERNEL_PRINT (
    fmt,
    ...
) {                                                                          \
        ::muda::print("(host):" fmt "\n", ##__VA_ARGS__);                      \
    }

define MUDA_KERNEL_WARN

#define MUDA_KERNEL_WARN (
    fmt,
    ...
) {                                                                          \
        MUDA_KERNEL_PRINT("<warn>" fmt, ##__VA_ARGS__);                        \
    }

define MUDA_KERNEL_WARN_WITH_LOCATION

#define MUDA_KERNEL_WARN_WITH_LOCATION (
    fmt,
    ...
) {                                                                                                        \
        MUDA_KERNEL_PRINT("%s(%d): %s:\n <warn>" fmt, __FILE__, __LINE__, MUDA_FUNCTION_SIG, ##__VA_ARGS__); \
    }


The documentation for this class was generated from the following file src/muda/tools/debug_log.h