diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d25ff7c2..b08832883 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,9 @@ All notable changes to this project will be documented in this file. Limitation: It's not available on Mac x86-64 platform - [#2519] AS1/2 Direct editation + P-code - better handling of "too large" error messages - highlight actual problematic structure +- AS1/2 Debugging - _global variable accessible +- AS Debugging - Variables with flag DontEnumerate are hidden by default + (can be changed in Advanced Settings) ### Fixed - [#2474] Gotos incorrectly decompiled diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java index 9427ffe24..81528fb78 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java @@ -1158,6 +1158,10 @@ public final class Configuration { @ConfigurationDefaultBoolean(false) @ConfigurationCategory("script") public static ConfigurationItem autoDeobfuscateIdentifiers = null; + + @ConfigurationDefaultBoolean(false) + @ConfigurationCategory("script") + public static ConfigurationItem showVarsWithDontEnumerateFlag = null; private static Map configurationDescriptions = new LinkedHashMap<>(); private static Map configurationTitles = new LinkedHashMap<>(); diff --git a/src/com/jpexs/decompiler/flash/gui/DebugPanel.java b/src/com/jpexs/decompiler/flash/gui/DebugPanel.java index 9e9af018c..f7418366d 100644 --- a/src/com/jpexs/decompiler/flash/gui/DebugPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/DebugPanel.java @@ -39,6 +39,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JButton; @@ -501,15 +502,27 @@ public class DebugPanel extends JPanel { boolean as3 = swf.isAS3(); InFrame f = Main.getDebugHandler().getFrame(); if (f != null) { - Variable root = null; - if (!as3) { - root = Main.getDebugHandler().getVariable(0, "_root", false, false).parent; - } - safeSetTreeModel(debugRegistersTable, new ABCPanel.VariablesTableModel(debugRegistersTable, f.registers)); + + List locals = new ArrayList<>(); - if (root != null) { - locals.add(root); + + + Map placedObjects = Main.getDebugHandler().getPlacedObjects(); + for (String poName : placedObjects.keySet()) { + String realName = poName; + if ("/".equals(realName)) { + realName = "_root"; + } else if (realName.startsWith("/")) { + continue; + } + Variable placedVar = Main.getDebugHandler().getVariable(0, realName, false, false).parent; + if (placedVar != null) { + locals.add(placedVar); + } } + + safeSetTreeModel(debugRegistersTable, new ABCPanel.VariablesTableModel(debugRegistersTable, f.registers)); + locals.addAll(f.arguments); locals.addAll(f.variables); diff --git a/src/com/jpexs/decompiler/flash/gui/DebuggerHandler.java b/src/com/jpexs/decompiler/flash/gui/DebuggerHandler.java index 96af02f28..50f845290 100644 --- a/src/com/jpexs/decompiler/flash/gui/DebuggerHandler.java +++ b/src/com/jpexs/decompiler/flash/gui/DebuggerHandler.java @@ -34,6 +34,7 @@ import com.jpexs.debugger.flash.messages.in.InErrorException; import com.jpexs.debugger.flash.messages.in.InFrame; import com.jpexs.debugger.flash.messages.in.InGetVariable; import com.jpexs.debugger.flash.messages.in.InNumScript; +import com.jpexs.debugger.flash.messages.in.InPlaceObject; import com.jpexs.debugger.flash.messages.in.InProcessTag; import com.jpexs.debugger.flash.messages.in.InScript; import com.jpexs.debugger.flash.messages.in.InSetBreakpoint; @@ -45,6 +46,7 @@ import com.jpexs.debugger.flash.messages.out.OutGetBreakReason; import com.jpexs.debugger.flash.messages.out.OutPlay; import com.jpexs.debugger.flash.messages.out.OutProcessedTag; import com.jpexs.debugger.flash.messages.out.OutRewind; +import com.jpexs.debugger.flash.messages.out.OutStopDebug; import com.jpexs.debugger.flash.messages.out.OutSwfInfo; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.configuration.Configuration; @@ -53,6 +55,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; +import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; @@ -111,6 +114,8 @@ public class DebuggerHandler implements DebugConnectionListener { private List stackLines = new ArrayList<>(); private List debuggedSwfs = new ArrayList<>(); + + private Map placedObjects = new LinkedHashMap<>(); public static class ActionScriptException extends Exception { @@ -723,6 +728,8 @@ public class DebuggerHandler implements DebugConnectionListener { moduleToTraitIndex.clear(); moduleToMethodIndex.clear(); moduleToSwfIndex.clear(); + + placedObjects.clear(); con.addMessageListener(new DebugMessageListener() { @Override @@ -835,6 +842,14 @@ public class DebuggerHandler implements DebugConnectionListener { con.dropMessage(t); } }); + + con.addMessageListener(new DebugMessageListener() { + @Override + public void message(InPlaceObject t) { + placedObjects.put(t.path, t.objId); + con.dropMessage(t); + } + }); InSetBreakpoint isb = con.getMessage(InSetBreakpoint.class); synchronized (this) { @@ -1156,4 +1171,8 @@ public class DebuggerHandler implements DebugConnectionListener { } return null; } + + public Map getPlacedObjects() { + return new LinkedHashMap<>(placedObjects); + } } diff --git a/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java b/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java index 6e251212e..19844ba9a 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java @@ -400,6 +400,10 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener 0) { + continue; + } + if (!isTraits(igv.childs.get(i))) { Long parentObjectId = varToObjectId(varInsideGetter); childs.add(new VariableNode(path, level + 1, igv.childs.get(i), parentObjectId, curTrait)); diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties index 2b890173b..754bb8731 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties @@ -636,3 +636,6 @@ config.description.showHeapStatusWidget = Displays used memory widget in the tit config.name.autoDeobfuscateIdentifiers = Deobfuscate identifiers config.description.autoDeobfuscateIdentifiers = Obfuscated names that are not valid identifiers will be printed as _SafeStr_XX, _SafeCls_XX or _SafePkg_XX. + +config.name.showVarsWithDontEnumerateFlag = Debugger - show vars with DontEnumerate flag +config.description.showVarsWithDontEnumerateFlag = While debugging ActionScript, show also variables with special DontEnumerate flag, which are internal to flash. It is recommended to hide them as they are usually not relevant. diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties index ef25ddf5f..20590ae01 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties @@ -636,3 +636,6 @@ config.description.showHeapStatusWidget = Zobraz\u00ed widget s pou\u017eitou pa config.name.autoDeobfuscateIdentifiers = Deobfuskovat idenfitik\u00e1tory config.description.autoDeobfuscateIdentifiers = Obfuskovan\u00e9 n\u00e1zvy kter\u00e9 nejsou platn\u00fdmi identifik\u00e1tory budou zobrazeny ve form\u00e1tu _SafeStr_XX. + +config.name.showVarsWithDontEnumerateFlag = Lad\u011bn\u00ed - zobrazit prom\u011bnn\u00e9 s p\u0159\u00edznakem DontEnumerate +config.description.showVarsWithDontEnumerateFlag = B\u011bhem lad\u011bn\u00ed ActionScriptu zobrazit tak\u00e9 prom\u011bnn\u00e9 se speci\u00e1ln\u00edm p\u0159\u00edznakem DontEnumerate, kter\u00fd je intern\u00ed pro flash. Je doporu\u010deno tyto polo\u017eky skr\u00fdt, jeliko\u017e jsou obvykle nerelevantn\u00ed.