ndk-gdb --verbose says "gdb.setup not found"
<p>I'm trying to debug a little test proyect to learn how the script ndk-gdb works, and when I've done all the steps, it tells me It cannot find gdb.setup in libs, when it really exists there.</p>

<p>SOLVED: Seems like I called ndk-gdb from the jni folder since this morning. I've changed to the proyect parent directory and now it works. Sorry for this stupid doubt :/ </p>

<p>This are the steps I've done:
Declare native methods in my class:</p>

<pre><code>package com.sixteenbitboy;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class Ndktest1Activity extends Activity {
/** Called when the activity is first created. */

public native int sum(int a, int b);

static{
    System.loadLibrary("milib");
}

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        /* Create a TextView and set its content.
         * the text is retrieved by calling a native
         * function.
         */
        TextView  tv = new TextView(this);
        tv.setText(Integer.toString(sum(8,2)));
        setContentView(tv);
    }
}
</code></pre>

<p>As you can see its very similar to the sample proyect hello-jni.
Now I call javah in my source dir to get the C header file with the prototypes.
Once I've the file, I implement the functions from that header file, and save the code into a dir called jni inside my proyect folder.</p>

<pre><code>#include&lt;jni.h&gt; 
JNIEXPORT jint JNICALL Java_com_sixteenbitboy_Ndktest1Activity_sum
  (JNIEnv *env, jobject obj, jint a, jint b){

  return a + b;
}
</code></pre>

<p>Once I've done this, I write a file called Android.mk with this lines:</p>

<pre><code>MY_LOCAL_PATH := $(call my-dir)
LOCAL_PATH := $(MY_LOCAL_PATH)
include $(CLEAR_VARS)
LOCAL_MODULE := milib
LOCAL_SRC_FILES := milib.c
include $(BUILD_SHARED_LIBRARY)
</code></pre>

<p>Very similar to the hello-jni again, since I can debug hello-jni without problems, I'm trying to do it the same way.</p>

<p>Then I call ndk-build, build the java proyect and run it in an emulator.</p>

<p>With the app running in the emulator I call ndk-gdb. It should stop at some epoll_wait function like hello-jni does, but instead of this, it crashes the app running and cannot connect to the emulator. I get this:</p>

<p>/home/adrian/codigo/ndktest1/jni/obj/local/armeabi/gdb.setup:4: Error in sourced command file:
Remote communication error: Connection reset by peer.</p>

<p>Then, I execute the app again and start ndk-gdb in verbose mode this way: ndk-gdb --verbose --start </p>

<p>And then I get a line saying that cp cannot stat gdb.setup in ./libs 
This is the full output of this command:</p>

<pre><code>Android NDK installation path: /home/adrian/codigo/android-ndk-r7
Using default adb command: /home/adrian/codigo/android-sdk/platform-tools//adb
ADB version found: Android Debug Bridge version 1.0.29
Using ADB flags: 
Using auto-detected project path: /home/adrian/codigo/ndktest1
Found package name: com.sixteenbitboy
ABIs targetted by application: armeabi
Device API Level: 10
Device CPU ABI: armeabi
Compatible device ABI: armeabi
Found debuggable flag: true
Found device gdbserver: /data/data/com.sixteenbitboy/lib/gdbserver
Using gdb setup init: ./libs/armeabi/gdb.setup
Using toolchain prefix: /home/adrian/codigo/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-
Using app out directory: ./obj/local/armeabi
Found data directory: '/data/data/com.sixteenbitboy'
Found first launchable activity: .Ndktest1Activity
Launching activity: com.sixteenbitboy/.Ndktest1Activity
## COMMAND: /home/adrian/codigo/android-sdk/platform-tools//adb shell am start -n com.sixteenbitboy/.Ndktest1Activity
Starting: Intent { cmp=com.sixteenbitboy/.Ndktest1Activity }
## COMMAND: /home/adrian/codigo/android-sdk/platform-tools//adb shell sleep 2
Found running PID: 739
Launched gdbserver succesfully.
Setup network redirection
## COMMAND: /home/adrian/codigo/android-sdk/platform-tools//adb forward tcp:5039 localfilesystem:/data/data/com.sixteenbitboy/debug-socket
## COMMAND: /home/adrian/codigo/android-sdk/platform-tools//adb shell run-as com.sixteenbitboy lib/gdbserver +debug-socket --attach 739
## COMMAND: /home/adrian/codigo/android-sdk/platform-tools//adb pull /system/bin/app_process ./obj/local/armeabi/app_process
Attached; pid = 739
Listening on sockaddr socket debug-socket
71 KB/s (5660 bytes in 0.077s)
Pulled app_process from device/emulator.
## COMMAND: /home/adrian/codigo/android-sdk/platform-tools//adb pull /system/lib/libc.so ./obj/local/armeabi/libc.so
1408 KB/s (273868 bytes in 0.189s)
Pulled libc.so from device/emulator.
cp: no se puede efectuar `stat' sobre «./libs/armeabi/gdb.setup»: No existe el archivo o el directorio
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-elf-linux".
(no debugging symbols found)
Error while mapping shared library sections:
/system/bin/linker: No such file or directory.
Error while mapping shared library sections:
libc.so: Success.
Error while mapping shared library sections:
libstdc++.so: Success.
Error while mapping shared library sections:
libm.so: Success.
Error while mapping shared library sections:
liblog.so: Success.
Error while mapping shared library sections:
libcutils.so: Success.
Error while mapping shared library sections:
libz.so: Success.
Error while mapping shared library sections:
libutils.so: Success.
Error while mapping shared library sections:
libbinder.so: Success.
Error while mapping shared library sections:
libexpat.so: Success.
Error while mapping shared library sections:
libcrypto.so: Success.
Error while mapping shared library sections:
libicuuc.so: Success.
Error while mapping shared library sections:
libicui18n.so: Success.
Error while mapping shared library sections:
libsqlite.so: Success.
Error while mapping shared library sections:
libssl.so: Success.
Error while mapping shared library sections:
libnativehelper.so: Success.
Error while mapping shared library sections:
libnetutils.so: Success.
Error while mapping shared library sections:
libEGL.so: Success.
Error while mapping shared library sections:
libwpa_client.so: Success.
Error while mapping shared library sections:
libhardware_legacy.so: Success.
Error while mapping shared library sections:
libpixelflinger.so: Success.
Error while mapping shared library sections:
libhardware.so: Success.
Error while mapping shared library sections:
libui.so: Success.
Error while mapping shared library sections:
libgui.so: Success.
Error while mapping shared library sections:
libsurfaceflinger_client.so: Success.
Error while mapping shared library sections:
libcamera_client.so: Success.
Error while mapping shared library sections:
libemoji.so: Success.
Error while mapping shared library sections:
libjpeg.so: Success.
Error while mapping shared library sections:
libskia.so: Success.
Error while mapping shared library sections:
libGLESv1_CM.so: Success.
Error while mapping shared library sections:
libskiagl.so: Success.
Error while mapping shared library sections:
libdvm.so: Success.
Error while mapping shared library sections:
libGLESv2.so: Success.
Error while mapping shared library sections:
libETC1.so: Success.
Error while mapping shared library sections:
libsonivox.so: Success.
Error while mapping shared library sections:
libmedia.so: Success.
Error while mapping shared library sections:
libnfc_ndef.so: Success.
Error while mapping shared library sections:
libandroid_runtime.so: Success.
Error while mapping shared library sections:
libvorbisidec.so: Success.
Error while mapping shared library sections:
libstagefright_amrnb_common.so: Success.
Error while mapping shared library sections:
libstagefright_enc_common.so: Success.
Error while mapping shared library sections:
libstagefright_avc_common.so: Success.
Error while mapping shared library sections:
libstagefright_foundation.so: Success.
Error while mapping shared library sections:
libstagefright_color_conversion.so: Success.
Error while mapping shared library sections:
libstagefright.so: Success.
Error while mapping shared library sections:
libmedia_jni.so: Success.
Error while mapping shared library sections:
libexif.so: Success.
Error while mapping shared library sections:
libsoundpool.so: Success.
Error while mapping shared library sections:
libstlport.so: Success.
Error while mapping shared library sections:
libwebcore.so: Success.
Error while mapping shared library sections:
libmilib.so: Success.
Error while mapping shared library sections:
gralloc.default.so: Success.
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
warning: shared library handler failed to enable breakpoint
0xafd0c51c in ?? ()
gdb: Unable to get location for thread creation breakpoint: requested event is not supported
(no debugging symbols found)
gdb: Unable to get location for thread creation breakpoint: requested event is not supported
gdb: Unable to get location for thread creation breakpoint: requested event is not supported
Killing inferior
/home/adrian/codigo/ndktest1/jni/obj/local/armeabi/gdb.setup:4: Error in sourced command file:
Remote communication error: Connection reset by peer.
</code></pre>

<p>What am I doing wrong? </p>
