Commit 75c42e7f authored by swift_gan's avatar swift_gan

avoid inline when call origin

parent feeab481
......@@ -6,6 +6,7 @@ import android.content.Context;
import com.swift.sandhook.xposedcompat.classloaders.ComposeClassLoader;
import com.swift.sandhook.xposedcompat.methodgen.DynamicBridge;
import com.swift.sandhook.xposedcompat.utils.ApplicationUtils;
import com.swift.sandhook.xposedcompat.utils.FileUtils;
import com.swift.sandhook.xposedcompat.utils.ProcessUtils;
import java.io.File;
......@@ -75,7 +76,7 @@ public class XposedCompat {
public static boolean clearCache() {
try {
cacheDir.delete();
FileUtils.delete(cacheDir);
cacheDir.mkdirs();
return true;
} catch (Throwable throwable) {
......
......@@ -4,6 +4,7 @@ import android.os.Trace;
import com.swift.sandhook.xposedcompat.XposedCompat;
import com.swift.sandhook.xposedcompat.utils.DexLog;
import com.swift.sandhook.xposedcompat.utils.FileUtils;
import java.io.File;
import java.lang.reflect.Constructor;
......@@ -71,7 +72,8 @@ public final class DynamicBridge {
if (!dexOatDir.exists())
return;
try {
dexOatDir.delete();
FileUtils.delete(dexOatDir);
dexOatDir.mkdirs();
} catch (Throwable throwable) {
}
}
......
......@@ -267,11 +267,18 @@ public class HookerDexMaker {
private void generateBackupMethod() {
mBackupMethodId = mHookerTypeId.getMethod(mReturnTypeId, METHOD_NAME_BACKUP, mParameterTypeIds);
Code code = mDexMaker.declare(mBackupMethodId, Modifier.PUBLIC | Modifier.STATIC);
Local<Member> method = code.newLocal(memberTypeId);
Map<TypeId, Local> resultLocals = createResultLocals(code);
MethodId<?, ?> errLogMethod = TypeId.get(DexLog.class).getMethod(TypeId.get(Void.TYPE), "printCallOriginError", TypeId.get(Member.class));
//very very important!!!!!!!!!!!
//add a try cache block avoid inline
Label tryCatchBlock = new Label();
code.sget(mMethodFieldId, method);
code.invokeStatic(errLogMethod, null, method);
// start of try
code.addCatchClause(throwableTypeId, tryCatchBlock);
......
......@@ -29,6 +29,12 @@ public class DexLog {
}
}
public static void printCallOriginError(Member member) {
if (member != null) {
Log.e("SandHook-Xposed", "method <" + member.toString() + "> call origin error!");
}
}
public static int w(String s) {
return Log.w(TAG, s);
}
......@@ -40,4 +46,6 @@ public class DexLog {
public static int e(String s, Throwable t) {
return Log.e(TAG, s, t);
}
}
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