简体   繁体   English

如何调试崩溃的Android本机库?

[英]How to debug crashed android native library?

I am runing junit test for native library(C++), native library process crashed and logcat shows: 我正在为本机库(C ++)运行junit测试,本机库进程崩溃,logcat显示:

I/ActivityManager(  161): Force stopping package xxxxx uid=10043
I/ActivityManager(  161): Start proc xxxxx for added application xxxx: pid=1656 uid=10043 gids={1015}
I/TestRunner( 1656): started: testAddressBook(xxxxx.AddressBookTest)
F//system/bin/app_process( 1656): stack corruption detected: aborted
I/ActivityManager(  161): Process xxxxx (pid 1656) has died.

Where xxxxx is the process name. 其中xxxxx是进程名称。

I try to follow instruction on http://source.android.com/porting/debugging_native.html , but the instruction is confusing: 我尝试遵循http://source.android.com/porting/debugging_native.html上的说明,但该说明令人困惑:

If it crashes, connect with aproto and run logcat on the device 如果崩溃,请使用aproto连接并在设备上运行logcat

What is aproto? 什么是prototo? I can't find it. 我找不到 Nor "stack" tool. 也没有“堆栈”工具。

Any suggestion is appreciated! 任何建议表示赞赏!

-Henry -亨利

F//system/bin/app_process( 1656): stack corruption detected: aborted

That sounds like you're trashing a local variable. 听起来您正在浪费本地变量。 Here's a really popular way to do that: 这是一种非常流行的方法:

char localVar[16];
sprintf(localVar, "And this is why sprintf is the devil");

That's not exactly what you asked for, but I hope it helps anyway. 这并不是您所要的,但我希望它能有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM