Files
rgbds/src/backtrace.cpp
T
RangiandISSOtm b732f59472 Improve handling of platform-specific build options (#2162)
* Opt into POSIX functions with `_POSIX_C_SOURCE` before any system
  headers are `#include`d
* Allow user to override `make develop`'s `WARNFLAGS` and `CXXFLAGS`
* Use `make develop` on 32-bit Cygwin with sanitizers disabled
* Do not unnecessarily redefine `fseek` and `ftell`
* Disable a false-positive `-Wno-null-dereference` on 32-bit Cygwin

Co-authored-by: ISSOtm <[email protected]>
2026-09-26 16:31:25 -04:00

35 lines
717 B
C++

// SPDX-License-Identifier: MIT
#include "platform.hpp" // strcasecmp
#include "backtrace.hpp"
#include <optional>
#include <stdint.h>
#include "util.hpp" // parseWholeNumber
Tracing tracing;
bool trace_ParseTraceDepth(char const *arg) {
if (!strcasecmp(arg, "collapse")) {
tracing.collapse = true;
return true;
} else if (!strcasecmp(arg, "no-collapse")) {
tracing.collapse = false;
return true;
} else if (!strcasecmp(arg, "all")) {
tracing.loud = true;
return true;
} else if (!strcasecmp(arg, "no-all")) {
tracing.loud = false;
return true;
} else {
std::optional<uint64_t> depth = parseWholeNumber(arg);
if (depth) {
tracing.depth = *depth;
}
return depth.has_value();
}
}