Lost part of refactoring

This commit is contained in:
Ivan Blinkov 2020-06-10 17:51:25 +03:00
parent 6191d33bd9
commit 60b40f0403
3 changed files with 7 additions and 4 deletions

View File

@ -146,9 +146,11 @@ void SentryWriter::onFault(int sig, const siginfo_t & info, const ucontext_t & c
offset = 1;
}
char instruction_addr[100];
StackTrace::Frames frames;
StackTrace::symbolize(stack_trace.getFramePointers().data(), offset, size, frames);
for (size_t i = stack_size - 1; i >= offset; --i)
{
const StackTrace::Frame & current_frame = stack_trace.getFrames().value()[i];
const StackTrace::Frame & current_frame = frames[i];
sentry_value_t frame = sentry_value_new_object();
UInt64 frame_ptr = reinterpret_cast<UInt64>(current_frame.virtual_addr);
std::snprintf(instruction_addr, sizeof(instruction_addr), "0x%" PRIu64 "x", frame_ptr);

View File

@ -190,7 +190,7 @@ static void * getCallerAddress(const ucontext_t & context)
#endif
}
static void symbolize(const void * const * frame_pointers, size_t offset, size_t size, StackTrace::Frames & frames)
void StackTrace::symbolize(const void * const * frame_pointers, size_t offset, size_t size, StackTrace::Frames & frames)
{
#if defined(__ELF__) && !defined(__FreeBSD__) && !defined(ARCADIA_BUILD)
@ -347,7 +347,7 @@ static std::string toStringImpl(const void * const * frame_pointers, size_t offs
{
std::stringstream out;
StackTrace::Frames frames;
symbolize(frame_pointers, offset, size, frames);
StackTrace::symbolize(frame_pointers.data(), offset, size, frames);
toStringEveryLineImpl(frames, offset, size, [&](const std::string & str) { out << str << '\n'; });
return out.str();
}
@ -355,7 +355,7 @@ static std::string toStringImpl(const void * const * frame_pointers, size_t offs
void StackTrace::toStringEveryLine(std::function<void(const std::string &)> callback) const
{
Frames frames;
symbolize(frame_pointers.data(), offset, size, frames);
StackTrace::symbolize(frame_pointers.data(), offset, size, frames);
toStringEveryLineImpl(frames, offset, size, std::move(callback));
}

View File

@ -54,6 +54,7 @@ public:
std::string toString() const;
static std::string toString(void ** frame_pointers, size_t offset, size_t size);
static void symbolize(const void * const * frame_pointers, size_t offset, size_t size, StackTrace::Frames & frames);
void toStringEveryLine(std::function<void(const std::string &)> callback) const;
protected: