MinecraftForge / ForgeFlower

Forge's modifications to FernFlower. Fixing various bugs/inconsistencies. Main Repo: https://github.com/MinecraftForge/FernFlower
Apache License 2.0
80 stars 44 forks source link

Expose line-mapping for decompiled jars #95

Closed zml2008 closed 3 years ago

zml2008 commented 3 years ago

This also fixes a case where the tracer wasn't incremented, which caused misaligned linemaps.

I've tested this in my work on VanillaGradle, seems to make the debugger way happier now.

See VanillaGradle's implementation for an example of linemapping being applied.

There should be no impact on the decompiled output -- this whole bytecode tracer infrastructure is only used for the -bsm flag.

LexManos commented 3 years ago

What is the use case? What does this actually do that is useful?

zml2008 commented 3 years ago

In an environment where you're not recompiling, this tells Fernflower to spit out a mapping of the lines in bytecode to lines in decompiled code. That is needed for breakpoints set based on the source in-IDE to match up with the code executed.

Without linemapping, method breakpoints will open up at (from our view) random points in the class file, and line breakpoints often won't trigger at all.

LexManos commented 3 years ago

Interesting idea, this might be useful to provide MCPConfig builds, that do not have patches to make the code recompile. Thanks for adding yet another thing onto my todo list ;)