mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 16:10:45 +00:00
Fixed AS3 Debugging P-code inside nested functions
Fixed AS3 Debugging - show (and click through) proper call stack
This commit is contained in:
@@ -43,6 +43,11 @@ public class DebugStackPanel extends JPanel {
|
||||
|
||||
private int depth = 0;
|
||||
|
||||
private int[] classIndices = new int[0];
|
||||
private int[] methodIndices = new int[0];
|
||||
private int[] traitIndices = new int[0];
|
||||
|
||||
|
||||
public DebugStackPanel() {
|
||||
stackTable = new JTable();
|
||||
Main.getDebugHandler().addFrameChangeListener(new DebuggerHandler.FrameChangeListener() {
|
||||
@@ -90,7 +95,7 @@ public class DebugStackPanel extends JPanel {
|
||||
String scriptName = (String) stackTable.getModel().getValueAt(row, 0);
|
||||
int line = (int) (Integer) stackTable.getModel().getValueAt(row, 1);
|
||||
Main.getMainFrame().getPanel().gotoScriptLine(Main.getMainFrame().getPanel().getCurrentSwf(),
|
||||
scriptName, line, -1, -1, -1);
|
||||
scriptName, line, classIndices[row], traitIndices[row], methodIndices[row]);
|
||||
Main.getDebugHandler().setDepth(row);
|
||||
}
|
||||
}
|
||||
@@ -115,11 +120,22 @@ public class DebugStackPanel extends JPanel {
|
||||
}
|
||||
active = true;
|
||||
Object[][] data = new Object[info.files.size()][3];
|
||||
int[] newClassIndices = new int[info.files.size()];
|
||||
int[] newMethodIndices = new int[info.files.size()];
|
||||
int[] newTraitIndices = new int[info.files.size()];
|
||||
for (int i = 0; i < info.files.size(); i++) {
|
||||
data[i][0] = Main.getDebugHandler().moduleToString(info.files.get(i));
|
||||
int f = info.files.get(i);
|
||||
data[i][0] = Main.getDebugHandler().moduleToString(f);
|
||||
data[i][1] = info.lines.get(i);
|
||||
data[i][2] = info.stacks.get(i);
|
||||
data[i][2] = info.stacks.get(i);
|
||||
Integer newClassIndex = Main.getDebugHandler().moduleToClassIndex(f);
|
||||
newClassIndices[i] = newClassIndex == null ? -1 : newClassIndex;
|
||||
Integer newMethodIndex = Main.getDebugHandler().moduleToMethodIndex(f);
|
||||
newMethodIndices[i] = newMethodIndex == null ? -1 : newMethodIndex;
|
||||
Integer newTraitIndex = Main.getDebugHandler().moduleToTraitIndex(f);;
|
||||
newTraitIndices[i] = newTraitIndex == null ? -1 : newTraitIndex;
|
||||
}
|
||||
|
||||
|
||||
DefaultTableModel tm = new DefaultTableModel(data, new Object[]{
|
||||
AppStrings.translate("callStack.header.file"),
|
||||
@@ -133,6 +149,9 @@ public class DebugStackPanel extends JPanel {
|
||||
|
||||
};
|
||||
stackTable.setModel(tm);
|
||||
this.classIndices = newClassIndices;
|
||||
this.methodIndices = newMethodIndices;
|
||||
this.traitIndices = newTraitIndices;
|
||||
|
||||
View.execInEventDispatchLater(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -374,6 +374,18 @@ public class DebuggerHandler implements DebugConnectionListener {
|
||||
}
|
||||
return modulePaths.get(file);
|
||||
}
|
||||
|
||||
public Integer moduleToMethodIndex(int file) {
|
||||
return moduleToMethodIndex.get(file);
|
||||
}
|
||||
|
||||
public Integer moduleToClassIndex(int file) {
|
||||
return moduleToClassIndex.get(file);
|
||||
}
|
||||
|
||||
public Integer moduleToTraitIndex(int file) {
|
||||
return moduleToTraitIndex.get(file);
|
||||
}
|
||||
|
||||
public synchronized InBreakAtExt getBreakInfo() {
|
||||
if (!paused) {
|
||||
|
||||
@@ -2542,16 +2542,17 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
public void run() {
|
||||
if (Main.isDebugPCode()) {
|
||||
if (classIndex != -1) {
|
||||
boolean classChanged = false;
|
||||
if (abcPanel.decompiledTextArea.getClassIndex() != classIndex) {
|
||||
abcPanel.decompiledTextArea.setClassIndex(classIndex);
|
||||
classChanged = true;
|
||||
}
|
||||
if (traitIndex != -10 && (classChanged || abcPanel.decompiledTextArea.lastTraitIndex != traitIndex)) {
|
||||
abcPanel.decompiledTextArea.gotoTrait(traitIndex);
|
||||
}
|
||||
}
|
||||
abcPanel.detailPanel.methodTraitPanel.methodCodePanel.gotoInstrLine(line);
|
||||
abcPanel.decompiledTextArea.gotoMethod(methodIndex, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
abcPanel.detailPanel.methodTraitPanel.methodCodePanel.gotoInstrLine(line);
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
abcPanel.decompiledTextArea.gotoLine(line);
|
||||
}
|
||||
|
||||
@@ -772,6 +772,10 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
|
||||
}
|
||||
|
||||
public void gotoMethod(int methodId) {
|
||||
gotoMethod(methodId, null);
|
||||
}
|
||||
|
||||
public void gotoMethod(int methodId, Runnable afterHandler) {
|
||||
Highlighting tm = Highlighting.searchIndex(highlightedText.getMethodHighlights(), methodId);
|
||||
if (tm != null) {
|
||||
int pos = 0;
|
||||
@@ -792,6 +796,9 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
|
||||
if (fpos <= getDocument().getLength()) {
|
||||
setCaretPosition(fpos);
|
||||
}
|
||||
if (afterHandler != null) {
|
||||
afterHandler.run();
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user