Skip to content

Commit b626c5c

Browse files
committed
fixes
1 parent 1f62150 commit b626c5c

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

ydb/library/yql/utils/backtrace/libbacktrace/symbolizer.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <vector>
1414
#include <numeric>
1515
#include <algorithm>
16+
#include <filesystem>
1617

1718
namespace {
1819
void HandleLibBacktraceError(void* data, const char* msg, int) {
@@ -56,15 +57,22 @@ namespace NYql {
5657
std::iota(order.begin(), order.end(), 0u);
5758
std::sort(order.begin(), order.end(), [&frames](auto a, auto b) { return frames[a].File < frames[b].File; });
5859

59-
auto state = CreateState(frames[order[0]].File);
60-
if (!state) {
61-
return {};
62-
}
60+
struct backtrace_state* state = nullptr;
6361

6462
for (size_t i = 0; i < order.size(); ++i) {
65-
if (i && frames[order[i - 1]].File != frames[order[i]].File) {
66-
state = CreateState(frames[order[i]].File);
63+
if (!i || frames[order[i - 1]].File != frames[order[i]].File) {
64+
if (!std::filesystem::exists(frames[order[i]].File.c_str())) {
65+
state = nullptr;
66+
} else {
67+
state = CreateState(frames[order[i]].File);
68+
}
6769
}
70+
71+
if (!state) {
72+
result[order[i]] = TStringBuilder() << "File not found: " << frames[order[i]].File;
73+
continue;
74+
}
75+
6876
int status = backtrace_pcinfo(
6977
state,
7078
reinterpret_cast<uintptr_t>(frames[order[i]].Address) - 1, // last byte of the call instruction

ydb/library/yql/utils/backtrace/symbolize.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ namespace NYql {
3131
if (parts.size() > 2) {
3232
modulePath = parts[1];
3333
TryFromString<ui64>(parts[2], address);
34+
if (modulePath == "/proc/self/exe") {
35+
modulePath = "EXE";
36+
}
3437
auto it = mapping.find(modulePath);
3538
if (it != mapping.end()) {
3639
modulePath = it->second;

0 commit comments

Comments
 (0)