Some highlights:
. Added support for PS3 and System V ELF files.
. For fun: a C64 BASIC "decompiler"! Give it a D64 Commodore disk image, navigate to a program, and load it. It will translate the BASIC instructions into intermediate code, and then generates pseudo-C from it.
. Fixed the following submitted bugs
- Can not load ELF or Amiga Hunk binaries
- Can not run the decompiler from the command line
. Implemented more x86 and PowerPC instructions
. Improvements in SSA transformation code in preparation for
move to new decompilation model
. ImageSegmentRenders allow viewing of the structured data
in image segments.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the release. I wrote a small script to summarize the problems
the code has with the various subjects. I'm not sure about the .net
exception format so it may be wrong a little bit.
Hope this helps.
Regards,
Raimar
../decompiler-subjects>catscripts/summarize_decompiler.sf.net.py#!/usr/bin/pythonimportsys,recontent=sys.stdin.read()m={}forkeyin[" ; ".join(x)forxinre.findall("^ ([^ ].*)\n (at .*)\n (at .*)",content,re.M)]:m[key]=m.get(key,0)+1keys=sorted(m.keys(),lambdax,y:cmp(m[y],m[x]))forkeyinkeys:print"%4d%s"%(m[key],key)../decompiler-subjects>find.-nameby_decompiler.sf.net.out|xargscat|pythonscripts/summarize_decompiler.sf.net.py2>/dev/null|head-n20354Theprogram's Architecture property must be set before accessing the Globals property. ; at Decompiler.Core.Program.get_Globals() ; at Decompiler.Core.Output.GlobalDataWriter.WriteGlobals(Formatter formatter)354Objectreferencenotsettoaninstanceofanobject.;atDecompiler.Core.Platform.get_PointerType();atDecompiler.Typing.TypeAnalyzer.RewriteProgram(Programprog)295Thegivenkeywasnotpresentinthedictionary.;atSystem.Collections.Generic.Dictionary`2.get_Item(TKeykey);atDecompiler.Analysis.ExpressionPropagator.GetStackDepthBeforeCall()292Thegivenkeywasnotpresentinthedictionary.;atSystem.Collections.Generic.Dictionary`2.get_Item(TKey key) ; at Decompiler.Core.Lib.DominatorGraph`1.BuildDominanceFrontiers(DirectedGraph`1 graph, Dictionary`2idoms)245Expectedstackdepthtobenegative.;atDecompiler.Analysis.ExpressionPropagator.GetStackDepthBeforeCall();atDecompiler.Analysis.ExpressionPropagator.VisitCallInstruction(CallInstructionci)208Themethodoroperationisnotimplemented.;atDecompiler.Core.Output.GlobalDataWriter.VisitUnion(UnionTypeut);atDecompiler.Core.Output.GlobalDataWriter.VisitEquivalenceClass(EquivalenceClasseq)176Objectreferencenotsettoaninstanceofanobject.;atDecompiler.Typing.TypedExpressionRewriter.RewriteFormals(ProcedureSignaturesig);atDecompiler.Typing.TypedExpressionRewriter.RewriteProgram(Programprog)71Themethodoroperationisnotimplemented.;atDecompiler.ImageLoaders.MachO.MachOLoader.get_PreferredBaseAddress();atDecompiler.Loading.Loader.LoadExecutable(Stringfilename,Byte[]image,AddressaddrLoad)67Unabletocastobjectoftype'Decompiler.Core.Code.ReturnInstruction'totype'Decompiler.Core.Code.Branch'.;atDecompiler.Structure.AbsynCodeGenerator.BranchCondition(StructureNodenode);atDecompiler.Structure.IfConditional.GenerateCode(AbsynCodeGeneratorcodeGen,StructureNodenode,StructureNodelatchNode,AbsynStatementEmitteremitter)66Drillintostruct;atDecompiler.Core.Output.GlobalDataWriter.VisitPointer(Pointerptr);atDecompiler.Core.Output.GlobalDataWriter.WriteGlobals(Formatterformatter)65Unabletocastobjectoftype'Decompiler.Core.Types.StructureType'totype'Decompiler.Core.Types.EquivalenceClass'.;atDecompiler.Core.Output.GlobalDataWriter.WriteGlobals(Formatterformatter);atDecompiler.DecompilerDriver.WriteGlobals(Programprogram,TextWriterw)48Relocationtype5nothandledyet;atDecompiler.ImageLoaders.Elf.ElfImageLoader.RelocateI386();atDecompiler.ImageLoaders.Elf.ElfImageLoader.Relocate(AddressaddrLoad)46Objectreferencenotsettoaninstanceofanobject.;atDecompiler.Core.Configuration.DecompilerConfiguration.GetArchitecture(StringarchLabel);atDecompiler.ImageLoaders.Elf.ElfImageLoader.CreateArchitecture(UInt16machineType)40Themethodoroperationisnotimplemented.;atDecompiler.Core.Output.GlobalDataWriter.VisitCode(CodeTypec);atDecompiler.Core.Output.GlobalDataWriter.WriteGlobals(Formatterformatter)38Processorformat62isnotsupported.;atDecompiler.ImageLoaders.Elf.ElfImageLoader.CreateArchitecture(UInt16machineType);atDecompiler.ImageLoaders.Elf.ElfImageLoader.LoadHeader()33Unabletocastobjectoftype'Decompiler.Core.Types.PrimitiveType'totype'Decompiler.Core.Types.EquivalenceClass'.;atDecompiler.Core.Output.GlobalDataWriter.WriteGlobals(Formatterformatter);atDecompiler.DecompilerDriver.WriteGlobals(Programprogram,TextWriterw)32Anitemwiththesamekeyhasalreadybeenadded.;atSystem.Collections.Generic.Dictionary`2.Insert(TKeykey,TValuevalue,Booleanadd);atDecompiler.ImageLoaders.Elf.ElfImageLoader.RelocateI386()22Themethodoroperationisnotimplemented.;atDecompiler.Structure.AbsynStatementEmitter.Decompiler.Core.Code.InstructionVisitor.VisitDefInstruction(DefInstructiondef);atDecompiler.Structure.AbsynCodeGenerator.EmitLinearBlockStatements(StructureNodenode,AbsynStatementEmitteremitter)17Thegivenkeywasnotpresentinthedictionary.;atSystem.Collections.Generic.Dictionary`2.get_Item(TKeykey);atDecompiler.Analysis.DeadCode.VisitIdentifier(Identifierid)14Drillintostruct;atDecompiler.Core.Output.GlobalDataWriter.VisitPointer(Pointerptr);atDecompiler.Core.Output.GlobalDataWriter.VisitStructure(StructureTypestr)../decompiler-subjects>
Thanks for the script Raimar, it will prove handy.
I did some analysis of the programs that were causing the errors. It turns out that a large percentage of the programs that cause the "The program's Architecture property..." error message are the MS-DOS COM programs in the subdirectory from_pouet. Because a COM program has no identifiable executable magic number or header, like say EXE or ELF files, the Decompiler needs some additional hints in order to know what to do with it. As Decompiler targets many processor architectures, it can't simply blindly assume that a "header-less" file is an x86 COM file like some other decompilers do.
Today, I checked in some enhancements to the command-line interpreter. It now accepts a few options, which (once I've made a release) you can look at by typing decompile --help:
To get rid of many of those errors I mentioned, you can modify the script so that when you are decompiling MS-DOS COM programs, you use the following command line:
This tells the decompiler to force the architecture to 16-bit real mode x86, use conventions and interrupt lists from the MS-DOS operating environment, and loads the COM program image at address 0C00:0100 with the AX register set to 0.
I will be making a new release 0.4.3.0 later in the week. In the meantime, if you have the time, would you consider adapting your decompiler scripts so that this command is executed when dealing with COM programs? Naturally, if the executable in question has a valid executable header, it should be enough to just write
decompile sample.exe
as before.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Some highlights:
. Added support for PS3 and System V ELF files.
. For fun: a C64 BASIC "decompiler"! Give it a D64 Commodore disk image, navigate to a program, and load it. It will translate the BASIC instructions into intermediate code, and then generates pseudo-C from it.
. Fixed the following submitted bugs
- Can not load ELF or Amiga Hunk binaries
- Can not run the decompiler from the command line
. Implemented more x86 and PowerPC instructions
. Improvements in SSA transformation code in preparation for
move to new decompilation model
. ImageSegmentRenders allow viewing of the structured data
in image segments.
Thanks for the release. I wrote a small script to summarize the problems
the code has with the various subjects. I'm not sure about the .net
exception format so it may be wrong a little bit.
Hope this helps.
Regards,
Raimar
Last edit: Raimar 'second' Falke 2015-05-04
Thanks for the script Raimar, it will prove handy.
I did some analysis of the programs that were causing the errors. It turns out that a large percentage of the programs that cause the "The program's Architecture property..." error message are the MS-DOS COM programs in the subdirectory from_pouet. Because a COM program has no identifiable executable magic number or header, like say EXE or ELF files, the Decompiler needs some additional hints in order to know what to do with it. As Decompiler targets many processor architectures, it can't simply blindly assume that a "header-less" file is an x86 COM file like some other decompilers do.
Today, I checked in some enhancements to the command-line interpreter. It now accepts a few options, which (once I've made a release) you can look at by typing
decompile --help
:To get rid of many of those errors I mentioned, you can modify the script so that when you are decompiling MS-DOS COM programs, you use the following command line:
This tells the decompiler to force the architecture to 16-bit real mode x86, use conventions and interrupt lists from the MS-DOS operating environment, and loads the COM program image at address 0C00:0100 with the AX register set to 0.
I will be making a new release 0.4.3.0 later in the week. In the meantime, if you have the time, would you consider adapting your decompiler scripts so that this command is executed when dealing with COM programs? Naturally, if the executable in question has a valid executable header, it should be enough to just write
as before.
Yes MS-DOS COM files are hard/impossible to detect. This is the reason holdec
has a command line option
--treat-unknown-files-as-ms-dos-com
which is a bit more user friendly compared to
--arch x86-real-16 --env ms-dos --base 0C00:0100 --reg ax:0