我无法从我的 java 应用程序运行 strace 命令。
我试过上面的代码
try {
// Executes the command.
java.lang.Process process = Runtime.getRuntime().exec("strace -p 2545 -o /mnt/sdcard/Result.txt");
BufferedReader reader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
int read;
char[] buffer = new char[4096];
StringBuffer output = new StringBuffer();
while ((read = reader.read(buffer)) > 0) {
output.append(buffer, 0, read);
}
reader.close();
// Waits for the command to finish.
process.waitFor();
output.toString() ;
} catch (IOException e) {
throw new RuntimeException(e);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
我可以请你帮忙吗?我的 android 版本是 2.2,我的内核版本是 2.6.32.9