flatten 20260225

This commit is contained in:
Timothy Prepscius
2026-02-25 12:43:06 -05:00
commit 996151a56a
521 changed files with 46722 additions and 0 deletions

43
tjp/core/debug/glib/Stack.cpp Executable file
View File

@@ -0,0 +1,43 @@
// License: Modified MIT (NON-AI)
// See the LICENSE file in the root directory for license information.
// Copyright 2025 Timothy Prepscius
#ifdef TJP_CORE_HEADER_ONLY
#pragma once
#endif
#include "../../header_only/compile.h"
#include "../Stack.h"
#include "../../system/System.h"
#include <execinfo.h>
#include <sstream>
namespace tjp {
namespace core {
TJP_CORE_HEADER_ONLY_INLINE
std::string getStackString(int maxStackDepth)
{
void* trace[64];
if (maxStackDepth > 64) maxStackDepth = 64;
char** messages = NULL;
int trace_size = 0;
std::ostringstream out;
trace_size = backtrace( trace, maxStackDepth );
messages = backtrace_symbols( trace, trace_size );
for( int i = 2; i < trace_size; ++i ) {
out << "\t" << messages[i] << std::endl;
}
free (messages);
return out.str();
}
} // namespace
} // namespace