Login

Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.

ARM Community: DS-5 Problem starting gdbserver to debug android NDK application - ARM Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

DS-5 Problem starting gdbserver to debug android NDK application DS-5 Problem starting gdbserver to debug android NDK application Rate Topic: -----

#1 User is offline   Nivel 

  • Member
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 09-November 10

Posted 29 December 2011 - 06:04 AM

Hi Everyone,


I am facing problem when starting debug session for native code debugging using DS-5 CE,

This is what is shown:

eclipse.buildId=M20110909-1335
java.version=1.6.0_26
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
Framework arguments: -product org.eclipse.epp.package.cpp.product
Command-line arguments: -os linux -ws gtk -arch x86 -product org.eclipse.epp.package.cpp.product

Error
Wed Dec 28 20:51:17 EET 2011
Failed gdbserver configuration:
Timeout. PID not found!

com.arm.debugger.control.target.TargetControllerException: Failed gdbserver configuration:
Timeout. PID not found!
at com.arm.debugger.control.target.TargetController.runGDB(TargetController.java:623)
at com.arm.debugger.control.target.TargetController.setupAndroid(TargetController.java:108)
at com.arm.debugger.control.target.TargetController.setupGdbServerOnTarget(TargetController.java:121)
at com.arm.debugger.control.target.TargetController.setupTarget(TargetController.java:78)
at com.arm.debugger.control.ConnectionController.doPreDebugServiceInitialization(ConnectionController.java:592)
at com.arm.debugger.control.ConnectionController.doInitialize(ConnectionController.java:533)
at com.arm.debugger.control.ConnectionController.manageThreadModelAndInitialize(ConnectionController.java:524)
at com.arm.debugger.control.ConnectionController.manageConnectionCleanupAndInitialize(ConnectionController.java:510)
at com.arm.debugger.control.ConnectionController.manageProgressResourceAndInitialize(ConnectionController.java:463)
at com.arm.debugger.control.ConnectionController.initializeNonModelConnection(ConnectionController.java:435)
at com.arm.debugger.control.ConnectionController.initialize(ConnectionController.java:410)
at com.arm.debugger.control.ConnectionManager.createConnection(ConnectionManager.java:391)
at com.arm.debugger.launcher.TargetLauncher.connect(TargetLauncher.java:70)
at com.arm.debugger.launcher.TargetLauncher.launch(TargetLauncher.java:44)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:854)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:928)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1132)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)



The set-up the environment is based on these guidelines:

http://infocenter.ar...h/CIHEEGJH.html

http://kernel.ozandroid.info/?p=83




I am on 32 bit Ubuntu 11.10 host and debugging is on avd API level 14


What could be the problem?



Thanks a lot in advance!
0

#2 User is offline   AlbertCano 

  • Member
  • Pip
  • Group: Members.
  • Posts: 8
  • Joined: 10-June 11

Posted 03 January 2012 - 03:04 PM

Hi Nivel,

The reason is that the script is not able to find the PID associated with the application (e.g. com.example.neon). This problem can occur for several reasons, such as:
1) The apk is not installed correctly.
2) The activity does not start properly.
3) The application is killed by the kernel/system, or terminated prematurely.
4) Others...

Considering that you have built "HelloNeon.apk" following the instructions listed in http://infocenter.ar...h/CIHEEGJH.html , I suggest you to run the following adb commands from a console to determine which one is giving you problems.

1) The apk is not installed correctly.
execute:
> adb uninstall com.example.neon *This command could return Failure if the app is not installed, that's ok
> adb install <your_apk_path>/HelloNeon.apk" *This command should return "Success"

2) The activity does not start properly.
execute:
> adb shell am start -n com.example.neon/.HelloNeon *The app should start executing

3) The application is killed by the kernel/system, or terminated prematurely.
execute:
> adb shell ps *List the processes. If the process is still alive (even if the app has finished), you should see something similar to:

<<
...
app_40 810 36 164732 33900 ffffffff 40011384 S com.example.neon
...
>>

Please, provide us with the output of the commands in order to narrow your problem.

Thanks
1

#3 User is offline   Nivel 

  • Member
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 09-November 10

Posted 04 January 2012 - 07:38 AM

Hi Albert,

And thanks a lot for your assistance!!!

I am going to perform the suggested tests ASAP and let you know what the results are!

Thanks again,

Best Regards,
N
1

#4 User is offline   Nivel 

  • Member
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 09-November 10

Posted 07 January 2012 - 08:26 AM

Hi Guys,




I tried once more with hello neon example from NDK.

No problem to install and run the application via adb

app_40 2673 1103 119440 30764 ffffffff 400b03c4 S com.example.neon



No problem as well to install and debug Java part via ADT plug-in.



But this is what logcat is showing when trying DS-5:



01-05 17:29:39.184: D/AndroidRuntime(6871): Shutting down VM

01-05 17:29:39.196: D/dalvikvm(6871): GC_CONCURRENT freed 101K, 77% free 483K/2048K, paused 1ms+1ms

01-05 17:29:39.196: D/jdwp(6871): Got wake-up signal, bailing out of select

01-05 17:29:39.196: D/dalvikvm(6871): Debugger has detached; object registry had 1 entries

01-05 17:29:39.226: I/jdwp(89): Ignoring second debugger -- accepting and dropping

01-05 17:29:39.226: I/AndroidRuntime(6871): NOTE: attach of thread 'Binder Thread #3' failed

01-05 17:29:39.237: I/jdwp(143): Ignoring second debugger -- accepting and dropping

01-05 17:29:39.268: I/jdwp(157): Ignoring second debugger -- accepting and dropping

01-05 17:29:39.277: I/jdwp(167): Ignoring second debugger -- accepting and dropping

01-05 17:29:39.309: I/jdwp(184): Ignoring second debugger -- accepting and dropping

01-05 17:29:39.326: I/jdwp(213): Ignoring second debugger -- accepting and dropping

01-05 17:29:39.336: I/jdwp(229): Ignoring second debugger -- accepting and dropping

01-05 17:29:39.364: I/jdwp(258): Ignoring second debugger -- accepting and dropping

01-05 17:29:39.382: I/jdwp(291): Ignoring second debugger -- accepting and dropping

01-05 17:29:39.417: I/jdwp(309): Ignoring second debugger -- accepting and dropping

01-05 17:29:39.432: I/jdwp(326): Ignoring second debugger -- accepting and dropping

01-05 17:29:39.459: I/jdwp(350): Ignoring second debugger -- accepting and dropping

01-05 17:29:39.489: I/jdwp(369): Ignoring second debugger -- accepting and dropping

01-05 17:29:39.489: I/WindowManager(89): createSurface Window{415cae40 Starting com.example.neon paused=false}: DRAW NOW PENDING

01-05 17:29:39.497: I/jdwp(394): Ignoring second debugger -- accepting and dropping

01-05 17:29:39.516: I/jdwp(412): Ignoring second debugger -- accepting and dropping

01-05 17:29:39.538: I/jdwp(800): Ignoring second debugger -- accepting and dropping

01-05 17:29:39.558: I/jdwp(829): Ignoring second debugger -- accepting and dropping

01-05 17:29:39.596: I/jdwp(872): Ignoring second debugger -- accepting and dropping

01-05 17:29:39.618: I/jdwp(941): Ignoring second debugger -- accepting and dropping

01-05 17:29:40.076: D/dalvikvm(6882): Not late-enabling CheckJNI (already on)

01-05 17:29:40.149: I/ActivityManager(89): Start proc com.example.neon for activity com.example.neon/.HelloNeon: pid=6882 uid=10040 gids={1015}

01-05 17:29:40.198: I/jdwp(89): Ignoring second debugger -- accepting and dropping

01-05 17:29:40.207: I/jdwp(143): Ignoring second debugger -- accepting and dropping

01-05 17:29:40.234: I/jdwp(157): Ignoring second debugger -- accepting and dropping

01-05 17:29:40.246: I/jdwp(167): Ignoring second debugger -- accepting and dropping

01-05 17:29:40.258: I/jdwp(184): Ignoring second debugger -- accepting and dropping

01-05 17:29:40.286: I/jdwp(213): Ignoring second debugger -- accepting and dropping

01-05 17:29:40.308: I/jdwp(229): Ignoring second debugger -- accepting and dropping

01-05 17:29:40.329: I/jdwp(258): Ignoring second debugger -- accepting and dropping

01-05 17:29:40.339: I/jdwp(291): Ignoring second debugger -- accepting and dropping

01-05 17:29:40.357: I/jdwp(309): Ignoring second debugger -- accepting and dropping

01-05 17:29:40.377: I/jdwp(326): Ignoring second debugger -- accepting and dropping

01-05 17:29:40.422: I/jdwp(350): Ignoring second debugger -- accepting and dropping

01-05 17:29:40.438: I/jdwp(369): Ignoring second debugger -- accepting and dropping

01-05 17:29:40.458: I/jdwp(394): Ignoring second debugger -- accepting and dropping

01-05 17:29:40.468: I/jdwp(412): Ignoring second debugger -- accepting and dropping

01-05 17:29:40.478: I/jdwp(800): Ignoring second debugger -- accepting and dropping

01-05 17:29:40.496: I/jdwp(829): Ignoring second debugger -- accepting and dropping

01-05 17:29:40.518: I/jdwp(872): Ignoring second debugger -- accepting and dropping

01-05 17:29:40.539: I/jdwp(941): Ignoring second debugger -- accepting and dropping

01-05 17:29:40.828: W/NetworkManagementSocketTagger(89): setKernelCountSet(10040, 1) failed with errno -2

01-05 17:29:41.078: D/dalvikvm(6882): Trying to load lib /data/data/com.example.neon/lib/libhelloneon.so 0x413469f0

01-05 17:29:41.088: D/dalvikvm(6882): Added shared lib /data/data/com.example.neon/lib/libhelloneon.so 0x413469f0

01-05 17:29:41.088: D/dalvikvm(6882): No JNI_OnLoad found in /data/data/com.example.neon/lib/libhelloneon.so 0x413469f0, skipping init

01-05 17:29:41.198: I/helloneon(6882): enter app.....

01-05 17:29:44.216: V/PhoneStatusBar(143): setLightsOn(true)



It seems problem to run gdbserver.



I tried on a real Android device (Linaro Android on i.MX53 QSB), again application is installed and started, but gdbserver PID cannot be found:

logcat:

01-08 00:38:23.110: D/AndroidRuntime(1931): Calling main entry com.android.commands.am.Am

01-08 00:38:23.150: I/ActivityManager(1176): START {flg=0x10000000 cmp=com.example.neon/.HelloNeon} from pid 1931

01-08 00:38:23.210: D/dalvikvm(1941): Not late-enabling CheckJNI (already on)

01-08 00:38:23.220: D/AndroidRuntime(1931): Shutting down VM

01-08 00:38:23.220: I/ActivityManager(1176): Start proc com.example.neon for activity com.example.neon/.HelloNeon: pid=1941 uid=10040 gids={1015}

01-08 00:38:23.240: D/dalvikvm(1931): GC_CONCURRENT freed 101K, 77% free 483K/2048K, paused 0ms+1ms

01-08 00:38:23.240: I/AndroidRuntime(1931): NOTE: attach of thread 'Binder Thread #3' failed

01-08 00:38:23.240: D/jdwp(1931): Got wake-up signal, bailing out of select

01-08 00:38:23.240: D/dalvikvm(1931): Debugger has detached; object registry had 1 entries

01-08 00:38:23.430: D/dalvikvm(1176): GC_EXPLICIT freed 340K, 19% free 10201K/12487K, paused 4ms+8ms

01-08 00:38:23.580: D/dalvikvm(1941): Trying to load lib /data/data/com.example.neon/lib/libhelloneon.so 0x41052a48

01-08 00:38:23.580: D/dalvikvm(1941): Added shared lib /data/data/com.example.neon/lib/libhelloneon.so 0x41052a48

01-08 00:38:23.590: D/dalvikvm(1941): No JNI_OnLoad found in /data/data/com.example.neon/lib/libhelloneon.so 0x41052a48, skipping init

01-08 00:38:23.610: I/helloneon(1941): enter app.....

01-08 00:38:24.030: W/ActivityManager(1176): Activity pause timeout for ActivityRecord{411f2e40 com.example.neon/.HelloNeon}

01-08 00:38:25.990: I/WindowManager(1176): createSurface Window{411f15e0 com.example.neon/com.example.neon.HelloNeon paused=false}: DRAW NOW PENDING





What could be the problem?
0

#5 User is offline   AlbertCano 

  • Member
  • Pip
  • Group: Members.
  • Posts: 8
  • Joined: 10-June 11

Posted 09 January 2012 - 09:30 AM

Hi Nivel,

View PostNivel, on 07 January 2012 - 08:26 AM, said:

It seems problem to run gdbserver.


Gdbserver is not executed until the script finds a valid PID. The message: Ignoring second debugger -- accepting and dropping, may appear if you have two copies of DDMS running simultaneously.

Continuing narrowing your problem, could you try this?:
- Close all ADT and DDMS connections and restart the AVD.
- Reinstall the app (adb unistall + adb install)
- Start the app (adb shell am start ..)
- Check and make sure the app is running (adb shell ps)
- Go to Eclipse -> DS-5 Debugger -> <Your Debug Configuration> and select: Debug operation = "Attach to a running Android application".
- Click Debug.

If the above steps work (you are able to connect to gdbserver), I think you have a problem with the 5s timeout set up to find the PID of the app. Please refer to: http://forums.arm.co...rror-code-0x01/
to modify the SLEEP value to readjust the script timeout for your environment.

Thanks.
1

#6 User is offline   Nivel 

  • Member
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 09-November 10

Posted 09 January 2012 - 06:02 PM

Well, negative as well.

the application is running:
app_40 691 37 130940 34864 ffffffff 40011384 S com.example.neon

but:


eclipse.buildId=M20110909-1335
java.version=1.6.0_26
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
Framework arguments: -product org.eclipse.epp.package.cpp.product
Command-line arguments: -os linux -ws gtk -arch x86 -product org.eclipse.epp.package.cpp.product

Error
Mon Jan 09 19:38:01 EET 2012
Failed gdbserver configuration:
Timeout. PID not found!

com.arm.debugger.control.target.TargetControllerException: Failed gdbserver configuration:
Timeout. PID not found!
at com.arm.debugger.control.target.TargetController.runGDB(TargetController.java:623)
at com.arm.debugger.control.target.TargetController.setupAndroid(TargetController.java:108)
at com.arm.debugger.control.target.TargetController.setupGdbServerOnTarget(TargetController.java:121)
at com.arm.debugger.control.target.TargetController.setupTarget(TargetController.java:78)
at com.arm.debugger.control.ConnectionController.doPreDebugServiceInitialization(ConnectionController.java:592)
at com.arm.debugger.control.ConnectionController.doInitialize(ConnectionController.java:533)
at com.arm.debugger.control.ConnectionController.manageThreadModelAndInitialize(ConnectionController.java:524)
at com.arm.debugger.control.ConnectionController.manageConnectionCleanupAndInitialize(ConnectionController.java:510)
at com.arm.debugger.control.ConnectionController.manageProgressResourceAndInitialize(ConnectionController.java:463)
at com.arm.debugger.control.ConnectionController.initializeNonModelConnection(ConnectionController.java:435)
at com.arm.debugger.control.ConnectionController.initialize(ConnectionController.java:410)
at com.arm.debugger.control.ConnectionManager.createConnection(ConnectionManager.java:391)
at com.arm.debugger.launcher.TargetLauncher.connect(TargetLauncher.java:70)
at com.arm.debugger.launcher.TargetLauncher$ConnectJob.run(TargetLauncher.java:99)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
0

#7 User is offline   AlbertCano 

  • Member
  • Pip
  • Group: Members.
  • Posts: 8
  • Joined: 10-June 11

Posted 10 January 2012 - 08:36 AM

View PostNivel, on 09 January 2012 - 06:02 PM, said:

Well, negative as well.

the application is running:
app_40 691 37 130940 34864 ffffffff 40011384 S com.example.neon



Ok, let's try to run gdbserver manually, and check, as you said yesterday, if the problem is related to it:

- uninstall, install, run the app
- list processes 'adb shell ps' to get app's PID. The app's PID is the numeric value in the second row (e.g. 691 for your app above)
- execute: 'adb shell run-as com.example.neon lib/gdbserver +debug-socket --attach <pid_found>'

Thanks.

This post has been edited by AlbertCano: 12 January 2012 - 12:45 PM

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic