addr2line missing filenames and line numbers

1,194 views
Skip to first unread message

Steve

unread,
Oct 10, 2010, 10:48:53 AM10/10/10
to android-ndk
Hi there,

In the debug build of my application, which has -g on both the compile
and link flags, I am not able to get addr2line to give me filenames
and line numbers. It DOES give me the name of the function just not
the filename and line number. To be honest the filename isn't that
interesting to me, as my IDE can take me to the correct file if I tell
it the function name, but getting the line number would be very handy
otherwise I have to put a bunch of debug print statements in to
tracing down which line causes the crash.

Anyone had this issue? I have tried a few different builds or
addr2line (for ARM eabi) but they all behave the same.

Another question while I am here (maybe I should start another thread
for this) can I register an exception handler in the native code (or
even the Java code) so when an exception occurs I have the option of
displaying the callstack on screen? I have done something similar on
other platforms where on crash it would look up the functions based on
the stack trace and display it on screen with the option to dump out a
screens. I found this really beneficial on internal QA type builds.

Thank you for your time,

Steve

Onur Cinar

unread,
Oct 10, 2010, 4:02:57 PM10/10/10
to andro...@googlegroups.com

Hi Steve,

Which binary are you using with the addr2line tool?  Try using the library file that is generated under  <project>/bin/ndk/local/armeabi/lib...so .  That one should have the line number information as well.

Regards,

-onur


--
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.

---
www.zdo.com

Steve

unread,
Oct 10, 2010, 4:49:58 PM10/10/10
to android-ndk
Well I am not actually using the build system which ships with the
NDK, I use something based on Jam as I build for multiple targets and
also have my custom build solution building multiple times faster than
the one that comes with the NDK (due to using precompiled headers/lump
files).

I based all my compile/link flags on the NDK though and am using the
NDK compiler etc. I am using the .so file that the linker spits out,
with full debug info, before stripping. The .so size is over 10 MB so
it feels big enough, the stripped .so is 2MB or less if I remember
correctly.

Is there some specific flag I need for filename/line numbers? From
looking though the GCC manual it seemed like -g would be enough.

Thanks for your help,

Steve
> > android-ndk...@googlegroups.com<android-ndk%2Bunsubscribe@googlegr oups.com>
> > .

Steve

unread,
Oct 10, 2010, 5:16:21 PM10/10/10
to android-ndk
Hmm I had a thought, I probably copied my flags from a non debug
build, looking at what I have got I am wondering if things like
omitting the stack pointer could be causing problems. I will check
what flags the NDK uses for debug builds and see if that sheds any
light. for the record currently my default CFLAGS are:

-march=armv5te
-mtune=xscale
-msoft-float
-fpic
-mthumb-interwork
-ffunction-sections
-funwind-tables
-fstack-protector
-fno-short-enums
-mthumb
-fomit-frame-pointer
-fno-strict-aliasing
-finline-limit=64
-fsigned-char
-Os

with -g added for debug builds and also a bunch of defines. hopefully
I just need to add or remove something from that list.

Steve

Onur Cinar

unread,
Oct 11, 2010, 1:19:27 AM10/11/10
to andro...@googlegroups.com

Hi Steve,

Yes, if you run the ndk-build with V=1 it should print the actual parameters to GCC toolchain. Here is the parameters I got. Looks like they are almost the same as your parameters. 

/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/arm-eabi-g++
-I/android-ndk-r4/build/platforms/android-8/arch-arm/usr/include

-fpic
-mthumb-interwork
-ffunction-sections
-funwind-tables
-fstack-protector
-fno-short-enums
-D__ARM_ARCH_5__
-D__ARM_ARCH_5T__
-D__ARM_ARCH_5E__
-D__ARM_ARCH_5TE__
-Wno-psabi
-march=armv5te
-mtune=xscale
-msoft-float
-fno-exceptions
-fno-rtti
-mthumb
-Os
-fomit-frame-pointer
-fno-strict-aliasing
-finline-limit=64
-DANDROID
-Wall
-Wa,--noexecstack
-O2
-DNDEBUG
-g
-c
-MMD
-MP
-MF

Regards,

-onur

To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages