我怎样才能有效地调试多数民众赞成包裹着JNI在Eclipse C code吗? (Android开发) [英] How can I effectively debug C code that's wrapped with JNI in Eclipse? (Android Dev)

查看:103
本文介绍了我怎样才能有效地调试多数民众赞成包裹着JNI在Eclipse C code吗? (Android开发)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有段错误,但我完全不知道如何找到它。

I've got a segfault but I have absolutely no idea how to locate it.

提示?

Tips?

推荐答案

您可以得到使用的的Andr​​oid NDK堆栈跟踪分析

本步骤是在维基,但基本上你需要从logcat的堆栈跟踪到一个文件中(亚行logcat> mycrash.log ),然后倾倒你的库到一个文本文件,然后在两个运行程序对他们。这里的shell脚本我用来做很多的:

The steps are on the wiki, but basically you need to get the stack trace from logcat into a file (adb logcat > mycrash.log), then dump your library to a text file, then run the program on the two of them. Here's the shell script I use to do the lot:

#!/bin/sh
if test $# -lt 2 ; then
    echo "Extract readable stack trace from Android logcat crash"
    echo "Usage $0 lib.so crash.log"
    exit 1
fi
of=$(mktemp)
echo "Disassemble $1"
~/tools/android-ndk-r5/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-objdump -S $1 > $of
echo "Parse stack trace in $2"
~/bin/parse_stack.py $of $2

更改路径到Android NDK和parse_stack.py文件,因为你需要。

Change the paths to the Android NDK and parse_stack.py file as you need.

这篇关于我怎样才能有效地调试多数民众赞成包裹着JNI在Eclipse C code吗? (Android开发)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆