UnivesalDisassembler(2003)
|
00001 // decoder.h 00002 // 00003 // uda - universal disassembler 00004 // Date: 2003-05-04 00005 // 00006 // Copyright (c) 2002-2003 Ales Smrcka 00007 // 00008 // This program is licensed under GNU Library GPL. See the file COPYING. 00009 // 00010 // This module contains interface of class Decoder using for decoding a section 00011 // 00012 00013 #ifndef decoderH 00014 #define decoderH 00015 00016 #include "udaclasses.h" 00017 #include "shared.h" 00018 #include "instrset.h" 00019 #include "sections.h" 00020 00022 #define DA_INSTRUCTIONS 0x01 00023 00024 #define DA_NEW_LABELS 0x02 00025 00026 #define DA_WITH_LABELS 0x04 00027 00029 class DecoderException; 00030 00032 class DecoderException : public ::Exception { 00033 public: 00034 DecoderException(string s) : Exception(s) {} 00035 virtual ~DecoderException() {} 00036 virtual void Print() { cerr<<"Decoder error: "<<value<<endl; } 00037 }; 00038 00040 struct DecoderInfo { 00042 Section *section; 00044 BinaryFile *binfile; 00046 Address start; 00048 Address stop; 00050 unsigned size; 00052 bool print; 00054 bool address; 00056 bool hexdump; 00058 bool symbolic; 00060 bool onlyname; 00062 bool scanaddress; 00064 DecoderInfo(); 00065 DecoderInfo(const DecoderInfo &decinfo) { assign(decinfo); } 00066 DecoderInfo &operator =(const DecoderInfo &decinfo) { return assign(decinfo); } 00067 DecoderInfo &assign(const DecoderInfo &decinfo); 00068 }; 00069 00070 class Decoder { 00071 //prints line 00072 void print_line(Address addr, unsigned size, string &symbolic_instruction); 00073 //hexadecimal output of section 00074 void HexOut(); 00075 public: 00077 void Decode(); 00078 }; 00079 00080 00081 extern const char *StartingTable; 00083 extern Decoder decoder; 00084 extern DecoderInfo decinfo; 00085 00086 #endif