ROSE  0.11.145.0
Rose/BinaryAnalysis/Disassembler/Exception.h
1 #ifndef ROSE_BinaryAnalysis_Disassembler_Exception_H
2 #define ROSE_BinaryAnalysis_Disassembler_Exception_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
5 
6 #include <Rose/Exception.h>
7 #include <ostream>
8 #include <string>
9 
10 namespace Rose {
11 namespace BinaryAnalysis {
12 namespace Disassembler {
13 
15 class Exception: public Rose::Exception {
16 public:
18  Exception(const std::string &reason)
19  : Rose::Exception(reason), ip(0), bit(0), insn(NULL)
20  {}
21 
23  Exception(const std::string &reason, rose_addr_t ip)
24  : Rose::Exception(reason), ip(ip), bit(0), insn(NULL)
25  {}
26 
28  Exception(const std::string &reason, rose_addr_t ip, const SgUnsignedCharList &raw_data, size_t bit)
29  : Rose::Exception(reason), ip(ip), bytes(raw_data), bit(bit), insn(NULL)
30  {}
31 
33  Exception(const std::string &reason, SgAsmInstruction *insn)
34  : Rose::Exception(reason), ip(insn->get_address()), bit(0), insn(insn)
35  {}
36 
37  ~Exception() throw() {}
38 
39  void print(std::ostream&) const;
40  friend std::ostream& operator<<(std::ostream &o, const Exception &e);
41 
42  rose_addr_t ip;
43  SgUnsignedCharList bytes;
46  size_t bit;
49 };
50 
51 } // namespace
52 } // namespace
53 } // namespace
54 #endif
55 #endif
rose_addr_t ip
Virtual address where failure occurred; zero if no associated instruction.
Base class for machine instructions.
size_t bit
Bit offset in instruction byte sequence where disassembly failed (bit/8 is the index into the "bytes"...
SgAsmInstruction * insn
Instruction associated with an assembly error.
Main namespace for the ROSE library.
Exception(const std::string &reason, SgAsmInstruction *insn)
An exception bound to a particular instruction being assembled.
Exception(const std::string &reason, rose_addr_t ip, const SgUnsignedCharList &raw_data, size_t bit)
An exception bound to a particular instruction being disassembled.
Exception(const std::string &reason)
A bare exception not bound to any particular instruction.
Exception(const std::string &reason, rose_addr_t ip)
An exception bound to a virtual address but no raw data or instruction.
SgUnsignedCharList bytes
Bytes (partial) of failed disassembly, including byte at failure.
Base class for all ROSE exceptions.
Definition: Rose/Exception.h:9