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

Auto Decompiler Ranking #111

Open
Manouchehri opened this Issue Dec 24, 2015 · 9 comments

Comments

Projects
None yet
3 participants
@Manouchehri
Copy link

Manouchehri commented Dec 24, 2015

PMD could be used to compare the output of different decompilers, and automatically pick which one to use based on the complexity score. Other metrics can probably be used as well, but that would be the most basic.

@Konloch

This comment has been minimized.

Copy link
Owner

Konloch commented Dec 24, 2015

Oh wow this is really cool, I'd totally be interested in support for this.

@Manouchehri

This comment has been minimized.

Copy link
Author

Manouchehri commented Dec 24, 2015

@Konloch Is there anything already in place to check if the current decompiled code can actually be recompiled? If not, I should do that first.

@Konloch

This comment has been minimized.

Copy link
Owner

Konloch commented Dec 24, 2015

Nah, I rely on simply calling 'javac', then if there's no classfile produced it assumes theres an error and returns the system.out/system.err logs.

@Manouchehri

This comment has been minimized.

Copy link
Author

Manouchehri commented Dec 24, 2015

One problem with using errors from javac is that in theory it could recompile to a function that behaves differently. I think the bytecode should probably be compared instead.

There might be changes in the bytecode if the compiler major/minor version is different, so it'd be up to the user to make sure they're using the same one.

@ghost

This comment has been minimized.

Copy link

ghost commented Jan 2, 2016

@Manouchehri that's difficult because you will need CFG analysis to compare the actual logic of functions in bytecode.

Another way could just be searching for "couldn't be decompiled" or error messages

@Manouchehri

This comment has been minimized.

Copy link
Author

Manouchehri commented Jan 3, 2016

@afffsdd Shouldn't the bytecode be identical if the same compiler is used? I don't see the need for CFG here.

@ghost

This comment has been minimized.

Copy link

ghost commented Jan 3, 2016

you can't rely on that, changes in the way the source code is laid out can affect the compiled bytecode.

@Manouchehri

This comment has been minimized.

Copy link
Author

Manouchehri commented Jan 3, 2016

@Storyyeller

This comment has been minimized.

Copy link

Storyyeller commented Feb 3, 2016

It's basically impossible to decompile to source code which will produce the same classfile, even in ideal circumstances. If you want roundtripping, you need to use the Krakatau diassembler.

If you're doing code complexity, you'll probably want to add a check that the method isn't just comments or an error message.

As for verifying the correctness of the code, that's obviously a Turing Hard problem. For arbitrary bytecode, you're most likely to get accurate results from Krakatau for a certain definition of accurate. If you don't, you should file a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment