54# define debug_break __debugbreak
180ErrorReaction debug_DisplayError(
const wchar_t* description,
size_t flags,
void* context,
const wchar_t* lastFuncToSkip,
const wchar_t* file,
int line,
const char* func, std::atomic<bool>* suppress);
183#define DEBUG_DISPLAY_ERROR_IMPL(description, flags)\
186 CACHE_ALIGNED(std::uint8_t) context[DEBUG_CONTEXT_SIZE];\
187 (void)debug_CaptureContext(context);\
188 (void)debug_DisplayError(description, flags, context, L"debug_DisplayError", WIDEN(__FILE__), __LINE__, __func__, 0);\
192#define DEBUG_DISPLAY_ERROR(description) DEBUG_DISPLAY_ERROR_IMPL(description, 0)
194#define DEBUG_DISPLAY_FATAL_ERROR(description) DEBUG_DISPLAY_ERROR_IMPL(description, DE_NO_CONTINUE)
225 static std::atomic<bool> suppress__{ false };\
228 switch(debug_OnAssertionFailure(WIDEN(#expr), &suppress__, WIDEN(__FILE__), __LINE__, __func__))\
250#define ASSERT(expr) ENSURE(expr)
264#define debug_warn(expr) ENSURE(0 && (expr))
271#define DEBUG_WARN_ERR(status)\
274 static std::atomic<bool> suppress__{ false };\
275 switch(debug_OnError(status, &suppress__, WIDEN(__FILE__), __LINE__, __func__))\
482const wchar_t*
debug_BuildErrorMessage(
const wchar_t* description,
const wchar_t* fn_only,
int line,
const char* func,
void* context,
const wchar_t* lastFuncToSkip);
#define PRINTF_ARGS(fmtpos)
Definition: code_annotation.h:213
#define ANALYZER_NORETURN
mark a function as noreturn for static analyzer purposes.
Definition: code_annotation.h:76
Status debug_DumpStack(wchar_t *buf, size_t maxChars, void *context, const wchar_t *lastFuncToSkip)
write a complete stack trace (including values of local variables) into the specified buffer.
Definition: bdbg.cpp:52
const wchar_t * debug_BuildErrorMessage(const wchar_t *description, const wchar_t *fn_only, int line, const char *func, void *context, const wchar_t *lastFuncToSkip)
build a string describing the given error.
Definition: debug.cpp:178
ErrorReactionInternal
all choices offered by the error dialog.
Definition: debug.h:141
@ ERI_NOT_IMPLEMENTED
special return value for the display_error app hook stub to indicate that it has done nothing and tha...
Definition: debug.h:161
@ ERI_CONTINUE
Definition: debug.h:142
@ ERI_EXIT
exit the program immediately.
Definition: debug.h:154
@ ERI_SUPPRESS
ignore and do not report again.
Definition: debug.h:149
@ ERI_BREAK
Definition: debug.h:143
void debug_printf(const char *fmt,...) PRINTF_ARGS(1)
write a formatted string to the debug channel.
Definition: debug.cpp:71
void debug_puts(const char *text)
[system-dependent] write a string to the debug channel.
Definition: udbg.cpp:107
ErrorReaction debug_DisplayError(const wchar_t *description, size_t flags, void *context, const wchar_t *lastFuncToSkip, const wchar_t *file, int line, const char *func, std::atomic< bool > *suppress)
display an error dialog with a message and stack trace.
Definition: debug.cpp:331
size_t debug_StopSkippingErrors()
Definition: debug.cpp:404
void debug_DisplayMessage(const wchar_t *caption, const wchar_t *msg)
translates and displays the given strings in a dialog.
Definition: debug.cpp:254
ErrorReaction debug_OnError(Status err, std::atomic< bool > *suppress, const wchar_t *file, int line, const char *func) ANALYZER_NORETURN
called when a DEBUG_WARN_ERR indicates an error occurred; notifies the user via debug_DisplayError.
Definition: debug.cpp:433
static const size_t DEBUG_FILE_CHARS
Definition: debug.h:369
void debug_SkipErrors(Status err)
suppress (prevent from showing) the error dialog from subsequent debug_OnError for the given Status.
Definition: debug.cpp:391
Status debug_CaptureContext(void *context)
Definition: udbg.cpp:45
bool debug_IsStackPointer(void *p)
does the given pointer appear to point to the stack?
Definition: wdbg.cpp:77
void debug_break()
trigger a breakpoint when reached/"called".
Definition: udbg.cpp:51
void debug_SetThreadName(const char *name)
inform the debugger of the current thread's name.
Definition: bdbg.cpp:126
static const size_t DEBUG_SYMBOL_CHARS
Maximum number of characters (including null terminator) written to user's buffers by debug_ResolveSy...
Definition: debug.h:368
ErrorReaction
choices offered by the error dialog that are returned by debug_DisplayError.
Definition: debug.h:118
@ ER_CONTINUE
ignore, continue as if nothing happened.
Definition: debug.h:124
@ ER_BREAK
trigger breakpoint, i.e.
Definition: debug.h:131
static const size_t DEBUG_CONTEXT_SIZE
Definition: debug.h:391
DebugDisplayErrorFlags
flags to customize debug_DisplayError behavior
Definition: debug.h:83
@ DE_MANUAL_BREAK
do not trigger a breakpoint inside debug_DisplayError; caller will take care of this if ER_BREAK is r...
Definition: debug.h:104
@ DE_NO_CONTINUE
disallow the Continue button.
Definition: debug.h:87
@ DE_ALLOW_SUPPRESS
enable the Suppress button.
Definition: debug.h:97
@ DE_NO_DEBUG_INFO
display just the given message; do not add any information about the call stack, do not write crashlo...
Definition: debug.h:110
Status debug_WriteCrashlog(const char *text)
write an error description and all logs into crashlog.txt (in unicode format).
bool debug_IsCodePointer(void *p)
does the given pointer appear to point to code?
Definition: wdbg.cpp:62
ErrorReaction debug_OnAssertionFailure(const wchar_t *assert_expr, std::atomic< bool > *suppress, const wchar_t *file, int line, const char *func) ANALYZER_NORETURN
called when a ENSURE/ASSERT fails; notifies the user via debug_DisplayError.
Definition: debug.cpp:448
int debug_IsPointerBogus(const void *p)
check if a pointer appears to be totally invalid.
Definition: udbg.cpp:115
void * debug_GetCaller(void *context, const wchar_t *lastFuncToSkip)
return the caller of a certain function on the call stack.
Definition: bdbg.cpp:38
Status debug_ResolveSymbol(void *ptr_of_interest, wchar_t *sym_name, wchar_t *file, int *line)
read and return symbol information for the given address.
Definition: bdbg.cpp:99
const Status SYM_UNRETRIEVABLE
Definition: debug.h:343
const Status SYM_UNRETRIEVABLE_STATIC
Definition: debug.h:342
const Status SYM_CHILD_NOT_FOUND
Definition: debug.h:347
const Status SYM_TYPE_INFO_UNAVAILABLE
Definition: debug.h:344
const Status SYM_NO_STACK_FRAMES_FOUND
Definition: debug.h:341
const Status SYM_NESTING_LIMIT
Definition: debug.h:349
const Status SYM_INTERNAL_ERROR
Definition: debug.h:345
const Status SYM_UNSUPPORTED
Definition: debug.h:346
const Status SYM_SINGLE_SYMBOL_LIMIT
Definition: debug.h:352
const Status SYM_SUPPRESS_OUTPUT
Definition: debug.h:360
std::int64_t Status
Error handling system.
Definition: status.h:174