Getting "No symbol table is loaded" using NDK r5.

965 views
Skip to first unread message

hayashida kazuki

unread,
Dec 30, 2010, 1:02:54 AM12/30/10
to andro...@googlegroups.com
Hi gurus,

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.

alan

unread,
Dec 31, 2010, 4:19:56 AM12/31/10
to android-ndk
using a shared library does work but only on the main thread (this is
fixed in 2.3 so if you can get hold of a 2.3 device or if you use the
emulator you can debug all threads).
I would recommend building a shared library and using ndk-gdb and
making sure you can get that working before trying to develop your own
debugging scripts

David Turner

unread,
Dec 31, 2010, 5:19:43 AM12/31/10
to andro...@googlegroups.com
This is normal, the message means that the gdb client on your host cannot find the symbols. You need to provide the program with the path to the executable on your development machine, plus the path to directories containing other shared libraries it depends on. That's why the NDK generates a gdb.setup file at build time, which contains commands that are executed by the client through ndk-gdb.

Try reading the gdb manual to see which commands to use, or look at a few gdb.setup files for examples.


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


Reply all
Reply to author
Forward
0 new messages