how to get native stack trace

Showing 1-5 of 5 messages
how to get native stack trace guich 6/16/10 1:16 PM
Hi,

When my application exits, i get this:

pid: 502, tid: 507  >>> totalcross.android <<<
signal 11 (SIGSEGV), fault addr 00000004
 r0 00000004  r1 0028117c  r2 001ba1a4  r3 00000000
 r4 001db4d4  r5 001b3cb4  r6 0028136c  r7 00281178
 r8 00000000  r9 41047ec4  10 41047eb0  fp 44e17a6c
 ip 00000004  sp 44e17890  lr ad03ffdb  pc 804c4a58  cpsr 60000010
         #00  pc 000c4a58  /data/data/totalcross.android/lib/
libtcvm.so
         #01  pc 00010838  /data/data/totalcross.android/lib/
libtcvm.so
         #02  pc 00010180  /data/data/totalcross.android/lib/
libtcvm.so
         #03  pc 0000e434  /system/lib/libdvm.so

It would help a lot if i could get the lines on libtcvm.so that caused
the crash.

Can someone help finding:

1. How to get the exact source point for 0xC4A58?
or
2. How to turn on debugging so that the dump above could include the
line number?

I already tried:
APP_OPTIM        := debug
In Application.mk without success.

I'm using NDK 1.6r1.

thanks and regards

    guich
Re: how to get native stack trace David Turner 6/16/10 1:31 PM
You should use the arm-eabi-addr2line program to translate these addresses into file:line pairs.
You will need the symbol version of the binaries though (they are under obj/local/<modulename>/lib<name>.so with ndk-build)


--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.


Re: how to get native stack trace Onur Cinar 6/16/10 2:30 PM

In addition to the addr2line tool, if you are using Eclipse as your
IDE for NDK, then you can configure it to automatically do that for
you also.

In order to do that:

- Set Project - Settings - C/C++ General - Paths and Symbols - Output
Location to the $(ANDROID_NDK)/out/apps/dtme/armeabi

- Set Project - Settings - C/C++ Build - Settings - Binary Parsers to
have GNU ELF Parser enabled. You can also have the paths set to use
the addr2line and c++filt from the NDK package as well. On Linux, I
didn't have to, but on Windows it makes sense.

On C/C++ perspective, you will see the Binary group with the output
dynamic libraries, and if you open them it will give you a mixed
output with the address and the actual content of the line.  It is
easier to use most of the time.

Regards,

-onur
---
www.zdo.com
Re: how to get native stack trace Onur Cinar 6/16/10 2:41 PM

I used to have this script for parsing the logcat output like this:

adb logcat | stack.sh myapp

I'm no longer using this, but here is the script in case you prefer
that approach.

Regards,

-onur

#!/bin/bash
#
# Maps the stack trace into source code line numbers by
# parsing the log file.
#
# Usage: stack.sh <app name>
#
# Author: Onur Cinar onur.cinar(at)gmail.com
#

if [ $# -lt 1 ]
then
        echo usage: $0 app
        exit 0
fi

APP=$1
LOG_FILE=$2

if [ ! -n "${ANDROID_NDK}" ]
then
        ANDROID_NDK=`dirname $0`
        echo ANDROID_NDK is not set using ${ANDROID_NDK}
fi

ADDR2LINE=${ANDROID_NDK}/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/
arm-eabi-addr2line

if [ ! -s $LOG_FILE ]
then
        echo File $LOG_FILE does not exist or empty.
        exit 0
fi

while read LINE
do
        echo $LINE

        if [[ $LINE =~ ^.+#[0-9]{2}\ +pc\ +([0-9A-Fa-f]{8})\ +(.+\.so).?$ ]]
        then
                ADDR=${BASH_REMATCH[1]}
                SO=`basename ${BASH_REMATCH[2]}`
                SRC=`${ADDR2LINE} -C -f -e ${ANDROID_NDK}/out/apps/${APP}/armeabi/$
{SO} ${ADDR} 2>/dev/null`
                echo ${SRC}
        fi
done
Re: how to get native stack trace palai neeloor2004 6/17/10 9:33 AM
Hi
Could you explain little more about setting up Eclipse
1) I am using windows & Eclipse with CDT 6.0.2
2) I can see "C/C++ General - Paths and Symbols"  but could not fine not Output there
3) "paths set to use the addr2line and c++filt from the NDK package as well"  - where to set this
 
If you have any link or doc, which explain the setting please send it
 
Thanks

 

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.