ROSE 0.11.145.147
ByteCode/Cil.h
1#ifndef ROSE_BinaryAnalysis_ByteCode_Cil_H
2#define ROSE_BinaryAnalysis_ByteCode_Cil_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5
6#include <Rose/BinaryAnalysis/ByteCode/Analysis.h>
7
13
14namespace Rose {
15namespace BinaryAnalysis {
16namespace ByteCode {
17
18class CilCode final : public Code {
19public:
20 virtual const uint8_t* bytes() const {
21 return bytes_; // UNIMPLEMENTED
22 }
23 virtual size_t size() const {
24 return size_; // UNIMPLEMENTED
25 }
26 virtual rose_addr_t offset() const {
27 return offset_; // UNIMPLEMENTED
28 }
29
30 explicit CilCode(uint8_t* bytes, size_t size, rose_addr_t offset)
31 : bytes_{bytes}, size_{size}, offset_{offset} {
32 }
33
34private:
35 const uint8_t* bytes_;
36 size_t size_;
37 rose_addr_t offset_;
38};
39
40class CilField final : public Field {
41public:
42 virtual std::string name() const {
43 return "CilField::name():UNIMPLEMENTED";
44 }
45
46 CilField() = delete;
47
48private:
49};
50
51class CilMethod final : public Method {
52public:
53 virtual std::string name() const override;
54 virtual bool isSystemReserved(const std::string &name) const override;
55
56 virtual const Code & code() const override;
57 virtual const SgAsmInstructionList* instructions() const override;
58 virtual void decode(const Disassembler::BasePtr &disassembler) const override;
59
60 virtual void annotate() override;
61
62 CilMethod() = delete;
63 explicit CilMethod(SgAsmCilMetadataRoot*, SgAsmCilMethodDef*, rose_addr_t);
64
65private:
67 SgAsmCilMethodDef* sgMethod_;
69 CilCode code_;
70};
71
72class CilInterface final : public Interface {
73public:
74 virtual std::string name() const {
75 return "CilInterface::name():UNIMPLEMENTED";
76 }
77
78 CilInterface() = delete;
79
80private:
81};
82
83class CilAttribute final : public Attribute {
84public:
85 virtual std::string name() const {
86 return "CilAttribute::name():UNIMPLEMENTED";
87 }
88
89 CilAttribute() = delete;
90
91private:
92};
93
94class CilClass final : public Class {
95public:
96 virtual std::string name() const {
97 return name_;
98 }
99 virtual std::string super_name() const {
100 return "CilClass::super_name():UNIMPLEMENTED";
101 }
102 virtual std::string typeSeparator() const {
103 return ".";
104 }
105
106 virtual const std::vector<std::string> &strings() {
107 return strings_;
108 }
109 virtual const std::vector<const Interface*> &interfaces() const {
110 return interfaces_;
111 }
112 virtual const std::vector<const Field*> &fields() const {
113 return fields_;
114 }
115 virtual const std::vector<const Method*> &methods() const {
116 return methods_;
117 }
118 virtual const std::vector<const Attribute*> &attributes() const {
119 return attributes_;
120 }
121
122 virtual void dump();
123
124 static std::string objectName(const SgAsmCilMetadata*, SgAsmCilMetadataRoot*);
125
126 CilClass() = delete;
127 explicit CilClass(std::shared_ptr<Namespace> ns, SgAsmCilMetadataRoot*, const std::string &, size_t, size_t);
128
129private:
130 std::vector<const Field*> fields_;
131 std::vector<const Method*> methods_;
132 std::vector<const Attribute*> attributes_;
133 std::vector<const Interface*> interfaces_;
134 std::vector<std::string> strings_;
135 std::string name_;
137 //WARNING: not used yet!
138 //SgAsmCilTypeDef* sgCilTypeDef_;
139};
140
141class CilNamespace final : public Namespace {
142public:
143 virtual std::string name() const;
144
145 CilNamespace() = delete;
146 explicit CilNamespace(SgAsmCilMetadataRoot*, const std::string &);
147
148private:
149 //WARNING: not used yet!
150 //SgAsmCilMetadataRoot* mdr_;
151 std::string name_;
152};
153
154class CilContainer final : public Container {
155public:
156 virtual std::string name() const override;
157 virtual bool isSystemReserved(const std::string &name) const override;
158 static bool isCilSystemReserved(const std::string &name);
159
160 void printAssemblies(std::ostream& os) const;
161 void printMethods(std::ostream& os, size_t beg, size_t lim) const;
162 void printModules(std::ostream& os) const;
163 void printTypeDefs(std::ostream& os) const;
164
166
167 CilContainer() = delete;
169
170private:
172};
173
174} // namespace
175} // namespace
176} // namespace
177
178#endif
179#endif
CIL SgAsmCilMetadataRoot.
Base class for CIL branch of binary analysis IR nodes.
CIL MethodDef node (II.22.26).
List of SgAsmInstruction nodes.
Base class for integer values.
The ROSE library.