Editing the Parsing Code

Prerequisites

JavaCC / JJTree
Download: https://javacc.dev.java.net/
JavaCC/JJTree converts an abstract syntax tree into source code that can parse and build Java objects based on the syntax tree.

DOC does not know how to disassemble x86 files. Instead, it expects the input to be disassembled beforehand. DOC supports files disassembled with either Objdump or OllyDbg, however I recommend you use OllyDbg since I've done a lot more testing using OllyDbg.

The process of creating the parsing code is as follows:

  1. Create an abstract syntax tree (AST) that describes the input language (two already exist: one for Ollydbg and one for Objdump).
  2. Feed the AST to JJTree.
  3. Feed the output of JJTree to JavaCC. JavaCC creates the classes used to parse the input.

To update the abstract syntax tree, you must edit the file src/ollydbgParser/x86.jjt. This file defines the structure of the input assembly file. For information on the syntax of this file, please visit the JJTree website.

Any time the x86.jjt file is modified, it must be processed by JJTree and JavaCC. To assist with this, I've created a batch file called makeparser.bat. Simpley run makeparser.bat (with the JJTree directory on the system path). To make things easier, add makeparser.bat to the Run External Tools menu in Eclipse.