Debugging with ndk-gdb

Hi,
I`m trying to debug CUDA_Sample/boxFilter project on Ubuntu 14.04 host/Mipad device, but ndk fails to attach to the application,
if I try to start it via terminal I get the following:

victor@victor-N56VZ:~/NVPACK/CUDA_Samples/boxFilter/cuda$ ndk-gdb --start
WARNING: The shell running this script isn’t bash. Although we try to avoid bashism in scripts, things can happen.
/home/victor/NVPACK/android-ndk-r9d/ndk-gdb: 143: /home/victor/NVPACK/android-ndk-r9d/ndk-gdb: Bad substitution
/home/victor/NVPACK/android-ndk-r9d/ndk-gdb: 555: [: 1: unexpected operator
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
Initializing jdb …

Input stream closed.
/home/victor/NVPACK/android-ndk-r9d/ndk-gdb: 771: [: armeabi-v7a: unexpected operator
cp: cannot stat ‘./libs/armeabi-v7a/gdb.setup’: No such file or directory
GNU gdb (GDB) 7.3.1-gg2
Copyright © 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type “show copying”
and “show warranty” for details.
This GDB was configured as “–host=x86_64-linux-gnu --target=arm-linux-android”.
For bug reporting instructions, please see:
http://source.android.com/source/report-bugs.html.
warning: Could not load shared library symbols for 92 libraries, e.g. /system/bin/linker.
Use the “info sharedlibrary” command to see the complete listing.
Do you need “set solib-search-path” or “set sysroot”?
warning: Unable to find dynamic linker breakpoint function.
GDB will retry eventurally. Meanwhile, it is likely
that GDB is unable to debug shared library initializers
or resolve pending breakpoints after dlopen().
0x4012d8fc in ?? ()
./obj/local/armeabi-v7a/gdb.setup:4: Error in sourced command file:
Remote communication error. Target disconnected.: Connection reset by peer.
(gdb)

If I run it via Eclipse->Debug As->Android NDK Application the app on device is stuck in Waiting For Debugger Screen and I get the following:

[2014-07-28 22:59:25 - boxFilter] NDK: ------------------------------
[2014-07-28 22:59:25 - boxFilter] NDK: NVIDIA Debug Manager for Android NDK!
[2014-07-28 22:59:25 - boxFilter] NDK: adb is running normally…
[2014-07-28 22:59:25 - boxFilter] NDK: Performing android.app.NativeActivity activity launch
[2014-07-28 22:59:25 - boxFilter] NDK: Automatic Target Mode: using device ‘6361278A’
[2014-07-28 22:59:25 - boxFilter] NDK: Check if there arealready running gdbservers 1.014
[2014-07-28 22:59:25 - boxFilter] NDK: Running gdbserver processes not found.
[2014-07-28 22:59:25 - boxFilter] NDK: Check if there is running application com.example.boxfilter 1.097
[2014-07-28 22:59:26 - boxFilter] NDK: Running application is not found
[2014-07-28 22:59:26 - boxFilter] NDK: Uninstalling package com.example.boxfilter 1.24
[2014-07-28 22:59:27 - boxFilter] NDK: Problem while uninstalling package com.example.boxfilter: Unknown failure
[2014-07-28 22:59:27 - boxFilter] NDK: Syncing app 2.615
[2014-07-28 22:59:27 - boxFilter] NDK: Uploading boxFilter.apk onto device ‘6361278A’
[2014-07-28 22:59:27 - boxFilter] NDK: Installing boxFilter.apk…
[2014-07-28 22:59:38 - boxFilter] NDK: Success!
[2014-07-28 22:59:38 - boxFilter] NDK: Retrieving shared libs if necessary 13.965
[2014-07-28 22:59:38 - boxFilter] NDK: Using /home/victor/cuda/.metadata/.plugins/com.nvidia.ndklaunch/avd_6361278A as shared libs cache.
[2014-07-28 22:59:38 - boxFilter] NDK: Computing solib search path 13.966
[2014-07-28 22:59:38 - boxFilter] NDK: Launching app 13.977
[2014-07-28 22:59:38 - boxFilter] NDK: Starting activity android.app.NativeActivity on device
[2014-07-28 22:59:38 - boxFilter] NDK: Executing shell command: am start -D -n com.example.boxfilter/android.app.NativeActivity -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
[2014-07-28 22:59:39 - boxFilter] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.boxfilter/android.app.NativeActivity }
[2014-07-28 22:59:39 - boxFilter] NDK: Attempting to connect debugger to ‘com.example.boxfilter’ on port 8690
[2014-07-28 22:59:39 - boxFilter] NDK: Start GDB when before JDB
[2014-07-28 22:59:39 - boxFilter] NDK: Performing port forwarding 14.899
[2014-07-28 22:59:39 - boxFilter] NDK: Executing command: /home/victor/NVPACK/android-sdk-linux/platform-tools/adb forward tcp:8743 localfilesystem:/data/data/com.example.boxfilter/gdbsocket
[2014-07-28 22:59:39 - boxFilter] NDK: Computing PID of launched application 14.904
[2014-07-28 22:59:39 - boxFilter] NDK: Found PID of launched application: 2588
[2014-07-28 22:59:39 - boxFilter] NDK: Starting up run-as com.example.boxfilter lib/gdbserver +/data/data/com.example.boxfilter/gdbsocket --attach 2588 14.937
[2014-07-28 22:59:39 - boxFilter] GdbServerReceiver: Attached; pid = 2588
[2014-07-28 22:59:39 - boxFilter] GdbServerReceiver: Listening on Unix socket /data/data/com.example.boxfilter/gdbsocket
[2014-07-28 22:59:40 - boxFilter] NDK: Checking gdb debugger 15.938
[2014-07-28 22:59:40 - boxFilter] NDK: Gdb debugger file is found and has executable flag: /home/victor/NVPACK/eclipse/plugins/com.nvidia.ndklaunch_21.0.0.201307250029/gdb/linux-x86/arm-eabi-gdb 15.943
[2014-07-28 22:59:40 - boxFilter] NDK: Creating gdb debugger 15.961
[2014-07-28 22:59:40 - boxFilter] NDK: Creating gdb session 15.964
[2014-07-28 22:59:41 - boxFilter] NDK: Error creating session 16.998. See error log for details.
[2014-07-28 22:59:41 - boxFilter] NDK: End launch 17.007
[2014-07-28 22:59:41 - boxFilter] NDK: End launch1 17.007

hi Soth 1985,
you should use the cuda-gdb not ndk-gdb for cuda app. in linux you could use NSight Eclipse to debug.