Development of a Decompiler for Verification and Analysis of an Intermediate Code in ANSI C Compiler

ANSI C 컴파일러에서 중간코드의 검증과 분석을 위한 역컴파일러의 개발

  • 김영근 (서경대학교 컴퓨터공학과) ;
  • 권혁주 (서경대학교 컴퓨터공학과) ;
  • 이양선 (서경대학교 컴퓨터공학과)
  • Published : 2007.03.30

Abstract

Mounted on mobile device, set-top box, or digital TV, EVM is a virtual machine solution that can download and execute dynamic application programs. And the SIL(Standard Intermediate Language) is intermediate language of the EVM, which has a set of opcodes for object-oriented language and a sequential language. Since the C compiler used on each platform depends on the hardware, it converts C program to objective code, and then executes. To solve this problem, our research team developed ANSI C compiler and the EVM. Our ANSI C compiler outputs the SIL code based on stack machine. This paper presents the SIL-to-C decompiler in which converts the SIL code to three address code. Thus, the decompiler allows us to verify SIL code created by ANSI C compiler, and analyze a program from C language source level.

EVM(Embedded Virtual Machine)은 모바일 디바이스, 셋톱박스, 디지털 TV에 탑재되어 하드웨어에 독립적으로 수행되는 스택기반 가상기계이며, SIL(Standard Intermediate Language)은 EVM의 중간언어로 객체지향 언어와 순차적인 언어를 위한 연산 코드 집합을 갖고 있다. 기존에는 C 프로그램을 실행하기위해 플랫폼에 의존적인 목적코드로 변환하여 실행하였다. 이런 문제를 해결하기 위해 본 연구팀은 EVM을 개발하면서 목적기계의 코드가 아닌 플랫폼에 독립적인 스택기반의 SIL 코드를 생성하는 ANSI C 컴파일러를 개발하였다. 본 논문에서는 ANSI C 컴파일러가 생성한 SIL 코드를 3-주소 코드 형태의 재 표현된 ANSI C 프로그램으로 변환하는 SIL-to-C 역컴파일러(Decompiler) 시스템을 설계하고 구현하였다. 이와 같은 작업은 ANSI C 컴파일러가 생성한 SIL 코드가 올바른지를 확인할 수 있는 검증 방법을 제시하며, 소프트웨어 오작동 및 버전 호환이 이루어지지 않을 때 소프트웨어의 구조를 변경하고 수정하여 성능을 개선하는 작업을 용이하게 한다.

Keywords