I'm new to Android NDK.
I tried debugging my CUI application developed using NDK r5 but got
"No symbol table is loaded".
I've searched on the web but couldn't find any answers.
Here is what I did...
I made a simple c code (only-main-sample.c) which has a main function only and
compiled, saved its executable file in a device (SonyEricsson X10).
And I tried to set a breakpoint using arm-eabi-gdb for a stepwise execution but
got "No symbol table is loaded".
Anyone knows what is going on !?
Why I made a CUI application (executable file) is that I've heard I
cannot debug if it's a shared library
so I've been trying to debug a simple code before I convert my
original library to be an executable, Just for exercise.
○ only-main-sample.c (has only main function)
○ Android.mk
○ run.sh ( a script to execute the only-main-sample on device )
○ start_gdbserver.sh ( a script to compile only-main-sample.c, save
in the device and start gdbserver )
○ gdb start command ( a command to start gdb )
--- only-main-sample.c -----------------
#include <stdlib.h>
#include <string.h>
#include <jni.h>
#include <android/log.h>
int main(int argc, char *argv[])
{
printf("Hello NDK !\n");
return 0;
}
//-----------------------------------------------
--- Android.mk ------------------------------
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := only-main-sample
LOCAL_SRC_FILES := only-main-sample.c
LOCAL_CFLAGS := $(LOCAL_C_INCLUDES:%=-I%) -g -O0
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -ldl -lm -llog
#include $(BUILD_SHARED_LIBRARY)
include $(BUILD_EXECUTABLE)
//-------------------------------------------------
# Setting LOCAL_CFLAGS to -g -O0 for debug.
# Using include $(BUILD_EXECUTABLE) instead of include
$(BUILD_SHARED_LIBRARY) to make an executable file.
--- run.sh -----
#!/bin/sh
ndk-build -B V=1
PROG=only-main-sample
adb push ../obj/local/armeabi/$PROG /data
adb shell chmod 777 /data/$PROG
adb shell /data/$PROG "$*"
//-----------------------------------------------------------------------------
# Pushing ../obj/local/armeabi/only-main-sample to a device instead of
../libs/armeabi/only-main-sample. It's because
# one under ../libs/armeabi/ directory seems got debug info stripped.
If I run this script, I see Hello NDK ! properly on the console.
---- start_gdbserver.sh -------
#!/bin/sh
ndk-build -B V=1
PROG=only-main-sample
adb push ../obj/local/armeabi/$PROG /data
adb shell chmod 777 /data/$PROG
adb forward tcp:5039 tcp:5039
adb shell /data/gdbserver tcp:5039 /data/$PROG "$*"
//------------------------------------------------------------------------------------------------------------
-- gdb start command -----------------------------------------------
# $ANDROID_NDK_R5_HOME/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/arm-eabi-gdb
// --------------------------------------------------------------------------
(gdb) target remote localhost:5039 <-- connect to gdbserver
Remote debugging using localhost:5039 <-- connected !!
0x70000100 in ?? ()
(gdb) b main
No symbol table is loaded. Use the "file" command. <-- No symbol
table ... Missing debug info !?
(gdb) l
No symbol table is loaded. Use the "file" command.
I run gdb start command after I've run start_gdbserver.sh in another console.
Thanks in advance.
-Hayashida.
--
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.