Added #2131 AS1/2 Debugger - show _root variable

Fixed #2131 AS1/2 Debugger - Breakpoint handling - incorrect script names
Fixed #2131 Debugger - Correct walking variables tree
This commit is contained in:
Jindra Petřík
2023-11-23 23:05:57 +01:00
parent 9741e8260a
commit e371372392
14 changed files with 177 additions and 64 deletions

View File

@@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file.
- Apply unpacker menu on binary data
- Harman unpacker for binary data
- Multilevel binary data unpacking is possible
- [#2131] AS1/2 Debugger - show _root variable
### Fixed
- [#2021], [#2000] Caret position in editors when using tabs and / or unicode
@@ -47,6 +48,8 @@ All notable changes to this project will be documented in this file.
- Linenumbers are visible even if debug markers are used
- Marker of stack frames not properly cleared
- Retain AS3 script selection in the tree after its editation and saving whole SWF
- [#2131] AS1/2 Debugger - Breakpoint handling - incorrect script names
- [#2131] Debugger - Correct walking variables tree
### Changed
- [#2120] Exported assets no longer take names from assigned classes if there is more than 1 assigned class
@@ -3304,6 +3307,7 @@ Major version of SWF to XML export changed to 2.
[#2123]: https://www.free-decompiler.com/flash/issues/2123
[#2119]: https://www.free-decompiler.com/flash/issues/2119
[#2129]: https://www.free-decompiler.com/flash/issues/2129
[#2131]: https://www.free-decompiler.com/flash/issues/2131
[#2021]: https://www.free-decompiler.com/flash/issues/2021
[#2000]: https://www.free-decompiler.com/flash/issues/2000
[#2116]: https://www.free-decompiler.com/flash/issues/2116

View File

@@ -2315,7 +2315,10 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
}
Map<String, ASMSource> asmsToExport = new LinkedHashMap<>();
for (TreeItem treeItem : getFirstLevelASMNodes(null)) {
getASMs(exportFileNames, treeItem, nodesToExport, exportAll, asmsToExport, File.separator + getASMPath(exportFileNames, treeItem));
getASMs(exportFileNames, treeItem, nodesToExport, exportAll, asmsToExport,
File.separator + getASMPath(true, treeItem),
File.separator + getASMPath(false, treeItem)
);
}
if (exportAll) {
if (exportFileNames) {
@@ -2327,48 +2330,67 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
return asmsToExport;
}
private void getASMs(boolean exportFileNames, TreeItem treeItem, List<TreeItem> nodesToExport, boolean exportAll, Map<String, ASMSource> asmsToExport, String path) {
private void getASMs(boolean exportFileNames, TreeItem treeItem, List<TreeItem> nodesToExport, boolean exportAll, Map<String, ASMSource> asmsToExport, String pathExportFilenames, String pathNoExportFilenames) {
TreeItem realItem = treeItem instanceof TagScript ? ((TagScript) treeItem).getTag() : treeItem;
boolean exportNode = nodesToExport.contains(treeItem) || nodesToExport.contains(realItem);
if (realItem instanceof ASMSource && (exportAll || exportNode)) {
String npath = path;
String exPath = path;
String pathNoExportFilenames2 = pathNoExportFilenames;
String pathExportFilenames2 = pathExportFilenames;
String path = exportFileNames ? pathExportFilenames : pathNoExportFilenames;
int ppos = 1;
while (asmsToExport.containsKey(npath)) {
while (asmsToExport.containsKey(path)) {
ppos++;
npath = path + (exportFileNames ? "[" + ppos + "]" : "_" + ppos);
exPath = path + "[" + ppos + "]";
pathNoExportFilenames2 = pathNoExportFilenames + "_" + ppos;
pathExportFilenames2 = pathExportFilenames + "[" + ppos + "]";
path = exportFileNames ? pathExportFilenames2 : pathNoExportFilenames2;
}
((ASMSource) realItem).setScriptName(exPath);
asmsToExport.put(npath, (ASMSource) realItem);
((ASMSource) realItem).setScriptName(pathNoExportFilenames2);
((ASMSource) realItem).setExportedScriptName(pathExportFilenames2);
asmsToExport.put(path, (ASMSource) realItem);
}
if (treeItem instanceof TagScript) {
TagScript tagScript = (TagScript) treeItem;
for (TreeItem subItem : tagScript.getFrames()) {
getASMs(exportFileNames, subItem, nodesToExport, exportAll, asmsToExport, path + File.separator + getASMPath(exportFileNames, subItem));
getASMs(exportFileNames, subItem, nodesToExport, exportAll, asmsToExport,
pathExportFilenames + File.separator + getASMPath(true, subItem),
pathNoExportFilenames + File.separator + getASMPath(false, subItem)
);
}
} else if (treeItem instanceof FrameScript) {
FrameScript frameScript = (FrameScript) treeItem;
Frame parentFrame = frameScript.getFrame();
for (TreeItem subItem : parentFrame.actionContainers) {
getASMs(exportFileNames, getASMWrapToTagScript(subItem), nodesToExport, exportAll || exportNode, asmsToExport, path + File.separator + getASMPath(exportFileNames, subItem));
getASMs(exportFileNames, getASMWrapToTagScript(subItem), nodesToExport, exportAll || exportNode, asmsToExport,
pathExportFilenames + File.separator + getASMPath(true, subItem),
pathNoExportFilenames + File.separator + getASMPath(false, subItem)
);
}
for (TreeItem subItem : parentFrame.actions) {
getASMs(exportFileNames, getASMWrapToTagScript(subItem), nodesToExport, exportAll || exportNode, asmsToExport, path + File.separator + getASMPath(exportFileNames, subItem));
getASMs(exportFileNames, getASMWrapToTagScript(subItem), nodesToExport, exportAll || exportNode, asmsToExport,
pathExportFilenames + File.separator + getASMPath(true, subItem),
pathNoExportFilenames + File.separator + getASMPath(false, subItem)
);
}
} else if (treeItem instanceof AS2Package) {
AS2Package as2Package = (AS2Package) treeItem;
for (TreeItem subItem : as2Package.subPackages.values()) {
if ((subItem instanceof AS2Package) && ((AS2Package) subItem).isDefaultPackage()) {
getASMs(exportFileNames, subItem, nodesToExport, exportAll, asmsToExport, path);
getASMs(exportFileNames, subItem, nodesToExport, exportAll, asmsToExport, pathExportFilenames, pathNoExportFilenames);
} else {
getASMs(exportFileNames, subItem, nodesToExport, exportAll, asmsToExport, path + File.separator + getASMPath(exportFileNames, subItem));
getASMs(exportFileNames, subItem, nodesToExport, exportAll, asmsToExport,
pathExportFilenames + File.separator + getASMPath(true, subItem),
pathNoExportFilenames + File.separator + getASMPath(false, subItem)
);
}
}
for (TreeItem subItem : as2Package.scripts.values()) {
getASMs(exportFileNames, subItem, nodesToExport, exportAll, asmsToExport, path + File.separator + getASMPath(exportFileNames, subItem));
getASMs(exportFileNames, subItem, nodesToExport, exportAll, asmsToExport,
pathExportFilenames + File.separator + getASMPath(true, subItem),
pathNoExportFilenames + File.separator + getASMPath(false, subItem)
);
}
}
}

View File

@@ -61,6 +61,9 @@ public class DoActionTag extends Tag implements ASMSource {
@Internal
private String scriptName = "-";
@Internal
private String exportedScriptName = "-";
@Override
public String getScriptName() {
@@ -258,4 +261,14 @@ public class DoActionTag extends Tag implements ASMSource {
return new ArrayList<>();
}
}
@Override
public String getExportedScriptName() {
return exportedScriptName;
}
@Override
public void setExportedScriptName(String scriptName) {
this.exportedScriptName = scriptName;
}
}

View File

@@ -68,6 +68,9 @@ public class DoInitActionTag extends Tag implements CharacterIdTag, ASMSource {
@Internal
private String scriptName = "-";
@Internal
private String exportedScriptName = "-";
@Override
public String getScriptName() {
@@ -291,4 +294,14 @@ public class DoInitActionTag extends Tag implements CharacterIdTag, ASMSource {
return new ArrayList<>();
}
}
@Override
public String getExportedScriptName() {
return exportedScriptName;
}
@Override
public void setExportedScriptName(String scriptName) {
this.exportedScriptName = scriptName;
}
}

View File

@@ -123,4 +123,8 @@ public interface ASMSource extends Exportable, HasSwfAndTag {
public String getScriptName();
public void setScriptName(String scriptName);
public String getExportedScriptName();
public void setExportedScriptName(String scriptName);
}

View File

@@ -45,6 +45,8 @@ public class ButtonAction implements ASMSource {
List<DisassemblyListener> listeners = new ArrayList<>();
private String scriptName = "-";
private String exportedScriptName = "-";
private final DefineButtonTag buttonTag;
@@ -227,4 +229,14 @@ public class ButtonAction implements ASMSource {
return new ArrayList<>();
}
}
@Override
public String getExportedScriptName() {
return exportedScriptName;
}
@Override
public void setExportedScriptName(String scriptName) {
this.exportedScriptName = scriptName;
}
}

View File

@@ -55,6 +55,8 @@ public class BUTTONCONDACTION implements ASMSource, Serializable, HasSwfAndTag {
private Tag tag;
private String scriptName = "-";
private String exportedScriptName = "-";
@Override
public String getScriptName() {
@@ -382,4 +384,14 @@ public class BUTTONCONDACTION implements ASMSource, Serializable, HasSwfAndTag {
return new ArrayList<>();
}
}
@Override
public String getExportedScriptName() {
return exportedScriptName;
}
@Override
public void setExportedScriptName(String scriptName) {
this.exportedScriptName = scriptName;
}
}

View File

@@ -50,6 +50,7 @@ import java.util.List;
public class CLIPACTIONRECORD implements ASMSource, Serializable, HasSwfAndTag {
private String scriptName = "-";
private String exportedScriptName = "-";
private CLIPACTIONS parentClipActions;
@Override
@@ -371,4 +372,14 @@ public class CLIPACTIONRECORD implements ASMSource, Serializable, HasSwfAndTag {
return new ArrayList<>();
}
}
@Override
public String getExportedScriptName() {
return exportedScriptName;
}
@Override
public void setExportedScriptName(String scriptName) {
this.exportedScriptName = scriptName;
}
}

View File

@@ -21,6 +21,7 @@ import com.jpexs.debugger.flash.messages.in.InBreakAtExt;
import com.jpexs.debugger.flash.messages.in.InConstantPool;
import com.jpexs.debugger.flash.messages.in.InFrame;
import com.jpexs.debugger.flash.messages.in.InGetVariable;
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.gui.DebuggerHandler.BreakListener;
import com.jpexs.decompiler.flash.gui.abc.ABCPanel;
@@ -504,15 +505,26 @@ public class DebugPanel extends JPanel {
SelectedTab oldSel = selectedTab;
localsTable = null;
SWF swf = Main.getMainFrame().getPanel().getCurrentSwf();
if (swf == null) {
return;
}
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;
}
List<Long> regVarIds = new ArrayList<>();
for (int i = 0; i < f.registers.size(); i++) {
regVarIds.add(0L);
}
safeSetTreeModel(debugRegistersTable, new ABCPanel.VariablesTableModel(debugRegistersTable, f.registers, regVarIds));
List<Variable> locals = new ArrayList<>();
if (root != null) {
locals.add(root);
}
locals.addAll(f.arguments);
locals.addAll(f.variables);

View File

@@ -359,15 +359,15 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
}
InGetVariable igv;
Long objectId = varToObjectId(var);
//Long objectId = varToObjectId(var);
boolean useGetter = (var.flags & VariableFlags.IS_CONST) == 0;
if (objectId != 0) {
/*if (objectId != 0) {
igv = Main.getDebugHandler().getVariable(objectId, "", true, useGetter);
} else {
igv = Main.getDebugHandler().getVariable(parentObjectId, var.name, true, useGetter);
}
} else {*/
igv = Main.getDebugHandler().getVariable(parentObjectId, var.name, true, useGetter);
//}
//current var is getter function - set it to value really got
if ((var.flags & VariableFlags.HAS_GETTER) > 0) {
@@ -440,6 +440,9 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
if (var.vType == VariableType.OBJECT) {
return (Long) var.value;
}
if (var.vType == VariableType.MOVIECLIP) {
return (Long) var.value;
}
return 0L;
}

View File

@@ -262,7 +262,7 @@ public class ASMSourceEditorPane extends DebuggableEditorPane implements CaretLi
}
}
String aname = "#PCODE abc:" + abcIndex + ",body:" + bodyIndex + ";" + scriptPathName;
setScriptName(aname);
setScriptName(aname, aname);
setHex(exportMode, true);
}

View File

@@ -891,7 +891,7 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
}
String sn = scriptLeaf.getClassPath().toString();
setScriptName(sn);
setScriptName(sn, sn);
abcPanel.scriptNameLabel.setText(sn);
int scriptIndex = scriptLeaf.scriptIndex;
ScriptInfo nscript = null;

View File

@@ -333,11 +333,11 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
return null;
}
private void setDecompiledText(final String scriptName, final String text) {
private void setDecompiledText(final String scriptName, final String breakPointScriptName, final String text) {
View.checkAccess();
ignoreCarret = true;
decompiledEditor.setScriptName(scriptName);
decompiledEditor.setScriptName(scriptName, breakPointScriptName);
decompiledEditor.setText(text);
BrokenScriptDetector det = new BrokenScriptDetector();
if (det.codeIsBroken(text)) {
@@ -349,17 +349,17 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
ignoreCarret = false;
}
private void setEditorText(final String scriptName, final String text, final String contentType) {
private void setEditorText(final String scriptName, final String breakPointScriptName, final String text, final String contentType) {
View.checkAccess();
ignoreCarret = true;
editor.setScriptName("#PCODE " + scriptName);
editor.setScriptName("#PCODE " + scriptName, "#PCODE " + breakPointScriptName);
editor.changeContentType(contentType);
editor.setText(text);
ignoreCarret = false;
}
private void setText(final HighlightedText text, final String contentType, final String scriptName) {
private void setText(final HighlightedText text, final String contentType, final String scriptName, final String breakPointScriptName) {
View.checkAccess();
int pos = editor.getCaretPosition();
@@ -372,7 +372,7 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
}
Long offset = lastH == null ? 0 : lastH.getProperties().offset;
disassembledText = text;
setEditorText(scriptName, text.text, contentType);
setEditorText(scriptName, breakPointScriptName, text.text, contentType);
Highlighting h = Highlighting.searchOffset(disassembledText.getInstructionHighlights(), offset);
if (h != null) {
if (h.startPos <= editor.getDocument().getLength()) {
@@ -410,7 +410,7 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
resolveConstantsButton.setVisible(exportMode != ScriptExportMode.CONSTANTS && exportMode != ScriptExportMode.HEX);
}
private void setHex(ScriptExportMode exportMode, String scriptName, ActionList actions) {
private void setHex(ScriptExportMode exportMode, String scriptName, String breakPointScriptName, ActionList actions) {
View.checkAccess();
updateHexButtons(exportMode);
@@ -420,14 +420,14 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
srcNoHex = getHighlightedText(exportMode, actions);
}
setText(srcNoHex, "text/flasm", scriptName);
setText(srcNoHex, "text/flasm", scriptName, breakPointScriptName);
break;
case PCODE_HEX:
if (srcWithHex == null) {
srcWithHex = getHighlightedText(exportMode, actions);
}
setText(srcWithHex, "text/flasm", scriptName);
setText(srcWithHex, "text/flasm", scriptName, breakPointScriptName);
break;
case HEX:
if (srcHexOnly == null) {
@@ -437,14 +437,14 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
srcHexOnly = new HighlightedText(writer);
}
setText(srcHexOnly, "text/plain", scriptName);
setText(srcHexOnly, "text/plain", scriptName, breakPointScriptName);
break;
case CONSTANTS:
if (srcConstants == null) {
srcConstants = getHighlightedText(exportMode, actions);
}
setText(srcConstants, "text/plain", scriptName);
setText(srcConstants, "text/plain", scriptName, breakPointScriptName);
break;
default:
throw new Error("Export mode not supported: " + exportMode);
@@ -468,7 +468,7 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
// todo: honfika: it is very slow to show every percent
View.execInEventDispatch(() -> {
setEditorText("-", "; " + AppStrings.translate("work.disassembling") + " - " + phase + " " + percent + "%...", "text/flasm");
setEditorText("-", "-", "; " + AppStrings.translate("work.disassembling") + " - " + phase + " " + percent + "%...", "text/flasm");
});
}
}
@@ -533,9 +533,9 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
ActionList innerActions = actions;
if (disassemblingNeeded) {
View.execInEventDispatch(() -> {
setEditorText(asm.getScriptName(), "; " + AppStrings.translate("work.disassembling") + "...", "text/flasm");
setEditorText(asm.getScriptName(), asm.getExportedScriptName(), "; " + AppStrings.translate("work.disassembling") + "...", "text/flasm");
if (decompileNeeded) {
setDecompiledText("-", "// " + AppStrings.translate("work.waitingfordissasembly") + "...");
setDecompiledText("-", "-", "// " + AppStrings.translate("work.waitingfordissasembly") + "...");
}
});
@@ -547,7 +547,7 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
if (decompileNeeded) {
View.execInEventDispatch(() -> {
setDecompiledText("-", "// " + AppStrings.translate("work.decompiling") + "...");
setDecompiledText("-", "-", "// " + AppStrings.translate("work.decompiling") + "...");
});
HighlightedText htext = SWF.getCached(asm, innerActions);
@@ -571,10 +571,10 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
try {
get();
} catch (CancellationException ex) {
setEditorText("-", "; " + AppStrings.translate("work.canceled"), "text/flasm");
setEditorText("-", "-", "; " + AppStrings.translate("work.canceled"), "text/flasm");
} catch (Exception ex) {
logger.log(Level.SEVERE, "Error", ex);
setDecompiledText("-", "// " + AppStrings.translate("decompilationError") + ": " + ex);
setDecompiledText("-", "-", "// " + AppStrings.translate("decompilationError") + ": " + ex);
}
});
}
@@ -601,8 +601,8 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
lastCode = actions;
lastDecompiled = decompiledText;
setHex(getExportMode(), asm.getScriptName(), actions);
setDecompiledText(asm.getScriptName(), decompiledText.text);
setHex(getExportMode(), asm.getScriptName(), asm.getExportedScriptName(), actions);
setDecompiledText(asm.getScriptName(), asm.getExportedScriptName(), decompiledText.text);
scriptLoaded = true;
fireScript();
}
@@ -1117,11 +1117,11 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
if (val) {
if (hexOnlyButton.isSelected()) {
setHex(ScriptExportMode.HEX, src.getScriptName(), lastCode);
setHex(ScriptExportMode.HEX, src.getScriptName(), src.getExportedScriptName(), lastCode);
} else if (constantsViewButton.isSelected()) {
setHex(ScriptExportMode.CONSTANTS, src.getScriptName(), lastCode);
setHex(ScriptExportMode.CONSTANTS, src.getScriptName(), src.getExportedScriptName(), lastCode);
} else {
setHex(ScriptExportMode.PCODE, src.getScriptName(), lastCode);
setHex(ScriptExportMode.PCODE, src.getScriptName(), src.getExportedScriptName(), lastCode);
}
}
@@ -1154,9 +1154,9 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
if (src != null) {
if (val) {
setDecompiledText(src.getScriptName(), lastDecompiled.text);
setDecompiledText(src.getScriptName(), src.getExportedScriptName(), lastDecompiled.text);
} else {
setDecompiledText(src.getScriptName(), lastDecompiled.text);
setDecompiledText(src.getScriptName(), src.getExportedScriptName(), lastDecompiled.text);
}
}
@@ -1200,15 +1200,15 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
}
private void hexButtonActionPerformed(ActionEvent evt) {
setHex(getExportMode(), src.getScriptName(), lastCode);
setHex(getExportMode(), src.getScriptName(), src.getExportedScriptName(), lastCode);
}
private void hexOnlyButtonActionPerformed(ActionEvent evt) {
setHex(getExportMode(), src.getScriptName(), lastCode);
setHex(getExportMode(), src.getScriptName(), src.getExportedScriptName(), lastCode);
}
private void constantsViewButtonActionPerformed(ActionEvent evt) {
setHex(getExportMode(), src.getScriptName(), lastCode);
setHex(getExportMode(), src.getScriptName(), src.getExportedScriptName(), lastCode);
}
private void resolveConstantsButtonActionPerformed(ActionEvent evt) {
@@ -1218,7 +1218,7 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
srcWithHex = null;
srcNoHex = null;
// srcHexOnly = null; is not needed since it does not contains the resolved constant names
setHex(getExportMode(), src.getScriptName(), lastCode);
setHex(getExportMode(), src.getScriptName(), src.getExportedScriptName(), lastCode);
}
private void showFileOffsetInPcodeHexButtonActionPerformed(ActionEvent evt) {
@@ -1226,7 +1226,7 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
Configuration.showFileOffsetInPcodeHex.set(resolve);
srcWithHex = null;
setHex(getExportMode(), src.getScriptName(), lastCode);
setHex(getExportMode(), src.getScriptName(), src.getExportedScriptName(), lastCode);
}
private void showOriginalBytesInPcodeHexButtonActionPerformed(ActionEvent evt) {
@@ -1234,12 +1234,12 @@ public class ActionPanel extends JPanel implements SearchListener<ScriptSearchRe
Configuration.showOriginalBytesInPcodeHex.set(resolve);
srcWithHex = null;
setHex(getExportMode(), src.getScriptName(), lastCode);
setHex(getExportMode(), src.getScriptName(), src.getExportedScriptName(), lastCode);
}
private void cancelActionButtonActionPerformed(ActionEvent evt) {
setEditMode(false);
setHex(getExportMode(), src.getScriptName(), lastCode);
setHex(getExportMode(), src.getScriptName(), src.getExportedScriptName(), lastCode);
mainPanel.clearEditingStatus();
}

View File

@@ -72,6 +72,8 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP
public static final LineMarker STACK_MARKER = new LineMarker(FG_STACK_COLOR, BG_STACK_COLOR, PRIORITY_STACK);
protected String scriptName = null;
protected String breakPointScriptName = null;
private LineNumbersBreakpointsRuler ruler;
@@ -85,19 +87,20 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP
}
}
public synchronized void setScriptName(String scriptName) {
public synchronized void setScriptName(String scriptName, String breakPointScriptName) {
this.scriptName = scriptName;
this.breakPointScriptName = breakPointScriptName;
}
@Override
public synchronized void toggled(int line) {
if (scriptName == null) {
if (breakPointScriptName == null) {
return;
}
boolean on = Main.toggleBreakPoint(scriptName, line - firstLineOffset());
boolean on = Main.toggleBreakPoint(breakPointScriptName, line - firstLineOffset());
removeColorMarker(line, INVALID_BREAKPOINT_MARKER);
if (on) {
if (Main.isBreakPointValid(scriptName, line - firstLineOffset())) {
if (Main.isBreakPointValid(breakPointScriptName, line - firstLineOffset())) {
addColorMarker(line, BREAKPOINT_MARKER);
} else {
addColorMarker(line, INVALID_BREAKPOINT_MARKER);
@@ -114,22 +117,22 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP
removeColorMarkerOnAllLines(IP_MARKER);
removeColorMarkerOnAllLines(STACK_MARKER);
if (scriptName == null) {
if (breakPointScriptName == null) {
return;
}
Set<Integer> bkptLines = Main.getScriptBreakPoints(scriptName, false);
Set<Integer> bkptLines = Main.getScriptBreakPoints(breakPointScriptName, false);
for (int line : bkptLines) {
if (Main.isBreakPointValid(scriptName, line)) {
if (Main.isBreakPointValid(breakPointScriptName, line)) {
addColorMarker(line + firstLineOffset(), BREAKPOINT_MARKER);
} else {
addColorMarker(line + firstLineOffset(), INVALID_BREAKPOINT_MARKER);
}
}
int ip = Main.getIp(scriptName);
int ip = Main.getIp(breakPointScriptName);
String ipPath = Main.getIpClass();
if (ip > 0 && ipPath != null && ipPath.equals(scriptName)) {
if (ip > 0 && ipPath != null && ipPath.equals(breakPointScriptName)) {
addColorMarker(ip + firstLineOffset(), IP_MARKER);
}
List<Integer> stackLines = Main.getStackLines();
@@ -137,7 +140,7 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP
for (int i = 1; i < stackClasses.size(); i++) {
String cls = stackClasses.get(i);
int line = stackLines.get(i);
if (cls.equals(scriptName)) {
if (cls.equals(breakPointScriptName)) {
addColorMarker(line + firstLineOffset(), STACK_MARKER);
}
}
@@ -153,6 +156,10 @@ public class DebuggableEditorPane extends LineMarkedEditorPane implements BreakP
return scriptName;
}
public String getBreakPointScriptName() {
return breakPointScriptName;
}
@Override
public void paintLineMarker(Graphics g, int line, int x, int lineY, int textY, int lineHeight, boolean currentLine, int maxLines) {