AS1/2: Displaying script path on invalid jump error log

This commit is contained in:
Jindra Petřík
2018-01-27 20:25:07 +01:00
parent eb30c18fba
commit e862df59c1
10 changed files with 27 additions and 18 deletions

View File

@@ -2035,7 +2035,7 @@ public final class SWF implements SWFContainerItem, Timelined {
ip = code.adr2pos(addr);
addr += size;
int nextip = code.adr2pos(addr);
getVariables(aLocalData.insideDoInitAction, variables, functions, strings, usageTypes, new ActionGraphSource(aLocalData.insideDoInitAction, code.getActions().subList(ip, nextip), code.version, new HashMap<>(), new HashMap<>(), new HashMap<>()), 0, path + (cntName == null ? "" : "/" + cntName));
getVariables(aLocalData.insideDoInitAction, variables, functions, strings, usageTypes, new ActionGraphSource(path, aLocalData.insideDoInitAction, code.getActions().subList(ip, nextip), code.version, new HashMap<>(), new HashMap<>(), new HashMap<>()), 0, path + (cntName == null ? "" : "/" + cntName));
ip = nextip;
}
List<List<GraphTargetItem>> r = new ArrayList<>();
@@ -2136,7 +2136,7 @@ public final class SWF implements SWFContainerItem, Timelined {
ActionList actions = src.getActions();
actionsMap.put(src, actions);
boolean insideDoInitAction = src instanceof DoInitActionTag;
getVariables(insideDoInitAction, variables, functions, strings, usageTypes, new ActionGraphSource(insideDoInitAction, actions, version, new HashMap<>(), new HashMap<>(), new HashMap<>()), 0, path);
getVariables(insideDoInitAction, variables, functions, strings, usageTypes, new ActionGraphSource(path, insideDoInitAction, actions, version, new HashMap<>(), new HashMap<>(), new HashMap<>()), 0, path);
return ret;
}

View File

@@ -65,8 +65,8 @@ public class ActionGraph extends Graph {
private boolean insideDoInitAction;
public ActionGraph(boolean insideDoInitAction, List<Action> code, HashMap<Integer, String> registerNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int version) {
super(new ActionGraphSource(insideDoInitAction, code, version, registerNames, variables, functions), new ArrayList<>());
public ActionGraph(String path, boolean insideDoInitAction, List<Action> code, HashMap<Integer, String> registerNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int version) {
super(new ActionGraphSource(path, insideDoInitAction, code, version, registerNames, variables, functions), new ArrayList<>());
this.insideDoInitAction = insideDoInitAction;
}
@@ -76,7 +76,7 @@ public class ActionGraph extends Graph {
public static List<GraphTargetItem> translateViaGraph(boolean insideDoInitAction, HashMap<Integer, String> registerNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, List<Action> code, int version, int staticOperation, String path) throws InterruptedException {
ActionGraph g = new ActionGraph(insideDoInitAction, code, registerNames, variables, functions, version);
ActionGraph g = new ActionGraph(path, insideDoInitAction, code, registerNames, variables, functions, version);
ActionLocalData localData = new ActionLocalData(insideDoInitAction, registerNames);
g.init(localData);
return g.translate(localData, staticOperation, path);

View File

@@ -48,17 +48,20 @@ public class ActionGraphSource extends GraphSource {
private final boolean insideDoInitAction;
private final String path;
public List<Action> getActions() {
return actions;
}
public ActionGraphSource(boolean insideDoInitAction, List<Action> actions, int version, HashMap<Integer, String> registerNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions) {
public ActionGraphSource(String path, boolean insideDoInitAction, List<Action> actions, int version, HashMap<Integer, String> registerNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions) {
this.actions = actions;
this.version = version;
this.registerNames = registerNames;
this.variables = variables;
this.functions = functions;
this.insideDoInitAction = insideDoInitAction;
this.path = path;
}
@Override
@@ -139,7 +142,7 @@ public class ActionGraphSource extends GraphSource {
}
//ret = adr2posInside(adr);
if (ret == -1) {
Logger.getLogger(ActionGraphSource.class.getName()).log(Level.SEVERE, "Address loc" + Helper.formatAddress(adr) + " not found");
Logger.getLogger(ActionGraphSource.class.getName()).log(Level.SEVERE, "{0} - address loc{1} not found", new Object[]{path, Helper.formatAddress(adr)});
/*System.err.println("Addr loc"+Helper.formatAddress(adr)+" not found");
int pos=0;
for(long l:posCache){

View File

@@ -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.tags;
import com.jpexs.decompiler.flash.DisassemblyListener;
@@ -140,7 +141,7 @@ public class DoActionTag extends Tag implements ASMSource {
actions = getActions();
}
return Action.actionsToSource(this, actions, getScriptName(), writer);
}
/**

View File

@@ -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.tags;
import com.jpexs.decompiler.flash.DisassemblyListener;
@@ -148,7 +149,7 @@ public class DoInitActionTag extends Tag implements CharacterIdTag, ASMSource {
actions = getActions();
}
return Action.actionsToSource(this, actions, getScriptName(), writer);
}
@Override

View File

@@ -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.tags.base;
import com.jpexs.decompiler.flash.DisassemblyListener;
@@ -70,7 +71,7 @@ public class ButtonAction implements ASMSource {
actions = getActions();
}
return Action.actionsToSource(this, actions, getScriptName(), writer);
}
/**

View File

@@ -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.types;
import com.jpexs.decompiler.flash.DisassemblyListener;
@@ -195,7 +196,7 @@ public class BUTTONCONDACTION implements ASMSource, Serializable {
actions = getActions();
}
return Action.actionsToSource(this, actions, getScriptName(), writer);
}
/**

View File

@@ -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.types;
import com.jpexs.decompiler.flash.DisassemblyListener;
@@ -197,7 +198,7 @@ public class CLIPACTIONRECORD implements ASMSource, Serializable {
actions = getActions();
}
return Action.actionsToSource(this, actions, getScriptName(), writer);
}
/**