Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print disassembly of generated bytecode #612

Closed
FroMage opened this issue Jan 23, 2019 · 7 comments · Fixed by #15162
Closed

Print disassembly of generated bytecode #612

FroMage opened this issue Jan 23, 2019 · 7 comments · Fixed by #15162
Labels
kind/enhancement New feature or request
Milestone

Comments

@FroMage
Copy link
Member

FroMage commented Jan 23, 2019

Writing an extension that generates bytecode with ASM or gizmo pretty often you get things wrong and have verify errors or just buggy generated code. It would be really nice if there were an option to make shamrock generate disassembled bytecode of what we just generated.

@FroMage FroMage added the kind/enhancement New feature or request label Jan 23, 2019
@geoand
Copy link
Contributor

geoand commented Jan 23, 2019

Are you thinking about some kind of integration with https://github.com/fesh0r/fernflower?

@stuartwdouglas
Copy link
Member

JClasslib is really good for this. Its not disassembled, but rather lets you look at the raw bytecode you have generated in an easy to understand way.

@FroMage
Copy link
Member Author

FroMage commented Jan 24, 2019

JClasslib requires me to open that tool and set it up. I'd really love if I could set this property:

shamrock.log.bytecode-magic=true
shamrock.log.bytecode-magic.packages=io.stef.model

And have the generated classes in io.stef.model dumped on STDERR, disassembled. Or dumped to target/generated-sources or other. Actually even dumped on STDERR as bytecode would be a lot of help :)

@dmlloyd
Copy link
Member

dmlloyd commented Jan 25, 2019

I like this idea, having spent quite a lot of time dealing with generated code in the last few weeks.

It would be great if we could generate a fake "source" file that contains the bytecode generated plus some notation which includes the stack trace element of the line of code that generated that section of bytecode. The generated text file could then be set as the source file of the generated .class file, with line number tables that match up with the text, so that you can step through it in a debugger.

@dmlloyd
Copy link
Member

dmlloyd commented Jan 25, 2019

Doing this via config should definitely be possible using the new code.

@stuartwdouglas
Copy link
Member

Will the dissembler actually work on invalid bytecode?

@dmlloyd
Copy link
Member

dmlloyd commented Jan 27, 2019

I think IDEA will reference any source file regardless of language (or lack there of), as long as it's the same file referenced in the bytecode and the file is in the right package on a source path (or in this case, generated source path).

geoand added a commit to geoand/quarkus that referenced this issue Feb 18, 2021
This makes it easy for Quarkus developers and extension authors
to see the bytecode that Quarkus produces

Fixes: quarkusio#612
geoand added a commit to geoand/quarkus that referenced this issue Feb 18, 2021
This makes it easy for Quarkus developers and extension authors
to see the bytecode that Quarkus produces

Fixes: quarkusio#612
geoand added a commit to geoand/quarkus that referenced this issue Feb 18, 2021
This makes it easy for Quarkus developers and extension authors
to see the bytecode that Quarkus produces

Fixes: quarkusio#612
geoand added a commit to geoand/quarkus that referenced this issue Feb 18, 2021
This makes it easy for Quarkus developers and extension authors
to see the bytecode that Quarkus produces

Fixes: quarkusio#612
geoand added a commit to geoand/quarkus that referenced this issue Feb 18, 2021
This makes it easy for Quarkus developers and extension authors
to see the bytecode that Quarkus produces

Fixes: quarkusio#612
geoand added a commit to geoand/quarkus that referenced this issue Feb 18, 2021
This makes it easy for Quarkus developers and extension authors
to see the bytecode that Quarkus produces

Fixes: quarkusio#612
@quarkus-bot quarkus-bot bot added this to the 1.13 - master milestone Feb 19, 2021
geoand added a commit that referenced this issue Feb 19, 2021
Integrate Fernflower decompiler into Quarkus build of fast-jar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants