]> git.siccegge.de Git - frida/frida.git/blob - src/core/BasicBlock.hxx
b3e5a89d819cfbd74c5b375919eba6dcccd7e09a
[frida/frida.git] / src / core / BasicBlock.hxx
1 #ifndef INCLUDE__BasicBlock_hxx
2 #define INCLUDE__BasicBlock_hxx
3
4 #include <cassert>
5 #include <string>
6 #include <sstream>
7
8 class BasicBlock {
9 public:
10 BasicBlock() {
11 next_blocks[0] = 0;
12 next_blocks[1] = 0;
13 }
14
15 uint64_t getStartAddress() const {
16 return start_address;
17 }
18
19 uint64_t getEndAddress() const {
20 return end_address;
21 }
22
23 uint64_t getNextBlock(size_t index) const {
24 assert(index < 2);
25 return next_blocks[index];
26 }
27
28 void setNextBlock(size_t index, uint64_t address) {
29 assert(index < 2);
30 next_blocks[index] = address;
31 }
32
33 void setStartAddress(uint64_t address) {
34 start_address = address;
35 }
36
37 void setEndAddress(uint64_t address) {
38 end_address = address;
39 }
40
41 std::string getName() {
42 std::stringstream s;
43 s << "BLOCK_" << std::hex << start_address << '_' << end_address;
44 return s.str();
45 }
46
47 private:
48 uint64_t start_address;
49 uint64_t end_address;
50
51 uint64_t next_blocks[2];
52 };
53
54 #endif