Debugging native code

瀏覽次數:666 次
跳到第一則未讀訊息

Aman Bhardwaj

未讀,
2011年4月6日 上午11:43:042011/4/6
收件者:andro...@googlegroups.com
Hi,
I am using Android NDK and using SWIG to create java wrappers for my C++ libs, now I want to know how to debug seamlessly from java to C++.
I am using Eclipse for Java Android activity related code. I am on Ubuntu.

Thanks,
~Aman

Riasat Abir

未讀,
2011年4月7日 凌晨4:03:122011/4/7
收件者:andro...@googlegroups.com
Hi,
I have been using ndk-gdb for debugging.

You can try that also.

Thanks,
Riasat

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



--

HimHim

AndroidCoder

未讀,
2011年4月7日 凌晨4:59:592011/4/7
收件者:android-ndk
Try using Sequoyah. I found it very useful.

Instructions @
http://www.eclipse.org/sequoyah/documentation/native_debug.php

Thanks,
Arpit Goliya

On Apr 6, 8:43 pm, Aman Bhardwaj <myama...@gmail.com> wrote:
> Hi,
> I am using Android NDK and using SWIG to create java wrappers for my C++.

REVERSE

未讀,
2011年4月7日 清晨5:40:482011/4/7
收件者:android-ndk
Did you debug successfully some game with OpenGL? I've lost 2 weeks to
make it work, with no luck.



On 7 апр, 12:59, AndroidCoder <arpitgol...@gmail.com> wrote:
> Try using Sequoyah. I found it very useful.
>
> Instructions @http://www.eclipse.org/sequoyah/documentation/native_debug.php

Ó. Egilsson

未讀,
2011年4月7日 清晨6:59:112011/4/7
收件者:android-ndk
Due to a bug in Android pre 2.3 it's impossible to debug multithreaded
native code (which OpenGL apps are).

So try it again on your 2.3.3 emulator ... works for me.
But yes... I wasted quite a bit of time too on this.

REVERSE

未讀,
2011年4月7日 清晨7:06:332011/4/7
收件者:android-ndk
I've tried 2.3 and 2.3.3 emulators - no luck. May be bare ndk-gdb
without Eclipse can do that? But it will be a hell :(

Daniel Pastore

未讀,
2011年4月7日 清晨7:56:552011/4/7
收件者:andro...@googlegroups.com
Hi guys,

The most updated NDK Guide using Sequoyah is now on the wiki:

We still have to update the webpage, sorry for the confusion!

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




--
Thanks,

Daniel Pastore
Sequoyah Team

Krunal Shah

未讀,
2011年4月7日 上午10:17:582011/4/7
收件者:andro...@googlegroups.com

Hi,

Do we need eclipse 3.6 or higher for this to work? I encountered errors stating there were some dependencies missing from the update url.. I am trying to follow step 1 on eclipse 3.5....

Also it's strange as first we install updates from the sequoyah site and then the later steps says to install cdt 7.0

Thanks,
Krunal

On Apr 7, 2011 6:57 AM, "Daniel Pastore" <kpq...@motorola.com> wrote:

Krunal Shah

未讀,
2011年4月7日 中午12:50:472011/4/7
收件者:andro...@googlegroups.com
Details on the log message while I try to do a software update on the url http://download.eclipse.org/sequoyah/updates/1.1
I am currently using the Eclipse 3.5 for the project.

Is this update possible if i do the software update on CDT 7?

Cannot complete the install because of a conflicting dependency.
  Software being installed: Sequoyah Android Native Code Support 1.1.1.N20101217-0137 (org.eclipse.sequoyah.android.
cdt.feature.feature.group 1.1.1.N20101217-0137)
  Software currently installed: Eclipse IDE for Java EE Developers 1.2.2.20100217-2310 (epp.package.jee 1.2.2.20100217-2310)
  Only one of the following can be installed at once:
    Core Resource Management 3.6.0.v20100526-0737 (org.eclipse.core.resources 3.6.0.v20100526-0737)
    Core Resource Management 3.5.0.v20090512 (org.eclipse.core.resources 3.5.0.v20090512)
    Core Resource Management 3.6.0.R36x_v20100825-0600 (org.eclipse.core.resources 3.6.0.R36x_v20100825-0600)
    Core Resource Management 3.5.2.R35x_v20091203-1235 (org.eclipse.core.resources 3.5.2.R35x_v20091203-1235)
    Core Resource Management 3.5.1.R35x_v20090826-0451 (org.eclipse.core.resources 3.5.1.R35x_v20090826-0451)
    Core Resource Management 3.6.1.R36x_v20110131-1630 (org.eclipse.core.resources 3.6.1.R36x_v20110131-1630)
  Cannot satisfy dependency:
    From: Eclipse IDE for Java EE Developers 1.2.2.20100217-2310 (epp.package.jee 1.2.2.20100217-2310)
    To: org.eclipse.epp.package.jee.feature.feature.group [1.2.2.20100217-2310]
  Cannot satisfy dependency:
    From: Java EE IDE Feature 1.2.2.20100217-2310 (org.eclipse.epp.package.jee.feature.feature.group 1.2.2.20100217-2310)
    To: org.eclipse.platform.feature.group [3.5.2.R35x_v20100210-0800-9hEiFzmFst-TiEn9hNYgDWg1XN8ulH_JvCNGB]
  Cannot satisfy dependency:
    From: Eclipse Platform 3.5.2.R35x_v20100210-0800-9hEiFzmFst-TiEn9hNYgDWg1XN8ulH_JvCNGB (org.eclipse.platform.feature.group 3.5.2.R35x_v20100210-0800-9hEiFzmFst-TiEn9hNYgDWg1XN8ulH_JvCNGB)
    To: org.eclipse.core.resources [3.5.2.R35x_v20091203-1235]
  Cannot satisfy dependency:
    From: Sequoyah Android Native Support UI 1.1.1.N20101217-0137 (org.eclipse.sequoyah.android.cdt.build.ui 1.1.1.N20101217-0137)
    To: bundle org.eclipse.core.resources 3.6.0
  Cannot satisfy dependency:
    From: Sequoyah Android Native Code Support 1.1.1.N20101217-0137 (org.eclipse.sequoyah.android.cdt.feature.feature.group 1.1.1.N20101217-0137)
    To: org.eclipse.sequoyah.android.cdt.build.ui [1.1.1.N20101217-0137]


Thanks,
Krunal

Riasat Abir

未讀,
2011年4月7日 晚上11:55:142011/4/7
收件者:andro...@googlegroups.com
Yes you need eclipse 3.6 or higher as 3.5 doesn't support CDT 7.0 I think.

I've been facing one problem regarding work with eclipse for c/cpp files. When I press F3 on a function, it doesn't find the defination/declaration of the function as it works for java files :(
But with 3.5 I was able to do that for cpp files by default :s

Anyone knows how to enable that?

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



--

HimHim

Krunal Shah

未讀,
2011年4月14日 中午12:23:472011/4/14
收件者:andro...@googlegroups.com、Riasat Abir
Hi Guys,

Changes that may be useful in the set up guide at http://wiki.eclipse.org/Sequoyah/ndk_guide

Step : "Modify the
gdb.setup file located in the folder $PROJECT_PATH/obj/local/armeabi/"
This is the last step specified at the http://wiki.eclipse.org/Sequoyah/ndk_guide

I personally feel it must occur ahead in the chain, as the Step "GDB command file: PROJECT_PATH/obj/local/armeabi/gdb2.setup" may need the changed set up file
without "target remote:5039" before hand.

Krunal

Krunal Shah

未讀,
2011年4月14日 中午12:25:092011/4/14
收件者:andro...@googlegroups.com、Riasat Abir
Also adding *Eclipse 3.6" to the prerequisite section may be helpful.

Krunal Shah

未讀,
2011年4月21日 上午11:27:352011/4/21
收件者:andro...@googlegroups.com、Riasat Abir
I am not able to step into the native code. These are steps recommended on Sequoyah web. Please let me know what could have gone wrong.

1) I debug as  Android Application and reach the break point at System.loadLibrary()
2) Run the # ndk-gdb --verbose command on the cygwin terminal
 Please refer the verbose text with the #$GDBCLIENT -x `native_path $GDBSETUP` line commented out
Android NDK installation path: /cygdrive/c/android-ndk-r5b
Using default adb command: /cygdrive/c/android-sdk-windows/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.26
Using final ADB command: '/cygdrive/c/android-sdk-windows/platform-tools/adb'
Using auto-detected project path: .
Found package name: com.motorola.situation.engine
ABIs targetted by application: armeabi
Device API Level: 8
Device CPU ABI: armeabi
Compatible device ABI: armeabi
Found debuggable flag: true
Found device gdbserver: /data/data/com.motorola.situation.engine/lib/gdbserver
Using gdb setup init: /cygdrive/c/Engine/libs/armeabi/gdb.setup
Using toolchain prefix: /cygdrive/c/android-ndk-r5b/toolchains/arm-linux-android
eabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi-
Using app out directory: /cygdrive/c/Engine/obj/local/armeabi
Found data directory: '/data/data/com.motorola.situation.engine'
Found running PID: 299
Launched gdbserver succesfully.
Setup network redirection
## COMMAND: /cygdrive/c/android-sdk-windows/platform-tools/adb shell run-as com.
motorola.situation.engine lib/gdbserver +debug-socket --attach 299
## COMMAND: /cygdrive/c/android-sdk-windows/platform-tools/adb forward tcp:5039
localfilesystem:/data/data/com.motorola.situation.engine/debug-socket
## COMMAND: /cygdrive/c/android-sdk-windows/platform-tools/adb pull /system/bin/
app_process C:/Engine/obj/local/armeabi/app_process
354 KB/s (5676 bytes in 0.015s)
Pulled app_process from device/emulator.
## COMMAND: /cygdrive/c/android-sdk-windows/platform-tools/adb pull /system/lib/
libc.so C:/Engine/obj/local/armeabi/libc.so
Attached; pid = 299
Listening on sockaddr socket debug-socket
86 KB/s (270068 bytes in 3.046s)
Pulled libc.so from device/emulator.


3) Then I run the debug C/C++ application with following configuration
Main->C/C++ pointing to C:\Engine\obj\local\armeabi\app_process

Debugger->Main->GDB debugger pointing to C:\android-ndk-r5b\toolchains\arm-eabi-4.4.0\prebuilt\windows\bin\arm-eabi-gdb.exe
Debugger->Main->GDB Command File pointing to <project dir>\obj\local\armeabi\gdb2.setup I commented out the 'target remote :5039'
Debugger->Connection->Type = TCP , HostName = localhost and Port Number is 5039 (The one mentioned on the ndk-gdb file)

4) On pressing Debug -> I see the attached output ->
And the cygwin terminal displays the following

njxd67@NJXD67-1 /cygdrive/c/Engine
# Thread debugging is unsupported on this Android platform!
Thread debugging is unsupported on this Android platform!

Please let me know if you encountered this error before and if at all I missed some thing. I can debug however it doesn't enter the native function on Fnc5 key.

Krunal
ConsoleOutput

Riasat Abir

未讀,
2011年4月22日 凌晨12:57:352011/4/22
收件者:android-ndk
Hi

I debbuged with NDK-GDB, not the ide debbuger. It seemed easier to use than setting up sequoyah for me!

Regards,
Riasat
--

HimHim

回覆所有人
回覆作者
轉寄
0 則新訊息