More universal GraphExporter

Log exceptions on copy to clipboard graph
This commit is contained in:
Jindra Petřík
2018-05-24 15:31:30 +02:00
parent 7f7945e9c2
commit cdd1acb1f9
12 changed files with 148 additions and 38 deletions
@@ -303,6 +303,16 @@ public class AVM2DeobfuscatorRegisters extends AVM2DeobfuscatorSimple {
public long pos2adr(int pos) {
return code.pos2adr(pos);
}
@Override
public Set<Long> getImportantAddresses() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String insToString(int pos) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
});
idx = branches.get(0);
for (int n = 1; n < branches.size(); n++) {
@@ -266,6 +266,16 @@ public class AVM2DeobfuscatorRegistersOld extends AVM2DeobfuscatorSimpleOld {
public long pos2adr(int pos) {
return code.pos2adr(pos);
}
@Override
public Set<Long> getImportantAddresses() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String insToString(int pos) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
});
idx = branches.get(0);
for (int n = 1; n < branches.size(); n++) {
@@ -24,6 +24,7 @@ import com.jpexs.decompiler.flash.abc.avm2.ConvertOutput;
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.helpers.Reference;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.graph.DottedChain;
import com.jpexs.decompiler.graph.GraphPart;
import com.jpexs.decompiler.graph.GraphSource;
@@ -34,6 +35,7 @@ import com.jpexs.decompiler.graph.TranslateStack;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
/**
*
@@ -85,6 +87,19 @@ public class AVM2GraphSource extends GraphSource {
code.calculateDebugFileLine(abc);
}
@Override
public Set<Long> getImportantAddresses() {
return code.getImportantOffsets(body, false);
}
@Override
public String insToString(int pos) {
if (pos < code.code.size()) {
return code.code.get(pos).toStringNoAddress(abc.constants, fullyQualifiedNames);
}
return "";
}
@Override
public int size() {
return code.code.size();
@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.␍ */
* License along with this library.
*/
package com.jpexs.decompiler.flash.abc.avm2.instructions;
import com.jpexs.decompiler.flash.BaseLocalData;
@@ -123,6 +124,7 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem {
return bos.toByteArray();
}
@Override
public int getBytesLength() {
int cnt = 1;
for (int i = 0; i < definition.operands.length; i++) {