mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-24 22:50:45 +00:00
Added Debugger shows (logs) unhandled exceptions
This commit is contained in:
@@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Label that flex compiler is used (when it's enabled in settings)
|
- Label that flex compiler is used (when it's enabled in settings)
|
||||||
- [#2119] Option to export assets with names like their assigned classes via SymbolClass, without character id
|
- [#2119] Option to export assets with names like their assigned classes via SymbolClass, without character id
|
||||||
- [#2119] Bulk imported assets can also match filenames based on assigned classname, not just character id prefix
|
- [#2119] Bulk imported assets can also match filenames based on assigned classname, not just character id prefix
|
||||||
|
- Debugger shows (logs) unhandled exceptions
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- [#2021], [#2000] Caret position in editors when using tabs and / or unicode
|
- [#2021], [#2000] Caret position in editors when using tabs and / or unicode
|
||||||
|
|||||||
@@ -139,6 +139,21 @@ public class DebugPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void logAdd(String message) {
|
||||||
|
boolean wasEmpty = logLength == 0;
|
||||||
|
String add = message + "\r\n";
|
||||||
|
logLength += add.length();
|
||||||
|
traceLogTextarea.append(add);
|
||||||
|
try {
|
||||||
|
traceLogTextarea.setCaretPosition(logLength);
|
||||||
|
} catch (IllegalArgumentException iex) {
|
||||||
|
//ignore
|
||||||
|
}
|
||||||
|
if (wasEmpty) {
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public DebugPanel() {
|
public DebugPanel() {
|
||||||
super(new BorderLayout());
|
super(new BorderLayout());
|
||||||
@@ -273,21 +288,19 @@ public class DebugPanel extends JPanel {
|
|||||||
@Override
|
@Override
|
||||||
public void trace(String... val) {
|
public void trace(String... val) {
|
||||||
for (String s : val) {
|
for (String s : val) {
|
||||||
String add = "trace: " + s + "\r\n";
|
logAdd("trace: " + s);
|
||||||
boolean wasEmpty = logLength == 0;
|
|
||||||
logLength += add.length();
|
|
||||||
traceLogTextarea.append(add);
|
|
||||||
try {
|
|
||||||
traceLogTextarea.setCaretPosition(logLength);
|
|
||||||
} catch (IllegalArgumentException iex) {
|
|
||||||
//ignore
|
|
||||||
}
|
|
||||||
if (wasEmpty) {
|
|
||||||
refresh();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Main.getDebugHandler().addErrorListener(new DebuggerHandler.ErrorListener() {
|
||||||
|
@Override
|
||||||
|
public void errorException(String message, Variable thrownVar) {
|
||||||
|
logAdd("unhandled exception: " + message);
|
||||||
|
selectedTab = tabTypes.get(tabTypes.size() - 1);
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Main.getDebugHandler().addConnectionListener(new DebuggerHandler.ConnectionListener() {
|
Main.getDebugHandler().addConnectionListener(new DebuggerHandler.ConnectionListener() {
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import com.jpexs.debugger.flash.messages.in.InBreakReason;
|
|||||||
import com.jpexs.debugger.flash.messages.in.InCallFunction;
|
import com.jpexs.debugger.flash.messages.in.InCallFunction;
|
||||||
import com.jpexs.debugger.flash.messages.in.InConstantPool;
|
import com.jpexs.debugger.flash.messages.in.InConstantPool;
|
||||||
import com.jpexs.debugger.flash.messages.in.InContinue;
|
import com.jpexs.debugger.flash.messages.in.InContinue;
|
||||||
|
import com.jpexs.debugger.flash.messages.in.InErrorException;
|
||||||
import com.jpexs.debugger.flash.messages.in.InFrame;
|
import com.jpexs.debugger.flash.messages.in.InFrame;
|
||||||
import com.jpexs.debugger.flash.messages.in.InGetSwd;
|
import com.jpexs.debugger.flash.messages.in.InGetSwd;
|
||||||
import com.jpexs.debugger.flash.messages.in.InGetSwf;
|
import com.jpexs.debugger.flash.messages.in.InGetSwf;
|
||||||
@@ -359,6 +360,8 @@ public class DebuggerHandler implements DebugConnectionListener {
|
|||||||
|
|
||||||
private final List<TraceListener> traceListeners = new ArrayList<>();
|
private final List<TraceListener> traceListeners = new ArrayList<>();
|
||||||
|
|
||||||
|
private final List<ErrorListener> errorListeners = new ArrayList<>();
|
||||||
|
|
||||||
private final List<FrameChangeListener> frameChangeListeners = new ArrayList<>();
|
private final List<FrameChangeListener> frameChangeListeners = new ArrayList<>();
|
||||||
|
|
||||||
private final List<ConnectionListener> clisteners = new ArrayList<>();
|
private final List<ConnectionListener> clisteners = new ArrayList<>();
|
||||||
@@ -413,6 +416,10 @@ public class DebuggerHandler implements DebugConnectionListener {
|
|||||||
public void trace(String... val);
|
public void trace(String... val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static interface ErrorListener {
|
||||||
|
public void errorException(String message, Variable thrownVar);
|
||||||
|
}
|
||||||
|
|
||||||
public static interface FrameChangeListener {
|
public static interface FrameChangeListener {
|
||||||
|
|
||||||
public void frameChanged();
|
public void frameChanged();
|
||||||
@@ -444,6 +451,14 @@ public class DebuggerHandler implements DebugConnectionListener {
|
|||||||
public void removeTraceListener(TraceListener l) {
|
public void removeTraceListener(TraceListener l) {
|
||||||
traceListeners.remove(l);
|
traceListeners.remove(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addErrorListener(ErrorListener l) {
|
||||||
|
errorListeners.add(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeErrorListener(ErrorListener l) {
|
||||||
|
errorListeners.remove(l);
|
||||||
|
}
|
||||||
|
|
||||||
public void removeBreakListener(BreakListener l) {
|
public void removeBreakListener(BreakListener l) {
|
||||||
breakListeners.remove(l);
|
breakListeners.remove(l);
|
||||||
@@ -610,6 +625,17 @@ public class DebuggerHandler implements DebugConnectionListener {
|
|||||||
boolean isAS3 = (Main.getMainFrame().getPanel().getCurrentSwf().isAS3());
|
boolean isAS3 = (Main.getMainFrame().getPanel().getCurrentSwf().isAS3());
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
con.addMessageListener(new DebugMessageListener<InErrorException>() {
|
||||||
|
@Override
|
||||||
|
public void message(InErrorException t) {
|
||||||
|
for (ErrorListener l : errorListeners) {
|
||||||
|
l.errorException(t.exceptionMessage, t.thrownVar);
|
||||||
|
}
|
||||||
|
con.dropMessage(t);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
con.addMessageListener(new DebugMessageListener<InNumScript>() {
|
con.addMessageListener(new DebugMessageListener<InNumScript>() {
|
||||||
@Override
|
@Override
|
||||||
public void message(InNumScript t) {
|
public void message(InNumScript t) {
|
||||||
|
|||||||
Reference in New Issue
Block a user