mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Factor out shared backtrace code (#1793)
This commit is contained in:
21
src/backtrace.cpp
Normal file
21
src/backtrace.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#include "backtrace.hpp"
|
||||
|
||||
#include <stdlib.h> // strtoul
|
||||
|
||||
#include "platform.hpp" // strcasecmp
|
||||
|
||||
uint64_t traceDepth = 0;
|
||||
|
||||
bool trace_ParseTraceDepth(char const *arg) {
|
||||
if (!strcasecmp(arg, "collapse")) {
|
||||
traceDepth = TRACE_COLLAPSE;
|
||||
return true;
|
||||
}
|
||||
|
||||
char *endptr;
|
||||
traceDepth = strtoul(arg, &endptr, 0);
|
||||
|
||||
return arg[0] != '\0' && *endptr == '\0' && traceDepth != TRACE_COLLAPSE;
|
||||
}
|
||||
Reference in New Issue
Block a user