Commit fab78645 authored by Ryan Pavlik's avatar Ryan Pavlik Committed by Jakob Bornecrantz
Browse files

st/oxr: Add a debug option to break/trap on error.

Might be useful for debugging, since once the consuming call has returned,
you've lost most of the context of what led to the error.
parent af2756b5
......@@ -16,8 +16,13 @@
#include "oxr_objects.h"
#include "oxr_logger.h"
#ifdef _MSC_VER
// needed for __debugbreak()
#include <intrin.h>
#endif // _MSC_VER
static const char *
oxr_result_to_string(XrResult result);
......@@ -85,12 +90,22 @@ oxr_error(struct oxr_logger *logger, XrResult result, const char *fmt, ...)
fprintf(stderr, " in %s", logger->api_func_name);
fprintf(stderr, ": ");
va_list args;
va_start(args, fmt);
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
if (debug_get_bool_option_break_on_error()) {
/// Trigger a debugger breakpoint.
#ifdef _MSC_VER
return result;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment