'Generic Commit'
Some checks failed
Build-Test-Publish / build (push) Failing after 11m30s

This commit is contained in:
Your Name
2025-06-14 17:07:54 +12:00
parent 843af7248a
commit 46e2a7b345
2 changed files with 12 additions and 8 deletions

View File

@@ -127,8 +127,14 @@ void print_stacktrace() {
void* addr1 = __builtin_return_address(1); // assert_failed
void* addr2 = __builtin_return_address(2); // caller of ASSERT
if (addr1) addresses.push_back(addr1);
if (addr2) addresses.push_back(addr2);
// Adjust addresses to point to call site instead of return address
// Subtract a small offset to get the call instruction instead of the return address
if (addr1) {
addresses.push_back(static_cast<char*>(addr1) - 1);
}
if (addr2) {
addresses.push_back(static_cast<char*>(addr2) - 1);
}
if (addresses.empty()) {
std::cerr << " " << colors::red << "[no frames available]" << colors::reset << "\n";
@@ -160,13 +166,11 @@ void print_stacktrace() {
void assert_failed(
bool condition,
std::string_view message,
std::source_location location = std::source_location::current()
std::source_location location
) {
if (!condition) {
std::cerr << std::endl
<< "Assertion failed at " << location.file_name() << ":" << location.line() << ": "
<< location.function_name() << ": " << std::endl
<< colors::red << message << colors::reset << std::endl << std::endl;
std::cerr << colors::red << "Assertion failed at " << location.file_name() << ":" << location.line() << ": "
<< location.function_name() << ": " << message << colors::reset << "\n";
print_stacktrace();
std::abort();
}

View File

@@ -78,7 +78,7 @@ bool load_config(const std::string& config_path, ServerConfig& config) {
}
}
// Test incremental build comment
// Line number accuracy improved
return true;
} catch (const std::exception& e) {