Commit df17a761 by Sean Risser

Make abort on LOG_TRAP opt-in

A developer can change SWIFTSHADER_LOG_LEVEL to Debug or Verbose to make LOG_TRAP abort when a debugger is attached. This keeps debugging easy in most circumstances where devs don't care about unsupported struct extensions. But it still allows devs to go right to where an unsupported structure is being used if they so desire. Bug: b/169868497 Change-Id: I916506ee557f8de01516fe4efb33044c2367db77 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/49288Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Kokoro-Result: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarSean Risser <srisser@google.com>
parent a23231ea
...@@ -219,9 +219,10 @@ void log_trap(const char *format, ...) ...@@ -219,9 +219,10 @@ void log_trap(const char *format, ...)
// If enabled, log_assert will log all messages, and otherwise ignore them // If enabled, log_assert will log all messages, and otherwise ignore them
// unless a debugger is attached. // unless a debugger is attached.
static std::atomic<bool> asserted = { false }; static std::atomic<bool> asserted = { false };
if(IsUnderDebugger() && !asserted.exchange(true)) if(IsUnderDebugger() && !asserted.exchange(true) && static_cast<int>(Level::Debug) >= static_cast<int>(Level::SWIFTSHADER_LOGGING_LEVEL))
{ {
// Abort after tracing and printing to stderr // If a developer wants to be aware of what's happening,
// then we abort after tracing and printing to stderr
va_list vararg; va_list vararg;
va_start(vararg, format); va_start(vararg, format);
logv(Level::Fatal, format, vararg); logv(Level::Fatal, format, vararg);
......
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