Debugging jni app: 'adb shell run-as' does not work on 4.4.2

569 views
Skip to first unread message

György Kövesdi

unread,
Sep 16, 2014, 3:08:44 AM9/16/14
to andro...@googlegroups.com
Hi,

I just want to debug my jni application. I found the script 'ndk-gdb' in the documentation, but when I start it, the following error occurs:
run-as: Package 'com.android.mypackage' is unknown
The path is correct, the app is installed, it runs correctly, compiled with debug, and I have no other problem but starting the debugger.

  $ adb shell cat /data/system/packages.list
/system/bin/sh: cat: /data/system/packages.list: Permission denied
  $ adb shell ls -l /data/system/packages.list
-rw-rw---- system   package_info    33709 2014-09-16 08:14 packages.list

I found this problem in the forums: there is an access right problem about the file '/data/system/packages.list': it is set to 660 instead of 664. But it was long time ago in 4.2.2 and it has not been resolved yet in 4.4.2.
If 'run-as' does not work, I cannot start gdbserver because it has no rights to access my application.

Some solutions suggest to root the device but it is risky and I do not want to do it. I just want to debug my application. Currently, all possible solutions lead me to the 'run-as' problem. Is it possible anyway?

I have Samsung Galaxy S4

Thanx in advance
Gyorgy Kovesdi

yaturner

unread,
Sep 17, 2014, 1:29:03 PM9/17/14
to andro...@googlegroups.com
I have made a number of changes from various sources and my own debugging to the ndk-gdb script and it works for me now, I'll include it with this in the hopes that it will solve your problem. I did have to change the run-as as noted in the script. I had to change the filetype of the script to txt so that it could be uploaded.
ndk-gdb copy.txt
Reply all
Reply to author
Forward
0 new messages