gcc options for debug build

1,249 views
Skip to first unread message

Naren Bhat

unread,
May 20, 2010, 7:27:47 PM5/20/10
to android-...@googlegroups.com
When I run GDB to debug my executable, I get an error "no debugging symbols found".
Is there any special compiler/linker flag that I should be using ?
I am building my source code using gcc options -g3 -gdwarf-2
 
The gdb version is 7.1.50.20100406
gcc version is 4.4.0 (arm-eabi-g++)
 
Thanks
Naren

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

Kipling Inscore

unread,
May 21, 2010, 9:49:35 AM5/21/10
to android-...@googlegroups.com
On Thu, May 20, 2010 at 16:27, Naren Bhat <nare...@gmail.com> wrote:
> When I run GDB to debug my executable, I get an error "no debugging symbols
> found".
> Is there any special compiler/linker flag that I should be using ?

-ggdb

RK

unread,
May 21, 2010, 10:14:53 AM5/21/10
to android-platform
Even I have the same problem, after going through some blogs I found
that we need to set the 'LOCAL_CFLAGS' with -g option in Android.mk
but even after doing this I dont get any symbol info in the .so file
generated.
I also need to get the map file for the particular .so file, so I set
the option 'LOCAL_LDFLAGS' as -Wl, Map,/path/to/mapfile Android.mk
but I couldn't get the .map file.
How to enable the debug symbols and map file in android.mk

RK

Naren Bhat

unread,
May 21, 2010, 3:08:54 PM5/21/10
to android-...@googlegroups.com
Thanks for the responses.
 
-ggdb or -g3 does not seem to make any difference. Here are the .mk files and the actual command line options that go into gcc. I am specifying APP_OPTIM in the Application.mk file. If I change APP_OPTIM to release, the only change in command line option is '-O2' '-DNDEBUG' comapred to '-O0' for APP_OPTIM = debug.
In either case, the debug information is not present (as shown by readelf).
 
Also tried moving APP_CFLAGS in Application.mk to LOCAL_CFLAGS in Android.mk, but sommand lines generate are the same.

Application.mk
APP_PROJECT_PATH := $(call my-dir)
APP_BUILD_SCRIPT := $(call my-dir)/Android.mk
APP_OPTIM := debug
APP_MODULES := hello-exe
APP_CFLAGS := -ggdb -gdwarf-2 -v

Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := hello-exe
LOCAL_SRC_FILES := main.c
include $(BUILD_EXECUTABLE)

Here is the actual command lines generated
GNU C (GCC) version 4.4.0 (arm-eabi)

compiled by GNU C version 4.2.4 (Ubuntu 4.2.4-1ubuntu4), GMP version 4.2.2, MPFR version 2.3.0.

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: a5848ae5005c7cad2b26f59c69fec681
COLLECT_GCC_OPTIONS='-Ibuild/platforms/android-3/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__' '-march=armv5te' '-mtune=xscale' '-msoft-float' '-mthumb' '-Os' '-fomit-frame-pointer' '-fno-strict-aliasing' '-finline-limit=64' '-Iapps/hello-exe' '-DANDROID' '-O0' '-g' '-ggdb' '-gdwarf-2' '-v' '-c' '-MMD' '-MP' '-MF' 'out/apps/hello-exe/armeabi/objs/hello-exe/main.o.d.tmp' '-o' 'out/apps/hello-exe/armeabi/objs/hello-exe/main.o' '-mfpu=vfp' '-mabi=aapcs'

/home/lab/ndk/android-ndk-r3/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/../../../../arm-eabi/bin/as -march=armv5te -mthumb-interwork -mfloat-abi=soft -mfpu=vfp -meabi=5 -o out/apps/hello-exe/armeabi/objs/hello-exe/main.o /tmp/ccUhY319.s

COMPILER_PATH=/home/lab/ndk/android-ndk-r3/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/../libexec/gcc/arm-eabi/4.4.0/:/home/lab/ndk/android-ndk-r3/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/../libexec/gcc/:/home/lab/ndk/android-ndk-r3/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/../../../../arm-eabi/bin/

LIBRARY_PATH=/home/lab/ndk/android-ndk-r3/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/thumb/:/home/lab/ndk/android-ndk-r3/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/:/home/lab/ndk/android-ndk-r3/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/../lib/gcc/:/home/lab/ndk/android-ndk-r3/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/../../../../arm-eabi/lib/

COLLECT_GCC_OPTIONS='-Ibuild/platforms/android-3/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__' '-march=armv5te' '-mtune=xscale' '-msoft-float' '-mthumb' '-Os' '-fomit-frame-pointer' '-fno-strict-aliasing' '-finline-limit=64' '-Iapps/hello-exe' '-DANDROID' '-O0' '-g' '-ggdb' '-gdwarf-2' '-v' '-c' '-MMD' '-MP' '-MF' 'out/apps/hello-exe/armeabi/objs/hello-exe/main.o.d.tmp' '-o' 'out/apps/hello-exe/armeabi/objs/hello-exe/main.o' '-mfpu=vfp' '-mabi=aapcs'

Thanks !!
Naren

Reply all
Reply to author
Forward
0 new messages