1*c42dbd0eSchristos /* Copyright (C) 2021 Free Software Foundation, Inc. 2*c42dbd0eSchristos Contributed by Oracle. 3*c42dbd0eSchristos 4*c42dbd0eSchristos This file is part of GNU Binutils. 5*c42dbd0eSchristos 6*c42dbd0eSchristos This program is free software; you can redistribute it and/or modify 7*c42dbd0eSchristos it under the terms of the GNU General Public License as published by 8*c42dbd0eSchristos the Free Software Foundation; either version 3, or (at your option) 9*c42dbd0eSchristos any later version. 10*c42dbd0eSchristos 11*c42dbd0eSchristos This program is distributed in the hope that it will be useful, 12*c42dbd0eSchristos but WITHOUT ANY WARRANTY; without even the implied warranty of 13*c42dbd0eSchristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*c42dbd0eSchristos GNU General Public License for more details. 15*c42dbd0eSchristos 16*c42dbd0eSchristos You should have received a copy of the GNU General Public License 17*c42dbd0eSchristos along with this program; if not, write to the Free Software 18*c42dbd0eSchristos Foundation, 51 Franklin Street - Fifth Floor, Boston, 19*c42dbd0eSchristos MA 02110-1301, USA. */ 20*c42dbd0eSchristos 21*c42dbd0eSchristos #ifndef _CLASSFILE_H 22*c42dbd0eSchristos #define _CLASSFILE_H 23*c42dbd0eSchristos 24*c42dbd0eSchristos #include "Module.h" 25*c42dbd0eSchristos 26*c42dbd0eSchristos class DataInputStream; 27*c42dbd0eSchristos class BinaryConstantPool; 28*c42dbd0eSchristos class JMethod; 29*c42dbd0eSchristos class StringBuilder; 30*c42dbd0eSchristos class ByteCodeInfo; 31*c42dbd0eSchristos 32*c42dbd0eSchristos class ClassFile : public Module 33*c42dbd0eSchristos { 34*c42dbd0eSchristos public: 35*c42dbd0eSchristos ClassFile (); 36*c42dbd0eSchristos virtual ~ClassFile (); 37*c42dbd0eSchristos virtual int readFile (); 38*c42dbd0eSchristos virtual char *get_disasm (uint64_t inst_address, uint64_t end_address, 39*c42dbd0eSchristos uint64_t start_address, uint64_t f_offset, 40*c42dbd0eSchristos int64_t &inst_size); 41*c42dbd0eSchristos static char *get_java_file_name (char *clname, bool classSuffix); 42*c42dbd0eSchristos 43*c42dbd0eSchristos private: 44*c42dbd0eSchristos 45*c42dbd0eSchristos void openFile (const char *fname); 46*c42dbd0eSchristos char *get_opc_name (int op); 47*c42dbd0eSchristos void readAttributes (int count); 48*c42dbd0eSchristos void printConstant (StringBuilder *sb, int index); 49*c42dbd0eSchristos long long printCodeSequence (StringBuilder *sb, uint64_t addr, DataInputStream *in); 50*c42dbd0eSchristos 51*c42dbd0eSchristos unsigned char *cf_buf; 52*c42dbd0eSchristos int64_t cf_bufsz; 53*c42dbd0eSchristos int blanksCnt; 54*c42dbd0eSchristos DataInputStream *input; 55*c42dbd0eSchristos BinaryConstantPool *bcpool; 56*c42dbd0eSchristos JMethod *cur_jmthd; 57*c42dbd0eSchristos char *class_name; 58*c42dbd0eSchristos char *class_filename; 59*c42dbd0eSchristos char *source_name; 60*c42dbd0eSchristos Vector<ByteCodeInfo *> *byteCodeInfo; 61*c42dbd0eSchristos }; 62*c42dbd0eSchristos 63*c42dbd0eSchristos #endif 64