/* ### * IP: GHIDRA * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Interface to the decompilation routines #ifndef __IFACE_DECOMP__ #define __IFACE_DECOMP__ #include "ifaceterm.hh" #include "graph.hh" #include "grammar.hh" #include "callgraph.hh" #include "paramid.hh" #ifdef CPUI_RULECOMPILE #include "rulecompile.hh" #endif class IfaceDecompCapability : public IfaceCapability { static IfaceDecompCapability ifaceDecompCapability; // Singleton instance IfaceDecompCapability(void); // Singleton IfaceDecompCapability(const IfaceDecompCapability &op2); // Not implemented IfaceDecompCapability &operator=(const IfaceDecompCapability &op2); // Not implemented public: virtual void registerCommands(IfaceStatus *status); }; class IfaceDecompData : public IfaceData { public: Funcdata *fd; // Current function data Architecture *conf; CallGraph *cgraph; map prototypePieces; void storePrototypePieces( Funcdata *fd_in, PrototypePieces pp_in ) { prototypePieces.insert(pair(fd_in,pp_in)); } PrototypePieces findPrototypePieces( Funcdata *fd_in ) { return (*prototypePieces.find(fd_in)).second; } #ifdef CPUI_RULECOMPILE string experimental_file; // File containing experimental rules #endif #ifdef OPACTION_DEBUG bool jumptabledebug; #endif IfaceDecompData(void); virtual ~IfaceDecompData(void); void abortFunction(ostream &s); void clearArchitecture(void); }; class IfaceAssemblyEmit : public AssemblyEmit { int4 mnemonicpad; // How much to pad the mnemonic ostream *s; public: IfaceAssemblyEmit(ostream *val,int4 mp) { s = val; mnemonicpad=mp; } virtual void dump(const Address &addr,const string &mnem,const string &body) { addr.printRaw(*s); *s << ": " << mnem; for(int4 i=mnem.size();i