Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "sanitizer_common/sanitizer_stacktrace.hpp"

#include <execinfo.h>
#include <stdint.h>
#include <string>

namespace ur_sanitizer_layer {
Expand All @@ -21,9 +22,15 @@ StackTrace GetCurrentBacktrace() {
BacktraceFrame Frames[MAX_BACKTRACE_FRAMES];
int FrameCount = backtrace(Frames, MAX_BACKTRACE_FRAMES);

// The Frames contain the return addresses, which is one instruction after the
// call instruction. Adjust the addresses so that symbolizer would give more
// precise result.
for (int I = 0; I < FrameCount; I++) {
Frames[I] = (void *)((uintptr_t)Frames[I] - 1);
}

StackTrace Stack;
Stack.stack =
std::vector<BacktraceFrame>(&Frames[0], &Frames[FrameCount - 1]);
Stack.stack = std::vector<BacktraceFrame>(&Frames[0], &Frames[FrameCount]);

return Stack;
}
Expand Down