If you are looking for the decompiler itself, visit https://github.com/jindrapetrik/jpexs-decompiler
NEW : We have got a new blog where we post some interesting SWF internals info.

#902 Incorrect line on debugging
Author:
albfan

Date created:
Type: question
Visibility: Everybody
Assigned to:
Labels: AS3
State: closed 

> What steps will reproduce the problem?
- Decompile some code
- Attach decompiled code to a debugger
- Try to follow the code but debugger takes you to a correct n incorrect line
> What is the expected output? What do you see instead?
On debugging jump correctly to decompiled code
Debug take me to correct file but to an incorrect line, making debug a pain.
> What version of the product are you using? On what operating system?
JPEXS 5.3.0 on Windows 7. Debug with eclipse indigo.
> Please provide any additional information below. Attach the file you have problem with
if neccessary. If you do not want to publish files YOU CAN CHANGE VISIBILITY TO PRIVATE
I don't know if flex provide debug information (so you can jump to correct line on debug)
If you can point me where decompilation writes output files and where to find line
position for compiled code I can provide a patch from github.
The decompiled script won't be ever the same as the original source code, so the line
numbers will be diffrent.
I think it is normal, not a but. It is impossible to recreate the original source code.
Maybe we can do reverse thing - we can decompile the file and then modify the original SWF
file to contain match line numbers from decompiled scripts. I already discissed it with
somebody earlier. To make the SWF file debuggable with esctracted scripts...
Would you like this feature?
Type: bug→question
I'm not talking about 100% precision.
These came from a decompiled code
findproperty Qname(PackageNamespace(""),"VAR_1")
pushstring "foo"
initproperty Qname(PackageNamespace(""),"VAR_1")
debug 1 "VAR_1" 5 43
that debug line is line info, isn't it?
Other decompilers try (not perfectly) to respect that info to output a debuggeable file.
That is what I'm looking for: Where to read that information to try to respect that debug
info. Please lead me to codebase to propose a patch
That approach is scary. I had already thought. Since I have the decompiled code I can
compile it again. But that way you cannot trust your debug.
Since debug works (if you locate where on file you are really) Try to create a file that
respect the debug info seems better approach.
Anyway (since you have an experimental option to edit code) I think both approach would be
nice, just let people choice what to use.
A first test changing manually decompiled code to respect that debugline info works
perfect
> I forgot to add this line to prior example
debugline 127
Any clues about where decompiled code is output and how to read debug info?
"Please lead me to codebase to propose a patch"
You can find the source code here: https://github.com/jindrapetrik/jpexs-decompiler
You can fork this repository, and send a pull request.
The core decompiler is in folder libsrc/ffdec_lib
Great!
libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/debug/DebugLineIns.j
ava
That should be enough to start with
The decompiler already loads the linenumbers from this instruction.
The only thing to do here is format the code the way it matches the linenumber info.
This is not an easy task. Each GraphTargetItem has getLine() method which returns the line
taken from debugInfo. This can be helpful...
State: new→closed