From f1a22e95595ab26e133c618d247963641d8712b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sat, 31 May 2025 19:32:45 +0200 Subject: [PATCH] Fixed: #2462 AS3 debugger - incorrect line info injected --- CHANGELOG.md | 2 ++ .../src/com/jpexs/decompiler/flash/abc/ScriptPack.java | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f66ddce6..b22501a40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,7 @@ All notable changes to this project will be documented in this file. - AS1/2/3 for decompilation with multiple variables - AS3 native functions outside class allowed - AS3 difference between namespace keyword and const of type Namespace +- [#2462] AS3 debugger - incorrect line info injected ## [23.0.1] - 2025-05-16 ### Fixed @@ -3846,6 +3847,7 @@ Major version of SWF to XML export changed to 2. [#2459]: https://www.free-decompiler.com/flash/issues/2459 [#2460]: https://www.free-decompiler.com/flash/issues/2460 [#2461]: https://www.free-decompiler.com/flash/issues/2461 +[#2462]: https://www.free-decompiler.com/flash/issues/2462 [#2427]: https://www.free-decompiler.com/flash/issues/2427 [#1826]: https://www.free-decompiler.com/flash/issues/1826 [#2448]: https://www.free-decompiler.com/flash/issues/2448 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java index d448d4f91..e23053e4f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java @@ -821,9 +821,7 @@ public class ScriptPack extends AS3ClassTreeItem { } List code2 = new ArrayList<>(); - int dpos = 0; code2.add(new AVM2Instruction(0, AVM2Instructions.DebugFile, new int[]{abc.constants.getStringId(filename, true)})); - dpos++; Set regs = bodyToRegToName.containsKey(bodyIndex) ? bodyToRegToName.get(bodyIndex).keySet() : new TreeSet<>(); for (int r : regs) { String name = bodyToRegToName.get(bodyIndex).get(r); @@ -864,12 +862,12 @@ public class ScriptPack extends AS3ClassTreeItem { if (addedLines.contains(line)) { continue; } - if (!origPosToNewPos.containsKey(i + dpos)) { + if (!origPosToNewPos.containsKey(i)) { continue; } addedLines.add(line); logger.log(Level.FINE, "Script {0}: Insert debugline({1}) at pos {2} to body {3}", new Object[]{path, line, i, bodyIndex}); - code2.add(origPosToNewPos.get(i + dpos), new AVM2Instruction(0, AVM2Instructions.DebugLine, new int[]{line})); + code2.add(origPosToNewPos.get(i), new AVM2Instruction(0, AVM2Instructions.DebugLine, new int[]{line})); } long adr = 0; Map mapOffsets = new HashMap<>();