Re: Best class decompiler?
On 07/05/2010 03:43 PM, BGB / cr88192 wrote:
native disassembly is not *that* difficult, as it is mostly a matter of
having:
In the context of disassembly as a prerequisite for decompiling, it can
be difficult. I will agree that disassembling a small fragment is no
challenge, but the issue is mostly program-wide decompiling and
disassembling. Tasks like determining function boundaries and call
frames I am including in disassembly, and this is not exactly an easy
task, especially if you compile with -OMG.
now, granted, SMC could foul this up, but given SMC is both rare and
problematic in modern systems, this is not too much of an issue.
Self-modifying code probably makes up the vast majority of "interesting"
cases for disassembly: malware.
[1] I'm glossing over a lot of stuff here which is actually quite
difficult for native code, but many of the problems don't exist in Java.
large complicated ISA and awkwardness of recursive jump-tracing?...
No need to worry about the pain of code and data sharing the same code
space (separation of code and data is equivalent to the halting problem)
is a major factor. Determining function arguments (in light of things
like fastcall or -fomit-frame-pointer) and even function boundaries is
another annoying issue. It also helps that Java bytecode is typically
unoptimized, so you get very sane CFGs.
I suppose Java bytecode is roughly comparable to having a binary
compiled with -g with full debug symbols and no optimization whatsoever,
with the header files probably also included.
yeah, probably seems like I am wasting time, but:
LLVM is mostly aiming for being a high-performance codegen and code
analysis;
my main goal is mostly for making high-level features available from C (such
as reflection and eval, as well as ability to load scripts, and cleanly
integrate between C and high-level scripting languages, ...), which in all
deal with a somewhat different set of problem domains...
Reflection and C++ don't mix very well. I could go on for hours about
this, but by then we'd have long since gone well off-topic.
Java also presents its share of interfacing issues...
At least there exists a single Java ABI. C++ on the other hand...
--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth