Skip to content

Commit

Permalink
vendor: Update vendored sources to duckdb/duckdb@5705d13 (#971)
Browse files Browse the repository at this point in the history
Clean-up stack traces on MacOS, fix demangling on Linux, and add `EXPORT_DYNAMIC_SYMBOLS` flag which enables stack traces on Linux (duckdb/duckdb#15587)
HTTPFS test - no longer check for IS NOT NULL filter as this is no longer necessary (duckdb/duckdb#15585)

Co-authored-by: krlmlr <[email protected]>
  • Loading branch information
github-actions[bot] and krlmlr authored Jan 7, 2025
1 parent 48b0c22 commit def035e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 5 deletions.
43 changes: 41 additions & 2 deletions src/duckdb/src/common/stacktrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static string UnmangleSymbol(string symbol) {
}
}
for (idx_t i = mangle_start; i < symbol.size(); i++) {
if (StringUtil::CharacterIsSpace(symbol[i])) {
if (StringUtil::CharacterIsSpace(symbol[i]) || symbol[i] == ')' || symbol[i] == '+') {
mangle_end = i;
break;
}
Expand All @@ -44,6 +44,45 @@ static string UnmangleSymbol(string symbol) {
return result;
}

static string CleanupStackTrace(string symbol) {
#ifdef __APPLE__
// structure of frame pointers is [depth] [library] [pointer] [symbol]
// we are only interested in [depth] and [symbol]

// find the depth
idx_t start;
for (start = 0; start < symbol.size(); start++) {
if (!StringUtil::CharacterIsDigit(symbol[start])) {
break;
}
}

// now scan forward until we find the frame pointer
idx_t frame_end = symbol.size();
for (idx_t i = start; i + 1 < symbol.size(); ++i) {
if (symbol[i] == '0' && symbol[i + 1] == 'x') {
idx_t k;
for (k = i + 2; k < symbol.size(); ++k) {
if (!StringUtil::CharacterIsHex(symbol[k])) {
break;
}
}
frame_end = k;
break;
}
}
static constexpr idx_t STACK_TRACE_INDENTATION = 8;
if (frame_end == symbol.size() || start >= STACK_TRACE_INDENTATION) {
// frame pointer not found - just preserve the original frame
return symbol;
}
idx_t space_count = STACK_TRACE_INDENTATION - start;
return symbol.substr(0, start) + string(space_count, ' ') + symbol.substr(frame_end, symbol.size() - frame_end);
#else
return symbol;
#endif
}

string StackTrace::GetStacktracePointers(idx_t max_depth) {
string result;
auto callstack = unique_ptr<void *[]>(new void *[max_depth]);
Expand All @@ -68,7 +107,7 @@ string StackTrace::ResolveStacktraceSymbols(const string &pointers) {
string result;
char **strs = backtrace_symbols(callstack.get(), NumericCast<int>(frame_count));
for (idx_t i = 0; i < frame_count; i++) {
result += UnmangleSymbol(strs[i]);
result += CleanupStackTrace(UnmangleSymbol(strs[i]));
result += "\n";
}
free(reinterpret_cast<void *>(strs));
Expand Down
6 changes: 3 additions & 3 deletions src/duckdb/src/function/table/version/pragma_version.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DUCKDB_PATCH_VERSION
#define DUCKDB_PATCH_VERSION "4-dev4090"
#define DUCKDB_PATCH_VERSION "4-dev4100"
#endif
#ifndef DUCKDB_MINOR_VERSION
#define DUCKDB_MINOR_VERSION 1
Expand All @@ -8,10 +8,10 @@
#define DUCKDB_MAJOR_VERSION 1
#endif
#ifndef DUCKDB_VERSION
#define DUCKDB_VERSION "v1.1.4-dev4090"
#define DUCKDB_VERSION "v1.1.4-dev4100"
#endif
#ifndef DUCKDB_SOURCE_ID
#define DUCKDB_SOURCE_ID "41d13ad161"
#define DUCKDB_SOURCE_ID "5705d13dbf"
#endif
#include "duckdb/function/table/system_functions.hpp"
#include "duckdb/main/database.hpp"
Expand Down

0 comments on commit def035e

Please sign in to comment.