libbacktrace: correctly number frames when skipping.
Correct for the number of skipped frames when unwinding with libunwindstack. Test: backtrace_test32 --gtest_filter="unwind_frame_skip_*" Change-Id: I9528977104fde3c4ec792a6db1ada24ed571b867
This commit is contained in:
parent
972753e094
commit
cd546c11d6
2 changed files with 17 additions and 1 deletions
|
@ -64,7 +64,7 @@ bool Backtrace::Unwind(unwindstack::Regs* regs, BacktraceMap* back_map,
|
|||
auto frame = &unwinder_frames[i];
|
||||
backtrace_frame_data_t* back_frame = &frames->at(cur_frame);
|
||||
|
||||
back_frame->num = frame->num;
|
||||
back_frame->num = frame->num - num_ignore_frames;
|
||||
|
||||
back_frame->rel_pc = frame->rel_pc;
|
||||
back_frame->pc = frame->pc;
|
||||
|
|
|
@ -1844,6 +1844,22 @@ TEST(libbacktrace, unwind_remote_through_signal_using_action_new) {
|
|||
UnwindThroughSignal(true, Backtrace::CreateNew, BacktraceMap::CreateNew);
|
||||
}
|
||||
|
||||
static void TestFrameSkipNumbering(create_func_t create_func, map_create_func_t map_create_func) {
|
||||
std::unique_ptr<BacktraceMap> map(map_create_func(getpid(), false));
|
||||
std::unique_ptr<Backtrace> backtrace(create_func(getpid(), gettid(), map.get()));
|
||||
backtrace->Unwind(1);
|
||||
ASSERT_NE(0U, backtrace->NumFrames());
|
||||
ASSERT_EQ(0U, backtrace->GetFrame(0)->num);
|
||||
}
|
||||
|
||||
TEST(libbacktrace, unwind_frame_skip_numbering) {
|
||||
TestFrameSkipNumbering(Backtrace::Create, BacktraceMap::Create);
|
||||
}
|
||||
|
||||
TEST(libbacktrace, unwind_frame_skip_numbering_new) {
|
||||
TestFrameSkipNumbering(Backtrace::CreateNew, BacktraceMap::CreateNew);
|
||||
}
|
||||
|
||||
#if defined(ENABLE_PSS_TESTS)
|
||||
#include "GetPss.h"
|
||||
|
||||
|
|
Loading…
Reference in a new issue