I want to collect system call events to android applications with strace tool First I lunch emulator then I write in terminal in linux the next command line :
adb -s emulator-5554 shell
After emulator shell I want to write strace command as shown in the picture:
from trminal it works fine with me but when I write java code
Process p=Runtime.getRuntime().exec("adb -s emulator-5554 shell");
Process p1=Runtime.getRuntime().exec("strace -p 871");
It didn't work can any one help me to write this java code in eclipse please pay attention to the picture
The
adb shell
command opens a new shell in whichstrace
is executed. The Java version of your command executed both commands in the default shell. Hence you have to combine them:Process p=Runtime.getRuntime().exec("adb -s emulator-5554 shell strace -p 871");