1*f22f0ef4Schristos /* Copyright (C) 2021 Free Software Foundation, Inc. 2*f22f0ef4Schristos Contributed by Oracle. 3*f22f0ef4Schristos 4*f22f0ef4Schristos This file is part of GNU Binutils. 5*f22f0ef4Schristos 6*f22f0ef4Schristos This program is free software; you can redistribute it and/or modify 7*f22f0ef4Schristos it under the terms of the GNU General Public License as published by 8*f22f0ef4Schristos the Free Software Foundation; either version 3, or (at your option) 9*f22f0ef4Schristos any later version. 10*f22f0ef4Schristos 11*f22f0ef4Schristos This program is distributed in the hope that it will be useful, 12*f22f0ef4Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 13*f22f0ef4Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*f22f0ef4Schristos GNU General Public License for more details. 15*f22f0ef4Schristos 16*f22f0ef4Schristos You should have received a copy of the GNU General Public License 17*f22f0ef4Schristos along with this program; if not, write to the Free Software 18*f22f0ef4Schristos Foundation, 51 Franklin Street - Fifth Floor, Boston, 19*f22f0ef4Schristos MA 02110-1301, USA. */ 20*f22f0ef4Schristos 21*f22f0ef4Schristos #ifndef _DISASM_H 22*f22f0ef4Schristos #define _DISASM_H 23*f22f0ef4Schristos 24*f22f0ef4Schristos #include "disassemble.h" 25*f22f0ef4Schristos 26*f22f0ef4Schristos class Data_window; 27*f22f0ef4Schristos class Stabs; 28*f22f0ef4Schristos class StringBuilder; 29*f22f0ef4Schristos enum Platform_t; 30*f22f0ef4Schristos 31*f22f0ef4Schristos class Disasm 32*f22f0ef4Schristos { 33*f22f0ef4Schristos public: 34*f22f0ef4Schristos Disasm (char *fname); 35*f22f0ef4Schristos Disasm (Platform_t _platform, Stabs *_stabs); 36*f22f0ef4Schristos ~Disasm (); 37*f22f0ef4Schristos void remove_disasm_hndl (void *hndl); 38*f22f0ef4Schristos void *get_disasm_hndl (uint64_t vaddr, uint64_t f_offset, size_t size); 39*f22f0ef4Schristos int get_instr_size (uint64_t vaddr, void *hndl); 40*f22f0ef4Schristos void set_addr_end (uint64_t end_address); 41*f22f0ef4Schristos 42*f22f0ef4Schristos void set_hex_visible(int set)43*f22f0ef4Schristos set_hex_visible (int set) 44*f22f0ef4Schristos { 45*f22f0ef4Schristos hex_visible = set; 46*f22f0ef4Schristos } 47*f22f0ef4Schristos 48*f22f0ef4Schristos char *get_disasm (uint64_t inst_address, uint64_t end_address, 49*f22f0ef4Schristos uint64_t start_address, uint64_t f_offset, int64_t &inst_size); 50*f22f0ef4Schristos void set_img_name (char *fname); // Only for dynfunc 51*f22f0ef4Schristos 52*f22f0ef4Schristos StringBuilder *dis_str; 53*f22f0ef4Schristos 54*f22f0ef4Schristos private: 55*f22f0ef4Schristos void disasm_open (); 56*f22f0ef4Schristos 57*f22f0ef4Schristos disassemble_info dis_info; 58*f22f0ef4Schristos Data_window *dwin; 59*f22f0ef4Schristos Stabs *stabs, *my_stabs; 60*f22f0ef4Schristos Platform_t platform; 61*f22f0ef4Schristos char addr_fmt[32]; 62*f22f0ef4Schristos int hex_visible; 63*f22f0ef4Schristos bool need_swap_endian; 64*f22f0ef4Schristos }; 65*f22f0ef4Schristos 66*f22f0ef4Schristos #endif /* _DISASM_H */ 67