1 #ifndef ROSE_BinaryAnalysis_Assembler_H
2 #define ROSE_BinaryAnalysis_Assembler_H
4 #include <featureTests.h>
5 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
7 #include <Rose/Exception.h>
10 namespace BinaryAnalysis {
71 void print(std::ostream&)
const;
72 friend std::ostream& operator<<(std::ostream&,
const Exception&);
93 virtual ~Assembler() {}
118 SgUnsignedCharList
assembleBlock(
const std::vector<SgAsmInstruction*> &insns, rose_addr_t starting_rva);
121 virtual SgUnsignedCharList
assembleProgram(
const std::string &source) = 0;
virtual SgUnsignedCharList assembleProgram(const std::string &source)=0
Assembles a program from an assembly listing.
FILE * get_debug() const
Returns the file currently used for debugging; null implies no debugging.
virtual SgUnsignedCharList assembleOne(SgAsmInstruction *insn)=0
This is the lowest level architecture-independent assembly function and is implemented in the archite...
Returns the shortest possible encoding.
SgUnsignedCharList assembleBlock(SgAsmBlock *)
Assembles a single basic block of instructions, packing them together and adjusting their virtual add...
Exception(const std::string &reason, SgAsmInstruction *insn)
An exception bound to a particular instruction being assembled.
Base class for machine instructions.
EncodingType p_encoding_type
Which encoding should be returned by assembleOne.
Main namespace for the ROSE library.
EncodingType get_encoding_type() const
Returns the encoding type employed by this assembler.
static Assembler * create(SgAsmInterpretation *interp)
Creates an assembler that is appropriate for assembling instructions in the specified interpretation...
Returns an encoding that matches the SgAsmInstruction::p_raw_bytes.
Returns the longest encoding.
FILE * p_debug
Set to non-null to get debugging info.
void set_debug(FILE *f)
Sends assembler diagnostics to the specified output stream.
EncodingType
Assemblers can often assemble a single instruction various ways.
SgAsmInstruction * insn
Instruction associated with an assembly error.
Exception thrown by the assemblers.
Exception(const std::string &reason)
An exception not bound to a particular instruction.
Base class for all ROSE exceptions.
Represents an interpretation of a binary container.
void set_encoding_type(EncodingType et)
Controls how the assembleOne() method determines which encoding to return.
Virtual base class for instruction assemblers.