Decompiler Design - Advanced Topics


  Beginners
  Introduction
  Forward tools
  Reverse tools
  Simple decompiler
  Problems
 
  Intermediate
  Architecture
  Object formats
  Code vs. data
  Basic blocks
  Control flow graph
  Loops
  Statements
  Data Flow
  Expression propagation
  The stack
  Stack frames
  Frameless Functions
  Saved Registers
  Recovering Types
 
  Advanced
  Advanced topics
  Switch statements
  Code vs. Data 2
  Call Optimizations
 

Prev: Recovering Types


Advanced Topics

In the Beginner and in the Intermediate sections we have considered the basic algorithms that make up a standard decompiler.

In this Advanced section we re-examine some of the topics with a focus on decompiling real-world random programs.

Major problems not yet covered

In the Intermediate section we have considered how to decompile some basic sequences of isolated code, without considering some of the most difficult problems. Here we look at some of these problems. They are:

  • switch statements
  • indirect jumps
  • indirect calls
  • tail-call optimization
  • stack deallocation coalescing
  • passing parameters in registers
  • inlining
  • call-return optimizations
  • register uncoloring
  • alloca() and setjmp/longjmp
  • C++ constructs
  • other languages

We'll consider these problems and propose a solution, with the understanding that there may not be a solution or that some user intervention may be required, since not all of these can be solved in a purely automatic way.



Next: Switch Statements © 2009 Giampiero Caprino, Backer Street Software