Skip to content

Commit

Permalink
[Dex] Convenient code & debug clear methods
Browse files Browse the repository at this point in the history
  • Loading branch information
REAndroid committed Apr 5, 2024
1 parent e5f5aff commit 5b12c57
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/main/java/com/reandroid/dex/data/MethodDef.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,15 @@ public CodeItem getCodeItem(){
}
return codeItem;
}
public void clearCode(){
codeOffset.setItem((CodeItem) null);
}
public void clearDebug(){
CodeItem codeItem = getCodeItem();
if(codeItem != null){
codeItem.removeDebugInfo();
}
}
private void linkCodeItem(){
CodeItem codeItem = codeOffset.getItem();
if(codeItem != null){
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/com/reandroid/dex/model/DexMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import com.reandroid.dex.key.Key;
import com.reandroid.dex.key.MethodKey;
import com.reandroid.dex.key.TypeKey;
import com.reandroid.dex.smali.SmaliParser;
import com.reandroid.dex.smali.SmaliReader;
import com.reandroid.dex.smali.SmaliWriter;
import com.reandroid.dex.smali.model.SmaliInstruction;
Expand Down Expand Up @@ -160,6 +159,12 @@ public Iterator<DexInstruction> getInstructions(Predicate<? super Ins> filter) {
public Iterator<DexInstruction> getInstructions() {
return DexInstruction.create(this, getDefinition().getInstructions());
}
public void clearCode(){
getDefinition().clearCode();
}
public void clearDebug(){
getDefinition().clearDebug();
}
public Iterator<DexTry> getDexTry() {
TryBlock tryBlock = getDefinition().getTryBlock();
if(tryBlock == null){
Expand Down

0 comments on commit 5b12c57

Please sign in to comment.