Commit 4d732e2d authored by Administrator's avatar Administrator

support waitForDebugger

parent 7626b25a
package com.virjar.ratel.api.extension.debug;
import android.os.Build;
import android.os.Debug;
import android.os.Process;
import android.util.Log;
......@@ -44,6 +45,10 @@ public class IDADebug {
}
public static void startupIdaDebug(int debugPort) {
startupIdaDebug(debugPort, false);
}
public static void startupIdaDebug(int debugPort, boolean waitForDebugger) {
boolean is64 = is64bit();
String idaBinName = is64 ? "as_adi_ratel_64" : "as_adi_ratel_32";
File idaBinFile = new File(RatelToolKit.sContext.getFilesDir(), idaBinName);
......@@ -55,8 +60,8 @@ public class IDADebug {
Log.e(tag, "error to load ida bin file", e);
}
}
if (idaBinFile.exists()) {
runIdaBinProcess(idaBinFile, debugPort);
if (idaBinFile.exists() && runIdaBinProcess(idaBinFile, debugPort) && waitForDebugger) {
Debug.waitForDebugger();
}
}
......@@ -96,14 +101,13 @@ public class IDADebug {
//return VMRuntime.is64Bit.call(VMRuntime.getRuntime.call());
}
private static void runIdaBinProcess(File binFile, int debugPort) {
private static boolean runIdaBinProcess(File binFile, int debugPort) {
if (debugPort <= 0) {
debugPort = 4689;
}
if (!binFile.canExecute()) {
if (!binFile.setExecutable(true)) {
Log.w(tag, "set executable failed for file: " + binFile.getAbsolutePath());
}
}
int finalDebugPort = debugPort;
......@@ -123,6 +127,7 @@ public class IDADebug {
}
}
}.start();
return true;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment