mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-24 19:01:01 +00:00
Debugging in the browser, improved
This commit is contained in:
@@ -197,16 +197,16 @@ public class BreakpointListDialog extends AppDialog {
|
||||
defaultTableModel.addColumn(translate("breakpoint.line"));
|
||||
defaultTableModel.addColumn(translate("breakpoint.status"));
|
||||
|
||||
Map<String, Set<Integer>> breakpoints = Main.getDebugHandler().getAllBreakPoints(swf, false);
|
||||
Map<String, Set<Integer>> breakpoints = Main.getDebugHandler().getAllSessionsBreakPoints(swf);
|
||||
|
||||
List<Breakpoint> newBreakpointList = new ArrayList<>();
|
||||
for (String scriptName : breakpoints.keySet()) {
|
||||
for (int line : breakpoints.get(scriptName)) {
|
||||
newBreakpointList.add(new Breakpoint(scriptName, line));
|
||||
String status = "unknown";
|
||||
if (Main.getDebugHandler().isBreakpointInvalid(swf, scriptName, line)) {
|
||||
if (Main.getCurrentDebugSession().isBreakpointInvalid(swf, scriptName, line)) {
|
||||
status = "invalid";
|
||||
} else if (Main.getDebugHandler().isBreakpointConfirmed(swf, scriptName, line)) {
|
||||
} else if (Main.getCurrentDebugSession().isBreakpointConfirmed(swf, scriptName, line)) {
|
||||
status = "confirmed";
|
||||
}
|
||||
defaultTableModel.addRow(new Object[]{scriptName, line, translate("breakpoint.status." + status)});
|
||||
|
||||
@@ -36,6 +36,7 @@ import java.awt.event.MouseEvent;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -90,6 +91,8 @@ public class DebugPanel extends JPanel {
|
||||
|
||||
public ABCPanel.VariablesTableModel localsTable;
|
||||
|
||||
private WeakReference<DebuggerSession> currentSessionRef = null;
|
||||
|
||||
public static enum SelectedTab {
|
||||
|
||||
LOG, STACK, SCOPECHAIN, LOCALS, REGISTERS, CALLSTACK, CONSTANTPOOL
|
||||
@@ -140,7 +143,7 @@ public class DebugPanel extends JPanel {
|
||||
|
||||
}
|
||||
|
||||
private void logAdd(String message) {
|
||||
private void logAdd(DebuggerSession session, String message) {
|
||||
boolean wasEmpty = logLength == 0;
|
||||
String add = message + "\r\n";
|
||||
logLength += add.length();
|
||||
@@ -151,7 +154,7 @@ public class DebugPanel extends JPanel {
|
||||
//ignore
|
||||
}
|
||||
if (wasEmpty) {
|
||||
refresh();
|
||||
refresh(session);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,6 +180,15 @@ public class DebugPanel extends JPanel {
|
||||
}
|
||||
|
||||
private void dopop(MouseEvent e) {
|
||||
|
||||
if (currentSessionRef == null) {
|
||||
return;
|
||||
}
|
||||
DebuggerSession session = currentSessionRef.get();
|
||||
if (session == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (debugLocalsTable.getSelectedRow() == -1) {
|
||||
return;
|
||||
}
|
||||
@@ -241,8 +253,8 @@ public class DebugPanel extends JPanel {
|
||||
}*/
|
||||
//Variant using comma separated bytes, pretty fast
|
||||
try {
|
||||
Variable debugConnectionClass = Main.getDebugHandler().getVariable(0, Main.currentDebuggerPackage + "::DebugConnection", false, false).parent;
|
||||
String dataStr = (String) Main.getDebugHandler().callMethod(debugConnectionClass, "readCommaSeparatedFromByteArray", Arrays.asList(v)).variables.get(0).value;
|
||||
Variable debugConnectionClass = session.getVariable(0, Main.currentDebuggerPackage + "::DebugConnection", false, false).parent;
|
||||
String dataStr = (String) session.callMethod(debugConnectionClass, "readCommaSeparatedFromByteArray", Arrays.asList(v)).variables.get(0).value;
|
||||
String[] parts = dataStr.split(",");
|
||||
byte[] data = new byte[parts.length];
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
@@ -313,9 +325,9 @@ public class DebugPanel extends JPanel {
|
||||
splitter = ",";
|
||||
}
|
||||
String dataStr = sb.toString();
|
||||
Variable debugConnectionClass = Main.getDebugHandler().getVariable(0, Main.currentDebuggerPackage + "::DebugConnection", false, false).parent;
|
||||
Variable debugConnectionClass = session.getVariable(0, Main.currentDebuggerPackage + "::DebugConnection", false, false).parent;
|
||||
try {
|
||||
Main.getDebugHandler().callMethod(debugConnectionClass, "writeCommaSeparatedToByteArray", Arrays.asList(dataStr, v));
|
||||
session.callMethod(debugConnectionClass, "writeCommaSeparatedToByteArray", Arrays.asList(dataStr, v));
|
||||
} catch (DebuggerHandler.ActionScriptException ex) {
|
||||
Logger.getLogger(DebugPanel.class.getName()).log(Level.SEVERE, "Error exporting ByteArray", ex);
|
||||
}
|
||||
@@ -334,19 +346,19 @@ public class DebugPanel extends JPanel {
|
||||
JMenu addWatchMenu = new JMenu(AppStrings.translate("debug.watch.add").replace("%name%", v.name));
|
||||
JMenuItem watchReadMenuItem = new JMenuItem(AppStrings.translate("debug.watch.add.read"));
|
||||
watchReadMenuItem.addActionListener((ActionEvent e1) -> {
|
||||
if (!Main.addWatch(v, watchParentId, true, false)) {
|
||||
if (!Main.addWatch(session, v, watchParentId, true, false)) {
|
||||
ViewMessages.showMessageDialog(DebugPanel.this, AppStrings.translate("error.debug.watch.add"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
});
|
||||
JMenuItem watchWriteMenuItem = new JMenuItem(AppStrings.translate("debug.watch.add.write"));
|
||||
watchWriteMenuItem.addActionListener((ActionEvent e1) -> {
|
||||
if (!Main.addWatch(v, watchParentId, false, true)) {
|
||||
if (!Main.addWatch(session, v, watchParentId, false, true)) {
|
||||
ViewMessages.showMessageDialog(DebugPanel.this, AppStrings.translate("error.debug.watch.add"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
});
|
||||
JMenuItem watchReadWriteMenuItem = new JMenuItem(AppStrings.translate("debug.watch.add.readwrite"));
|
||||
watchReadWriteMenuItem.addActionListener((ActionEvent e1) -> {
|
||||
if (!Main.addWatch(v, watchParentId, true, true)) {
|
||||
if (!Main.addWatch(session, v, watchParentId, true, true)) {
|
||||
ViewMessages.showMessageDialog(DebugPanel.this, AppStrings.translate("error.debug.watch.add"), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
});
|
||||
@@ -376,41 +388,41 @@ public class DebugPanel extends JPanel {
|
||||
Main.getDebugHandler().addTraceListener(new DebuggerHandler.TraceListener() {
|
||||
|
||||
@Override
|
||||
public void trace(String... val) {
|
||||
public void trace(DebuggerSession session, String... val) {
|
||||
for (String s : val) {
|
||||
logAdd("trace: " + s);
|
||||
logAdd(session, "trace: " + s);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Main.getDebugHandler().addErrorListener(new DebuggerHandler.ErrorListener() {
|
||||
@Override
|
||||
public void errorException(String message, Variable thrownVar) {
|
||||
logAdd("unhandled exception: " + message);
|
||||
public void errorException(DebuggerSession session, String message, Variable thrownVar) {
|
||||
logAdd(session, "unhandled exception: " + message);
|
||||
selectedTab = tabTypes.get(tabTypes.size() - 1);
|
||||
refresh();
|
||||
refresh(session);
|
||||
}
|
||||
});
|
||||
|
||||
Main.getDebugHandler().addConnectionListener(new DebuggerHandler.ConnectionListener() {
|
||||
|
||||
@Override
|
||||
public void connected() {
|
||||
public void connected(DebuggerSession session) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnected() {
|
||||
refresh();
|
||||
public void disconnected(DebuggerSession session) {
|
||||
refresh(session);
|
||||
}
|
||||
});
|
||||
|
||||
Main.getDebugHandler().addFrameChangeListener(frameChangeListener = new DebuggerHandler.FrameChangeListener() {
|
||||
@Override
|
||||
public void frameChanged() {
|
||||
public void frameChanged(DebuggerSession session) {
|
||||
View.execInEventDispatchLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
refresh();
|
||||
refresh(session);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -419,17 +431,17 @@ public class DebugPanel extends JPanel {
|
||||
Main.getDebugHandler().addBreakListener(breakListener = new DebuggerHandler.BreakListener() {
|
||||
|
||||
@Override
|
||||
public void doContinue() {
|
||||
public void doContinue(DebuggerSession session) {
|
||||
View.execInEventDispatch(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
refresh();
|
||||
refresh(session);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakAt(String scriptName, int line, int classIndex, int traitIndex, int methodIndex) {
|
||||
public void breakAt(DebuggerSession session, String scriptName, int line, int classIndex, int traitIndex, int methodIndex) {
|
||||
|
||||
}
|
||||
});
|
||||
@@ -484,8 +496,9 @@ public class DebugPanel extends JPanel {
|
||||
}
|
||||
return v.getMembers(this);
|
||||
}*/
|
||||
public void refresh() {
|
||||
public void refresh(DebuggerSession session) {
|
||||
|
||||
currentSessionRef = session == null ? null : new WeakReference<>(session);
|
||||
View.execInEventDispatch(new Runnable() {
|
||||
|
||||
@Override
|
||||
@@ -495,19 +508,14 @@ public class DebugPanel extends JPanel {
|
||||
|
||||
SelectedTab oldSel = selectedTab;
|
||||
localsTable = null;
|
||||
SWF swf = Main.getDebuggedSWF();
|
||||
if (swf == null) {
|
||||
return;
|
||||
}
|
||||
boolean as3 = swf.isAS3();
|
||||
InFrame f = Main.getDebugHandler().getFrame();
|
||||
InFrame f = session == null ? null : session.getFrame();
|
||||
if (f != null) {
|
||||
|
||||
|
||||
List<Variable> locals = new ArrayList<>();
|
||||
|
||||
|
||||
Map<String, Long> placedObjects = Main.getDebugHandler().getPlacedObjects();
|
||||
Map<String, Long> placedObjects = session.getPlacedObjects();
|
||||
for (String poName : placedObjects.keySet()) {
|
||||
String realName = poName;
|
||||
if ("/".equals(realName)) {
|
||||
@@ -515,7 +523,7 @@ public class DebugPanel extends JPanel {
|
||||
} else if (realName.startsWith("/")) {
|
||||
continue;
|
||||
}
|
||||
Variable placedVar = Main.getDebugHandler().getVariable(0, realName, false, false).parent;
|
||||
Variable placedVar = session.getVariable(0, realName, false, false).parent;
|
||||
if (placedVar != null) {
|
||||
locals.add(placedVar);
|
||||
}
|
||||
@@ -540,26 +548,26 @@ public class DebugPanel extends JPanel {
|
||||
TreeModelListener refreshListener = new TreeModelListener() {
|
||||
@Override
|
||||
public void treeNodesChanged(TreeModelEvent e) {
|
||||
Main.getDebugHandler().refreshFrame();
|
||||
refresh();
|
||||
session.refreshFrame();
|
||||
refresh(session);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void treeNodesInserted(TreeModelEvent e) {
|
||||
Main.getDebugHandler().refreshFrame();
|
||||
refresh();
|
||||
session.refreshFrame();
|
||||
refresh(session);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void treeNodesRemoved(TreeModelEvent e) {
|
||||
Main.getDebugHandler().refreshFrame();
|
||||
refresh();
|
||||
session.refreshFrame();
|
||||
refresh(session);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void treeStructureChanged(TreeModelEvent e) {
|
||||
Main.getDebugHandler().refreshFrame();
|
||||
refresh();
|
||||
session.refreshFrame();
|
||||
refresh(session);
|
||||
}
|
||||
};
|
||||
debugLocalsTable.getTreeTableModel().addTreeModelListener(refreshListener);
|
||||
@@ -569,7 +577,7 @@ public class DebugPanel extends JPanel {
|
||||
debugLocalsTable.setTreeModel(new ABCPanel.VariablesTableModel(debugLocalsTable, new ArrayList<>()));
|
||||
debugScopeTable.setTreeModel(new ABCPanel.VariablesTableModel(debugScopeTable, new ArrayList<>()));
|
||||
}
|
||||
InConstantPool cpool = Main.getDebugHandler().getConstantPool();
|
||||
InConstantPool cpool = session == null ? null : session.getConstantPool();
|
||||
if (cpool != null) {
|
||||
Object[][] data2 = new Object[cpool.vars.size()][2];
|
||||
for (int i = 0; i < cpool.vars.size(); i++) {
|
||||
@@ -635,7 +643,7 @@ public class DebugPanel extends JPanel {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
traceLogTextarea.setText("");
|
||||
logLength = 0;
|
||||
refresh();
|
||||
refresh(session);
|
||||
}
|
||||
});
|
||||
JPanel butPanel = new JPanel(new FlowLayout());
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.lang.ref.WeakReference;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTable;
|
||||
@@ -46,35 +47,40 @@ public class DebugStackPanel extends JPanel {
|
||||
private int[] classIndices = new int[0];
|
||||
private int[] methodIndices = new int[0];
|
||||
private int[] traitIndices = new int[0];
|
||||
private WeakReference<DebuggerSession> currentSessionRef = null;
|
||||
|
||||
public DebugStackPanel() {
|
||||
stackTable = new JTable();
|
||||
Main.getDebugHandler().addFrameChangeListener(new DebuggerHandler.FrameChangeListener() {
|
||||
@Override
|
||||
public void frameChanged() {
|
||||
depth = Main.getDebugHandler().getDepth();
|
||||
refresh();
|
||||
public void frameChanged(DebuggerSession session) {
|
||||
if (session == null) {
|
||||
refresh(null);
|
||||
return;
|
||||
}
|
||||
depth = session.getDepth();
|
||||
refresh(session);
|
||||
}
|
||||
});
|
||||
Main.getDebugHandler().addBreakListener(new DebuggerHandler.BreakListener() {
|
||||
@Override
|
||||
public void breakAt(String scriptName, int line, int classIndex, int traitIndex, int methodIndex) {
|
||||
public void breakAt(DebuggerSession session, String scriptName, int line, int classIndex, int traitIndex, int methodIndex) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doContinue() {
|
||||
public void doContinue(DebuggerSession session) {
|
||||
clear();
|
||||
}
|
||||
});
|
||||
|
||||
Main.getDebugHandler().addConnectionListener(new DebuggerHandler.ConnectionListener() {
|
||||
@Override
|
||||
public void connected() {
|
||||
public void connected(DebuggerSession session) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnected() {
|
||||
public void disconnected(DebuggerSession session) {
|
||||
clear();
|
||||
}
|
||||
});
|
||||
@@ -96,7 +102,13 @@ public class DebugStackPanel extends JPanel {
|
||||
SWF swf = swfHash == null ? Main.getRunningSWF() : Main.getSwfByHash(swfHash);
|
||||
Main.getMainFrame().getPanel().gotoScriptLine(swf,
|
||||
scriptName, line, classIndices[row], traitIndices[row], methodIndices[row], Main.isDebugPCode());
|
||||
Main.getDebugHandler().setDepth(row);
|
||||
DebuggerSession session = null;
|
||||
if (currentSessionRef != null) {
|
||||
session = currentSessionRef.get();
|
||||
}
|
||||
if (session != null) {
|
||||
session.setDepth(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,8 +124,12 @@ public class DebugStackPanel extends JPanel {
|
||||
return active;
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
InBreakAtExt info = Main.getDebugHandler().getBreakInfo();
|
||||
public void refresh(DebuggerSession session) {
|
||||
if (session == null) {
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
InBreakAtExt info = session.getBreakInfo();
|
||||
if (info == null) {
|
||||
clear();
|
||||
return;
|
||||
@@ -126,7 +142,7 @@ public class DebugStackPanel extends JPanel {
|
||||
int[] newTraitIndices = new int[info.files.size()];
|
||||
for (int i = 0; i < info.files.size(); i++) {
|
||||
int f = info.files.get(i);
|
||||
String moduleName = Main.getDebugHandler().moduleToString(f);
|
||||
String moduleName = session.moduleToString(f);
|
||||
String swfHash = null;
|
||||
if (moduleName.contains(":")) {
|
||||
swfHash = moduleName.substring(0, moduleName.indexOf(":"));
|
||||
@@ -137,11 +153,11 @@ public class DebugStackPanel extends JPanel {
|
||||
data[i][1] = moduleName;
|
||||
data[i][2] = info.lines.get(i);
|
||||
data[i][3] = info.stacks.get(i);
|
||||
Integer newClassIndex = Main.getDebugHandler().moduleToClassIndex(f);
|
||||
Integer newClassIndex = session.moduleToClassIndex(f);
|
||||
newClassIndices[i] = newClassIndex == null ? -1 : newClassIndex;
|
||||
Integer newMethodIndex = Main.getDebugHandler().moduleToMethodIndex(f);
|
||||
Integer newMethodIndex = session.moduleToMethodIndex(f);
|
||||
newMethodIndices[i] = newMethodIndex == null ? -1 : newMethodIndex;
|
||||
Integer newTraitIndex = Main.getDebugHandler().moduleToTraitIndex(f);
|
||||
Integer newTraitIndex = session.moduleToTraitIndex(f);
|
||||
;
|
||||
newTraitIndices[i] = newTraitIndex == null ? -1 : newTraitIndex;
|
||||
}
|
||||
@@ -184,6 +200,7 @@ public class DebugStackPanel extends JPanel {
|
||||
repaint();
|
||||
}
|
||||
});
|
||||
currentSessionRef = new WeakReference<>(session);
|
||||
}
|
||||
|
||||
public int getDepth() {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -105,6 +105,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Proxy;
|
||||
@@ -246,34 +247,45 @@ public class Main {
|
||||
return debuggedSWF;
|
||||
}
|
||||
|
||||
public static void setDebuggedSWF(SWF swf) {
|
||||
debuggedSWF = swf;
|
||||
}
|
||||
|
||||
public static void findDebuggedSwf(String hashSha256) {
|
||||
|
||||
System.err.println("Searching for hash " + hashSha256 + "...");
|
||||
/**
|
||||
* Searches opened swfs for swf with sha256 hash of its decompressed form
|
||||
*
|
||||
* @param hashSha256 Hex sha 256
|
||||
* @return SWF or null if not found
|
||||
*/
|
||||
public static SWF findOpenedSwfByHash(String hashSha256) {
|
||||
Logger.getLogger(Main.class.getName()).log(Level.FINE, "Searching for hash {0}...", hashSha256);
|
||||
|
||||
for (SWF swf : mainFrame.getPanel().getAllSwfs()) {
|
||||
System.err.println("Checking " + swf +" with hash " + swf.getHashSha256());
|
||||
Logger.getLogger(Main.class.getName()).log(Level.FINE, "Checking {0} with hash {1}", new Object[]{swf.toString(), swf.getHashSha256()});
|
||||
if (Objects.equals(hashSha256, swf.getHashSha256())) {
|
||||
Main.debuggedSWF = swf;
|
||||
System.err.println("RECEIVED SWF FOUND");
|
||||
return;
|
||||
Logger.getLogger(Main.class.getName()).log(Level.FINE, "RECEIVED SWF FOUND");
|
||||
return swf;
|
||||
}
|
||||
}
|
||||
|
||||
if (preparedHashSha256 != null && hashSha256.equals(preparedHashSha256)) {
|
||||
System.err.println("RECEIVED SWF IS ONE THAT WAS PREPARED FOR RUN...");
|
||||
Main.debuggedSWF = runningSWF;
|
||||
return;
|
||||
Logger.getLogger(Main.class.getName()).log(Level.FINE, "RECEIVED SWF IS ONE THAT WAS PREPARED FOR RUN...");
|
||||
return runningSWF;
|
||||
}
|
||||
|
||||
System.err.println("RECEIVED SWF IS NOT ANY OF OURS");
|
||||
Main.debuggedSWF = null;
|
||||
Logger.getLogger(Main.class.getName()).log(Level.FINE, "RECEIVED SWF IS NOT ANY OF OURS");
|
||||
return null;
|
||||
}
|
||||
|
||||
public static SWF getRunningSWF() {
|
||||
//System.err.println("debuggedSWF: " + (debuggedSWF == null ? "NOT SET" : debuggedSWF));
|
||||
//return runningSWF;
|
||||
return debuggedSWF;
|
||||
//return debuggedSWF;
|
||||
DebuggerSession session = getCurrentDebugSession();
|
||||
if (session != null) {
|
||||
return session.getDebuggedSwfs().get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static WatchService getWatcher() {
|
||||
@@ -331,12 +343,16 @@ public class Main {
|
||||
mainFrame.getPanel().clearDebuggerColors();
|
||||
}
|
||||
if (runProcessDebug) {
|
||||
Main.getDebugHandler().disconnect();
|
||||
Main.getDebugHandler().terminateAllSessions();
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized boolean isDebugPaused() {
|
||||
return (runProcess != null && runProcessDebug || !flashDebugger.isStopped()) && getDebugHandler().isPaused();
|
||||
DebuggerSession session = getCurrentDebugSession();
|
||||
if (session == null) {
|
||||
return false;
|
||||
}
|
||||
return (runProcess != null && runProcessDebug || !flashDebugger.isStopped()) && session.isPaused();
|
||||
}
|
||||
|
||||
public static synchronized boolean isDebugRunning() {
|
||||
@@ -348,60 +364,60 @@ public class Main {
|
||||
}
|
||||
|
||||
public static synchronized boolean isDebugConnected() {
|
||||
return getDebugHandler().isConnected();
|
||||
return getDebugHandler().isAnySessionConnected();
|
||||
}
|
||||
|
||||
public static synchronized boolean isRunning() {
|
||||
return runProcess != null && !runProcessDebug;
|
||||
}
|
||||
|
||||
public static synchronized void debugExportByteArray(Variable v, OutputStream os) throws IOException {
|
||||
public static synchronized void debugExportByteArray(DebuggerSession session, Variable v, OutputStream os) throws IOException {
|
||||
try {
|
||||
long objectId = 0L;
|
||||
if ((v.vType == VariableType.OBJECT || v.vType == VariableType.MOVIECLIP)) {
|
||||
objectId = (Long) v.value;
|
||||
}
|
||||
Object oldPos = getDebugHandler().getVariable(objectId, "position", false, true).parent.value;
|
||||
getDebugHandler().setVariable(objectId, "position", VariableType.NUMBER, 0);
|
||||
int length = (int) (double) (Double) getDebugHandler().getVariable(objectId, "length", false, true).parent.value;
|
||||
Object oldPos = session.getVariable(objectId, "position", false, true).parent.value;
|
||||
session.setVariable(objectId, "position", VariableType.NUMBER, 0);
|
||||
int length = (int) (double) (Double) session.getVariable(objectId, "length", false, true).parent.value;
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
int b = (int) (double) (Double) getDebugHandler().callFunction(false, "readByte", v, new ArrayList<>()).variables.get(0).value;
|
||||
int b = (int) (double) (Double) session.callFunction(false, "readByte", v, new ArrayList<>()).variables.get(0).value;
|
||||
os.write(b);
|
||||
}
|
||||
getDebugHandler().setVariable(objectId, "position", VariableType.NUMBER, oldPos);
|
||||
session.setVariable(objectId, "position", VariableType.NUMBER, oldPos);
|
||||
} catch (DebuggerHandler.ActionScriptException ex) {
|
||||
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized void debugImportByteArray(Variable v, InputStream is) throws IOException {
|
||||
public static synchronized void debugImportByteArray(DebuggerSession session, Variable v, InputStream is) throws IOException {
|
||||
try {
|
||||
long objectId = 0L;
|
||||
if ((v.vType == VariableType.OBJECT || v.vType == VariableType.MOVIECLIP)) {
|
||||
objectId = (Long) v.value;
|
||||
}
|
||||
Double oldPos = (Double) getDebugHandler().getVariable(objectId, "position", false, true).parent.value;
|
||||
getDebugHandler().setVariable(objectId, "length", VariableType.NUMBER, 0);
|
||||
getDebugHandler().setVariable(objectId, "position", VariableType.NUMBER, 0);
|
||||
Double oldPos = (Double) session.getVariable(objectId, "position", false, true).parent.value;
|
||||
session.setVariable(objectId, "length", VariableType.NUMBER, 0);
|
||||
session.setVariable(objectId, "position", VariableType.NUMBER, 0);
|
||||
|
||||
int length = 0;
|
||||
int b;
|
||||
while ((b = is.read()) > -1) {
|
||||
getDebugHandler().callFunction(false, "writeByte", v, Arrays.asList((Double) (double) b));
|
||||
session.callFunction(false, "writeByte", v, Arrays.asList((Double) (double) b));
|
||||
length++;
|
||||
}
|
||||
if (oldPos > length) {
|
||||
oldPos = (Double) (double) length;
|
||||
}
|
||||
getDebugHandler().setVariable(objectId, "position", VariableType.NUMBER, oldPos);
|
||||
session.setVariable(objectId, "position", VariableType.NUMBER, oldPos);
|
||||
} catch (DebuggerHandler.ActionScriptException ex) {
|
||||
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized boolean addWatch(Variable v, long v_id, boolean watchRead, boolean watchWrite) {
|
||||
DebuggerCommands.Watch w = getDebugHandler().addWatch(v, v_id, watchRead, watchWrite);
|
||||
public static synchronized boolean addWatch(DebuggerSession session, Variable v, long v_id, boolean watchRead, boolean watchWrite) {
|
||||
DebuggerCommands.Watch w = session.addWatch(v, v_id, watchRead, watchWrite);
|
||||
return w != null;
|
||||
}
|
||||
|
||||
@@ -591,9 +607,9 @@ public class Main {
|
||||
});
|
||||
startWork(AppStrings.translate("work.generating_swd"), swfPrepareWorker, true);
|
||||
if (doPCode) {
|
||||
instrSWF.generatePCodeSwdFile(swdFile, getPackBreakPoints(true, swfHash), swfHash);
|
||||
instrSWF.generatePCodeSwdFile(swdFile, getAllSessionPackBreakPoints(swfHash), swfHash);
|
||||
} else {
|
||||
instrSWF.generateSwdFile(swdFile, getPackBreakPoints(true, swfHash), swfHash);
|
||||
instrSWF.generateSwdFile(swdFile, getAllSessionPackBreakPoints(swfHash), swfHash);
|
||||
}
|
||||
tempFiles.add(swdFile);
|
||||
}
|
||||
@@ -861,7 +877,7 @@ public class Main {
|
||||
if (swf == null) {
|
||||
return;
|
||||
}
|
||||
debugHandler.setMainDebuggedSwf(swf);
|
||||
//debugHandler.setMainDebuggedSwf(swf); ???
|
||||
File tempRunDir = swf.getFile() == null ? null : new File(swf.getFile()).getParentFile();
|
||||
File tempFile = null;
|
||||
|
||||
@@ -930,61 +946,121 @@ public class Main {
|
||||
}
|
||||
|
||||
public static synchronized int getIp(Object pack) {
|
||||
return getDebugHandler().getBreakIp();
|
||||
DebuggerSession session = getCurrentDebugSession();
|
||||
if (session == null) {
|
||||
return -1;
|
||||
}
|
||||
return session.getBreakIp();
|
||||
}
|
||||
|
||||
public static synchronized String getIpClass() {
|
||||
return getDebugHandler().getBreakScriptName();
|
||||
DebuggerSession session = getCurrentDebugSession();
|
||||
if (session == null) {
|
||||
return null;
|
||||
}
|
||||
return session.getBreakScriptName();
|
||||
}
|
||||
|
||||
public static synchronized List<Integer> getStackLines() {
|
||||
return getDebugHandler().getStackLines();
|
||||
DebuggerSession session = getCurrentDebugSession();
|
||||
if (session == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return session.getStackLines();
|
||||
}
|
||||
|
||||
public static synchronized List<String> getStackClasses() {
|
||||
return getDebugHandler().getStackScripts();
|
||||
DebuggerSession session = getCurrentDebugSession();
|
||||
if (session == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return session.getStackScripts();
|
||||
}
|
||||
|
||||
public static synchronized boolean isBreakPointValid(String scriptName, int line) {
|
||||
DebuggerSession session = getCurrentDebugSession();
|
||||
if (session == null) {
|
||||
return true;
|
||||
}
|
||||
SWF swf = getMainFrame().getPanel().getCurrentSwf();
|
||||
return !getDebugHandler().isBreakpointInvalid(swf, scriptName, line);
|
||||
return !session.isBreakpointInvalid(swf, scriptName, line);
|
||||
}
|
||||
|
||||
public static synchronized void addBreakPoint(String scriptName, int line) {
|
||||
public static synchronized void addBreakPoint(DebuggerSession session, String scriptName, int line) {
|
||||
SWF swf = getMainFrame().getPanel().getCurrentSwf();
|
||||
getDebugHandler().addBreakPoint(swf, scriptName, line);
|
||||
session.addBreakPoint(swf, scriptName, line);
|
||||
}
|
||||
|
||||
public static synchronized void removeBreakPoint(String scriptName, int line) {
|
||||
public static synchronized void removeBreakPoint(DebuggerSession session, String scriptName, int line) {
|
||||
SWF swf = getMainFrame().getPanel().getCurrentSwf();
|
||||
getDebugHandler().removeBreakPoint(swf, scriptName, line);
|
||||
session.removeBreakPoint(swf, scriptName, line);
|
||||
}
|
||||
|
||||
public static synchronized boolean toggleBreakPoint(String scriptName, int line) {
|
||||
SWF swf = getMainFrame().getPanel().getCurrentSwf();
|
||||
if (getDebugHandler().isBreakpointToAdd(swf, scriptName, line) || getDebugHandler().isBreakpointConfirmed(swf, scriptName, line) || getDebugHandler().isBreakpointInvalid(swf, scriptName, line)) {
|
||||
Map<String, Set<Integer>> breakPoints = getDebugHandler().getAllSessionsBreakPoints(swf);
|
||||
|
||||
if (breakPoints.containsKey(scriptName) && breakPoints.get(scriptName).contains(line)) {
|
||||
getDebugHandler().removeBreakPoint(swf, scriptName, line);
|
||||
return false;
|
||||
} else {
|
||||
}
|
||||
|
||||
getDebugHandler().addBreakPoint(swf, scriptName, line);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*if (session.isBreakpointToAdd(swf, scriptName, line) || session.isBreakpointConfirmed(swf, scriptName, line) || session.isBreakpointInvalid(swf, scriptName, line)) {
|
||||
session.removeBreakPoint(swf, scriptName, line);
|
||||
return false;
|
||||
} else {
|
||||
session.addBreakPoint(swf, scriptName, line);
|
||||
return true;
|
||||
}*/
|
||||
}
|
||||
|
||||
public static synchronized Map<String, Set<Integer>> getPackBreakPoints(boolean validOnly, String swfHash) {
|
||||
public static synchronized Map<String, Set<Integer>> getAllSessionPackBreakPoints(String swfHash) {
|
||||
SWF swf = Main.getSwfByHash(swfHash);
|
||||
return getDebugHandler().getAllBreakPoints(swf, validOnly);
|
||||
return getDebugHandler().getAllSessionsBreakPoints(swf);
|
||||
}
|
||||
|
||||
public static synchronized Set<Integer> getScriptBreakPoints(String pack, boolean onlyValid) {
|
||||
public static synchronized Map<String, Set<Integer>> getPackBreakPoints(DebuggerSession session, boolean validOnly, String swfHash) {
|
||||
SWF swf = Main.getSwfByHash(swfHash);
|
||||
return session.getAllBreakPoints(swf, validOnly);
|
||||
}
|
||||
|
||||
public static synchronized Set<Integer> getScriptBreakPoints(String pack) {
|
||||
SWF swf = getMainFrame().getPanel().getCurrentSwf();
|
||||
return getDebugHandler().getBreakPoints(swf, pack, onlyValid);
|
||||
return getDebugHandler().getAllSessionsScriptBreakPoints(swf, pack);
|
||||
}
|
||||
|
||||
public static DebuggerHandler getDebugHandler() {
|
||||
return debugHandler;
|
||||
}
|
||||
|
||||
public static DebuggerSession getCurrentDebugSession() {
|
||||
if (mainFrame == null) {
|
||||
return null;
|
||||
}
|
||||
if (mainFrame.getPanel() == null) {
|
||||
return null;
|
||||
}
|
||||
SWF currentSwf = mainFrame.getPanel().getCurrentSwf();
|
||||
if (currentSwf == null) {
|
||||
return null;
|
||||
}
|
||||
return getDebugHandler().getSessionContainingSwf(currentSwf);
|
||||
}
|
||||
|
||||
public static void updateSession() {
|
||||
DebuggerSession session = getCurrentDebugSession();
|
||||
for (DebuggerHandler.FrameChangeListener l : getDebugHandler().getFrameChangeListeners()) {
|
||||
l.frameChanged(session);
|
||||
}
|
||||
|
||||
if (getDebugHandler().getNumberOfPausedSessions() > 0) {
|
||||
mainFrame.getPanel().showDebugStackFrame();
|
||||
}
|
||||
}
|
||||
|
||||
public static void ensureMainFrame() {
|
||||
if (mainFrame == null) {
|
||||
synchronized (Main.class) {
|
||||
@@ -1027,8 +1103,8 @@ public class Main {
|
||||
loadFromMemoryFrame.setVisible(true);
|
||||
}
|
||||
|
||||
public static void setVariable(long parentId, String varName, int valueType, Object value) {
|
||||
getDebugHandler().setVariable(parentId, varName, valueType, value);
|
||||
public static void setVariable(DebuggerSession session, long parentId, String varName, int valueType, Object value) {
|
||||
session.setVariable(parentId, varName, valueType, value);
|
||||
}
|
||||
|
||||
public static void setSubLimiter(boolean value) {
|
||||
@@ -1100,7 +1176,7 @@ public class Main {
|
||||
public static void startWork(final String name, final int percent, final CancellableWorker worker, boolean force) {
|
||||
working = true;
|
||||
long nowTime = System.currentTimeMillis();
|
||||
if (mainFrame != null && nowTime < lastTimeStartWork + 1000) {
|
||||
if (!force && mainFrame != null && nowTime < lastTimeStartWork + 1000) {
|
||||
mainFrame.getPanel().setWorkStatusHidden(name, worker);
|
||||
return;
|
||||
}
|
||||
@@ -1891,6 +1967,14 @@ public class Main {
|
||||
}
|
||||
}
|
||||
}
|
||||
List<String> breakpointsList = conf.getCustomDataAsList(CustomConfigurationKeys.KEY_BREAKPOINTS);
|
||||
for (String breakpoint : breakpointsList) {
|
||||
if (breakpoint.matches("^.*:[0-9]+$")) {
|
||||
int line = Integer.parseInt(breakpoint.substring(breakpoint.lastIndexOf(":") + 1));
|
||||
String scriptName = breakpoint.substring(0, breakpoint.lastIndexOf(":"));
|
||||
getDebugHandler().addBreakPoint(swf, scriptName, line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1926,14 +2010,6 @@ public class Main {
|
||||
if (swfCustomConf != null) {
|
||||
resourcesPathStr = swfCustomConf.getCustomData(CustomConfigurationKeys.KEY_LAST_SELECTED_PATH_RESOURCES, resourcesPathStr);
|
||||
tagListPathStr = swfCustomConf.getCustomData(CustomConfigurationKeys.KEY_LAST_SELECTED_PATH_TAGLIST, null);
|
||||
List<String> breakpointsList = swfCustomConf.getCustomDataAsList(CustomConfigurationKeys.KEY_BREAKPOINTS);
|
||||
for (String breakpoint : breakpointsList) {
|
||||
if (breakpoint.matches("^.*:[0-9]+$")) {
|
||||
int line = Integer.parseInt(breakpoint.substring(breakpoint.lastIndexOf(":") + 1));
|
||||
String scriptName = breakpoint.substring(0, breakpoint.lastIndexOf(":"));
|
||||
getDebugHandler().addBreakPoint(fswf, scriptName, line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (loadSession) {
|
||||
@@ -2976,13 +3052,15 @@ public class Main {
|
||||
flashDebugger = new Debugger();
|
||||
debugHandler = new DebuggerHandler();
|
||||
debugHandler.addBreakListener(new DebuggerHandler.BreakListener() {
|
||||
|
||||
@Override
|
||||
public void doContinue() {
|
||||
public void doContinue(DebuggerSession session) {
|
||||
mainFrame.getPanel().clearDebuggerColors();
|
||||
mainFrame.getMenu().updateComponents();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakAt(String scriptName, int line, final int classIndex, final int traitIndex, final int methodIndex) {
|
||||
public void breakAt(DebuggerSession session, String scriptName, int line, final int classIndex, final int traitIndex, final int methodIndex) {
|
||||
View.execInEventDispatch(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -2992,7 +3070,17 @@ public class Main {
|
||||
hash = scriptName.substring(0, scriptName.indexOf(":"));
|
||||
scriptNameNoHash = scriptName.substring(scriptName.indexOf(":") + 1);
|
||||
}
|
||||
SWF swf = Main.getSwfByHash(hash);
|
||||
SWF swf = "main".equals(hash) ? session.getDebuggedSwfs().get(0) : Main.getSwfByHash(hash);
|
||||
Logger.getLogger(Main.class.getName()).log(Level.FINE, "Break. Current session: {0}, New break session: {1}", new Object[]{Main.getCurrentDebugSession(), session});
|
||||
|
||||
if (
|
||||
Main.getDebugHandler().getNumberOfPausedSessions() > 1
|
||||
&& Main.getCurrentDebugSession() != session
|
||||
) {
|
||||
Logger.getLogger(Main.class.getName()).log(Level.INFO, "Another SWF ({0}) has reached breakpoint meanwhile", swf.toString());
|
||||
mainFrame.getPanel().refreshBreakPoints();
|
||||
return;
|
||||
}
|
||||
mainFrame.getPanel().gotoScriptLine(swf, scriptNameNoHash, line, classIndex, traitIndex, methodIndex, Main.isDebugPCode());
|
||||
}
|
||||
});
|
||||
@@ -3000,12 +3088,12 @@ public class Main {
|
||||
});
|
||||
debugHandler.addConnectionListener(new DebuggerHandler.ConnectionListener() {
|
||||
@Override
|
||||
public void connected() {
|
||||
public void connected(DebuggerSession session) {
|
||||
Main.mainFrame.getMenu().updateComponents();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnected() {
|
||||
public void disconnected(DebuggerSession session) {
|
||||
if (Main.mainFrame != null) {
|
||||
Main.mainFrame.getMenu().updateComponents();
|
||||
}
|
||||
@@ -3032,6 +3120,7 @@ public class Main {
|
||||
}
|
||||
|
||||
public static void stopDebugger() {
|
||||
getDebugHandler().terminateAllSessions();
|
||||
flashDebugger.stopDebugger();
|
||||
}
|
||||
|
||||
|
||||
@@ -1756,11 +1756,11 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
|
||||
public boolean pauseActionPerformed(ActionEvent evt) {
|
||||
try {
|
||||
DebuggerCommands cmd = Main.getDebugHandler().getCommands();
|
||||
DebuggerCommands cmd = Main.getCurrentDebugSession().getCommands();
|
||||
//TODO
|
||||
|
||||
} catch (IOException ex) {
|
||||
Main.getDebugHandler().disconnect();
|
||||
Main.getCurrentDebugSession().disconnect();
|
||||
//ignore
|
||||
}
|
||||
return true;
|
||||
@@ -1770,13 +1770,13 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
|
||||
try {
|
||||
|
||||
DebuggerCommands cmd = Main.getDebugHandler().getCommands();
|
||||
DebuggerCommands cmd = Main.getCurrentDebugSession().getCommands();
|
||||
mainFrame.getPanel().clearDebuggerColors();
|
||||
Main.startWork(AppStrings.translate("work.debugging") + "...", null);
|
||||
|
||||
cmd.stepOver();
|
||||
} catch (IOException ex) {
|
||||
Main.getDebugHandler().disconnect();
|
||||
Main.getCurrentDebugSession().disconnect();
|
||||
//ignore
|
||||
}
|
||||
return true;
|
||||
@@ -1784,13 +1784,13 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
|
||||
public boolean stepIntoActionPerformed(ActionEvent evt) {
|
||||
try {
|
||||
DebuggerCommands cmd = Main.getDebugHandler().getCommands();
|
||||
DebuggerCommands cmd = Main.getCurrentDebugSession().getCommands();
|
||||
mainFrame.getPanel().clearDebuggerColors();
|
||||
Main.startWork(AppStrings.translate("work.debugging") + "...", null);
|
||||
|
||||
cmd.stepInto();
|
||||
} catch (IOException ex) {
|
||||
Main.getDebugHandler().disconnect();
|
||||
Main.getCurrentDebugSession().disconnect();
|
||||
//ignore
|
||||
}
|
||||
|
||||
@@ -1799,12 +1799,12 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
|
||||
public boolean stepOutActionPerformed(ActionEvent evt) {
|
||||
try {
|
||||
DebuggerCommands cmd = Main.getDebugHandler().getCommands();
|
||||
DebuggerCommands cmd = Main.getCurrentDebugSession().getCommands();
|
||||
mainFrame.getPanel().clearDebuggerColors();
|
||||
Main.startWork(AppStrings.translate("work.debugging") + "...", null);
|
||||
cmd.stepOut();
|
||||
} catch (IOException ex) {
|
||||
Main.getDebugHandler().disconnect();
|
||||
Main.getCurrentDebugSession().disconnect();
|
||||
//ignore
|
||||
}
|
||||
|
||||
@@ -1813,12 +1813,12 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
|
||||
public boolean continueActionPerformed(ActionEvent evt) {
|
||||
try {
|
||||
DebuggerCommands cmd = Main.getDebugHandler().getCommands();
|
||||
DebuggerCommands cmd = Main.getCurrentDebugSession().getCommands();
|
||||
mainFrame.getPanel().clearDebuggerColors();
|
||||
Main.startWork(AppStrings.translate("work.debugging") + "...", null);
|
||||
cmd.sendContinue();
|
||||
} catch (IOException ex) {
|
||||
Main.getDebugHandler().disconnect();
|
||||
Main.getCurrentDebugSession().disconnect();
|
||||
//ignore
|
||||
}
|
||||
|
||||
|
||||
@@ -452,6 +452,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
private static final DataFlavor TREE_FILE_FLAVOR = new DataFlavor(TreeFileFlavor.class, "TreeFile");
|
||||
|
||||
private boolean editingStatusSet = false;
|
||||
|
||||
public synchronized void setLoadingScrollPosEnabled(boolean loadingScrollPosEnabled) {
|
||||
this.loadingScrollPosEnabled = loadingScrollPosEnabled;
|
||||
}
|
||||
@@ -972,11 +974,15 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
|
||||
public void setEditingStatus() {
|
||||
editingStatusSet = true;
|
||||
statusPanel.setStatus(translate(Configuration.autoSaveTagModifications.get() ? "status.editing.autosave" : "status.editing"));
|
||||
}
|
||||
|
||||
public void clearEditingStatus() {
|
||||
if (editingStatusSet) {
|
||||
statusPanel.setStatus("");
|
||||
editingStatusSet = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setWorkStatus(String s, CancellableWorker worker) {
|
||||
@@ -1116,7 +1122,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
debugStackPanel = new DebugStackPanel();
|
||||
Main.getDebugHandler().addBreakListener(new DebuggerHandler.BreakListener() {
|
||||
@Override
|
||||
public void breakAt(String scriptName, int line, int classIndex, int traitIndex, int methodIndex) {
|
||||
public void breakAt(DebuggerSession session, String scriptName, int line, int classIndex, int traitIndex, int methodIndex) {
|
||||
View.execInEventDispatchLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -1126,23 +1132,25 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doContinue() {
|
||||
public void doContinue(DebuggerSession session) {
|
||||
View.execInEventDispatchLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (Main.getDebugHandler().getNumberOfPausedSessions() == 0) {
|
||||
showDetail(DETAILCARDEMPTYPANEL);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
Main.getDebugHandler().addConnectionListener(new DebuggerHandler.ConnectionListener() {
|
||||
@Override
|
||||
public void connected() {
|
||||
public void connected(DebuggerSession session) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnected() {
|
||||
public void disconnected(DebuggerSession session) {
|
||||
View.execInEventDispatchLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -1628,6 +1636,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
|
||||
private void updateUi(final Openable openable) {
|
||||
View.checkAccess();
|
||||
Main.updateSession();
|
||||
SWF swf = null;
|
||||
if (openable instanceof SWF) {
|
||||
swf = (SWF) openable;
|
||||
@@ -5767,6 +5776,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
private void valueChanged(Object source, TreePath selectedPath) {
|
||||
TreeItem treeItem = selectedPath == null ? null : (TreeItem) selectedPath.getLastPathComponent();
|
||||
|
||||
Main.updateSession();
|
||||
if (treeItem == null) {
|
||||
updateUi(null);
|
||||
reload(false);
|
||||
@@ -6360,7 +6370,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
if (openable instanceof SWF) {
|
||||
SwfSpecificCustomConfiguration swfCustomConf = Configuration.getOrCreateSwfSpecificCustomConfiguration(openable.getShortPathTitle());
|
||||
SWF swf = (SWF) openable;
|
||||
Map<String, Set<Integer>> breakpoints = Main.getDebugHandler().getAllBreakPoints(swf, false);
|
||||
Map<String, Set<Integer>> breakpoints = Main.getDebugHandler().getAllSessionsBreakPoints(swf);
|
||||
List<String> breakpointList = new ArrayList<>();
|
||||
for (String scriptName : breakpoints.keySet()) {
|
||||
for (int line : breakpoints.get(scriptName)) {
|
||||
@@ -7053,4 +7063,8 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
public EasyPanel getEasyPanel() {
|
||||
return easyPanel;
|
||||
}
|
||||
|
||||
public void showDebugStackFrame() {
|
||||
showDetail(DETAILCARDDEBUGSTACKFRAME);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ import com.jpexs.decompiler.flash.gui.AppDialog;
|
||||
import com.jpexs.decompiler.flash.gui.AppStrings;
|
||||
import com.jpexs.decompiler.flash.gui.DebugPanel;
|
||||
import com.jpexs.decompiler.flash.gui.DebuggerHandler;
|
||||
import com.jpexs.decompiler.flash.gui.DebuggerSession;
|
||||
import com.jpexs.decompiler.flash.gui.FasterScrollPane;
|
||||
import com.jpexs.decompiler.flash.gui.HeaderLabel;
|
||||
import com.jpexs.decompiler.flash.gui.Main;
|
||||
@@ -388,9 +389,9 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
boolean isAS3 = (Main.getMainFrame().getPanel().getCurrentSwf().isAS3());
|
||||
|
||||
if (parentObjectId == 0 && objectId != 0L && isAS3) {
|
||||
igv = Main.getDebugHandler().getVariable(objectId, "", true, useGetter);
|
||||
igv = Main.getCurrentDebugSession().getVariable(objectId, "", true, useGetter);
|
||||
} else {
|
||||
igv = Main.getDebugHandler().getVariable(parentObjectId, var.name, true, useGetter);
|
||||
igv = Main.getCurrentDebugSession().getVariable(parentObjectId, var.name, true, useGetter);
|
||||
}
|
||||
|
||||
//current var is getter function - set it to value really got
|
||||
@@ -782,7 +783,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
default:
|
||||
return;
|
||||
}
|
||||
Main.getDebugHandler().setVariable(((VariableNode) node).parentObjectId, ((VariableNode) node).var.name, valType, symb.value);
|
||||
Main.getCurrentDebugSession().setVariable(((VariableNode) node).parentObjectId, ((VariableNode) node).var.name, valType, symb.value);
|
||||
//((VariableNode) node).refresh();
|
||||
Object[] path = new Object[((VariableNode) node).path.size()];
|
||||
for (int i = 0; i < path.length; i++) {
|
||||
@@ -1422,14 +1423,16 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
|
||||
|
||||
Main.getDebugHandler().addConnectionListener(new DebuggerHandler.ConnectionListener() {
|
||||
@Override
|
||||
public void connected() {
|
||||
public void connected(DebuggerSession session) {
|
||||
decButtonsPan.setVisible(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnected() {
|
||||
public void disconnected(DebuggerSession session) {
|
||||
if (!Main.getDebugHandler().isAnySessionConnected()) {
|
||||
decButtonsPan.setVisible(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
debugPanel = new DebugPanel();
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.abc.types.traits.Trait;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.gui.AppStrings;
|
||||
import com.jpexs.decompiler.flash.gui.DebuggerHandler;
|
||||
import com.jpexs.decompiler.flash.gui.DebuggerSession;
|
||||
import com.jpexs.decompiler.flash.gui.HeaderLabel;
|
||||
import com.jpexs.decompiler.flash.gui.Main;
|
||||
import com.jpexs.decompiler.flash.gui.MainPanel;
|
||||
@@ -146,7 +147,7 @@ public class DetailPanel extends JPanel implements TagEditorPanel {
|
||||
|
||||
conListener = new DebuggerHandler.ConnectionListener() {
|
||||
@Override
|
||||
public void connected() {
|
||||
public void connected(DebuggerSession session) {
|
||||
synchronized (DetailPanel.this) {
|
||||
debugRunning = true;
|
||||
if (buttonsPanel != null) {
|
||||
@@ -156,7 +157,10 @@ public class DetailPanel extends JPanel implements TagEditorPanel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnected() {
|
||||
public void disconnected(DebuggerSession session) {
|
||||
if (Main.getDebugHandler().isAnySessionConnected()) {
|
||||
return;
|
||||
}
|
||||
synchronized (DetailPanel.this) {
|
||||
debugRunning = false;
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.gui.AppStrings;
|
||||
import com.jpexs.decompiler.flash.gui.DebugPanel;
|
||||
import com.jpexs.decompiler.flash.gui.DebuggerHandler;
|
||||
import com.jpexs.decompiler.flash.gui.DebuggerSession;
|
||||
import com.jpexs.decompiler.flash.gui.DocsPanel;
|
||||
import com.jpexs.decompiler.flash.gui.FasterScrollPane;
|
||||
import com.jpexs.decompiler.flash.gui.GraphDialog;
|
||||
@@ -1065,12 +1066,15 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
|
||||
//decPanel.add(searchPanel, BorderLayout.NORTH);
|
||||
Main.getDebugHandler().addConnectionListener(new DebuggerHandler.ConnectionListener() {
|
||||
@Override
|
||||
public void connected() {
|
||||
public void connected(DebuggerSession session) {
|
||||
decButtonsPan.setVisible(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnected() {
|
||||
public void disconnected(DebuggerSession session) {
|
||||
if (Main.getDebugHandler().isAnySessionConnected()) {
|
||||
return;
|
||||
}
|
||||
decButtonsPan.setVisible(true);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -126,7 +126,7 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP
|
||||
return;
|
||||
}
|
||||
|
||||
Set<Integer> bkptLines = Main.getScriptBreakPoints(breakPointScriptName, false);
|
||||
Set<Integer> bkptLines = Main.getScriptBreakPoints(breakPointScriptName);
|
||||
|
||||
for (int line : bkptLines) {
|
||||
if (Main.isBreakPointValid(breakPointScriptName, line)) {
|
||||
|
||||
Reference in New Issue
Block a user