逆アセンブル

某会社では私が来るまでSubversionCVSなどのソースコード管理をしていなかった。ファイルサーバー上のフォルダなどに日付を付けて管理という旧石器時代のような管理方法だった。現在は私がSubversionサーバーをたて、各自のマシンにローカルなテスト環境、ビルドサーバーなどをセットアップしたのでかなりマシになった。

そんなある日、現行システムの一部のプログラムの機能追加の依頼が来たので、ソースを探してみると、無い。
しょうがないので、逆アセンブルしてみたときのメモ。

  • objdump
Usage: objdump <option(s)> <file(s)>
 Display information from object <file(s)>.
 At least one of the following switches must be given:
  -a, --archive-headers    Display archive header information
  -f, --file-headers       Display the contents of the overall file header
  -p, --private-headers    Display object format specific file header contents
  -h, --[section-]headers  Display the contents of the section headers
  -x, --all-headers        Display the contents of all headers
  -d, --disassemble        Display assembler contents of executable sections
  -D, --disassemble-all    Display assembler contents of all sections
  -S, --source             Intermix source code with disassembly
  -s, --full-contents      Display the full contents of all sections requested
  -g, --debugging          Display debug information in object file
  -G, --stabs              Display (in raw form) any STABS info in the file
  -t, --syms               Display the contents of the symbol table(s)
  -T, --dynamic-syms       Display the contents of the dynamic symbol table
  -r, --reloc              Display the relocation entries in the file
  -R, --dynamic-reloc      Display the dynamic relocation entries in the file
  -v, --version            Display this program's version number
  -i, --info               List object formats and architectures supported
  -H, --help               Display this information

nm という似たようなコマンドもある。