使用_Unwind_Backtrace获取分段错误中的呼叫跟踪结果

时间:2018-12-19 14:55:41

标签: android stack-unwinding libunwind

我正在使用malloc_hook捕获Android中的内存分配调用。在其中,我使用_Unwind_Backtrace查找调用层次结构。这会随机但频繁地导致分段错误。 我正在使用NDK-17c和androidsdk.28.0.2构建我的apk。尝试过各种选项是makefile,例如添加选项-Wl,-exclude-libs,libgcc.a,但是崩溃仍然存在。 这是该故障的示例堆栈跟踪:

SIGSEGV (signal SIGSEGV: address access protected (fault address: 0xff680d2c))
_Unwind_VRS_Pop 0x00000000d0064b2c  

__gnu_unwind_execute 0x00000000d00651d8  
__gnu_unwind_frame 0x00000000d0065208  
__cxxabiv1::__gxx_personality_v0(_Unwind_State, _Unwind_Control_Block *, _Unwind_Context *) 0x00000000d00181f0  
_Unwind_Backtrace 0x00000000cf7928cc  
(anonymous namespace)::scanStackFrames(void**, unsigned int) Backtrace.cpp:76  
Backtrace::GetScanStackFrames(int) Backtrace.cpp:127  
my_malloc_hook(unsigned int, void const*) mallocDebugHook.cpp:102  
operator new(unsigned int) 0x00000000d0018e78
<unknown function> 0x00000000c9235ae4
std::function<void ()>::operator()() const 0x00000000d00590b4
std::__once_proxy() 0x00000000d00590ac
pthread_once 0x00000000ed2f47d8
facebook::gloginit::initialize(char const*) 0x00000000c9235cb2
<unknown function> 0x00000000c927f5da
facebook::jni::initialize(_JavaVM*, std::function<void ()>&&) 0x00000000c90f2570
JNI_OnLoad 0x00000000c927f0dc
art::JavaVMExt::LoadNativeLibrary(_JNIEnv*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, _jobject*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) 0x00000000eb3edd7a
JVM_NativeLoad 0x00000000e5ee4f5e
getSystemTimeZoneID 0x0000000071b9b734
art_quick_invoke_stub_internal 0x00000000eb5c6576
art_quick_invoke_static_stub 0x00000000eb59fc7e
art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*) 0x00000000eb25a02a
art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*) 0x00000000eb39eaec
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00000000eb3995da
bool art::interpreter::DoInvoke<(art::InvokeType)0, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00000000eb3c2400
void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*) 0x00000000eb3bf440
ExecuteSwitchImplAsm 0x00000000eb5cb456
art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.2471763592) 0x00000000eb37dd1a
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*) 0x00000000eb38243c
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00000000eb3995c2
bool art::interpreter::DoInvoke<(art::InvokeType)2, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00000000eb3c02de
void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*) 0x00000000eb3be8a4
ExecuteSwitchImplAsm 0x00000000eb5cb456
art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.2471763592) 0x00000000eb37dd1a
art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*) 0x00000000eb38243c
bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00000000eb3995c2
bool art::interpreter::DoInvoke<(art::InvokeType)0, false, false>(art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) 0x00000000eb3c2400
void art::interpreter::ExecuteSwitchImplCpp<false, false>(art::interpreter::SwitchImplContext*) 0x00000000eb3bf440
ExecuteSwitchImplAsm 0x00000000eb5cb456
art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.2471763592) 0x00000000eb37dd1a
…
art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue*) 0x00000000eb501820
art::Thread::CreateCallback(void*) 0x00000000eb52279a
__pthread_start(void*) 0x00000000ed2f3506
__start_thread 0x00000000ed2adf2a

任何帮助将不胜感激。

0 个答案:

没有答案