#include <debug_info.hpp>
Definition at line 22 of file debug_info.hpp.
◆ profile_instr_map() [1/4]
sysio::vm::profile_instr_map::profile_instr_map |
( |
| ) |
|
|
default |
◆ profile_instr_map() [2/4]
◆ profile_instr_map() [3/4]
sysio::vm::profile_instr_map::profile_instr_map |
( |
| ) |
|
|
default |
◆ profile_instr_map() [4/4]
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ relocate() [1/2]
void sysio::vm::profile_instr_map::relocate |
( |
const void * | new_base | ) |
|
|
inline |
◆ relocate() [2/2]
void sysio::vm::profile_instr_map::relocate |
( |
const void * | new_base | ) |
|
|
inline |
◆ set() [1/2]
void sysio::vm::profile_instr_map::set |
( |
builder && | b | ) |
|
|
inline |
Definition at line 57 of file debug_info.hpp.
57 {
58 data = std::move(b.data);
59 std::sort(data.begin(), data.end(), [](const addr_entry& lhs, const addr_entry& rhs){ return lhs.offset < rhs.offset; });
60 base_address = b.code_base;
61 code_size = reinterpret_cast<const char*>(b.code_end) - reinterpret_cast<const char*>(base_address);
62 offset_to_addr = data.data();
63 offset_to_addr_len = data.size();
64 }
◆ set() [2/2]
void sysio::vm::profile_instr_map::set |
( |
builder && | b | ) |
|
|
inline |
Definition at line 57 of file debug_info.hpp.
57 {
58 data = std::move(b.data);
59 std::sort(data.begin(), data.end(), [](const addr_entry& lhs, const addr_entry& rhs){ return lhs.offset < rhs.offset; });
60 base_address = b.code_base;
61 code_size = reinterpret_cast<const char*>(b.code_end) - reinterpret_cast<const char*>(base_address);
62 offset_to_addr = data.data();
63 offset_to_addr_len = data.size();
64 }
◆ translate() [1/2]
std::uint32_t sysio::vm::profile_instr_map::translate |
( |
const void * | pc | ) |
const |
|
inline |
Definition at line 74 of file debug_info.hpp.
74 {
75 std::size_t
diff = (
reinterpret_cast<const char*
>(pc) -
reinterpret_cast<const char*
>(base_address));
76 if(
diff >= code_size ||
diff < offset_to_addr[0].offset)
return 0xFFFFFFFFu;
77 std::uint32_t offset =
diff;
78
79
80 std::size_t lower = 0, upper = offset_to_addr_len;
81 while(upper - lower > 1) {
82 std::size_t mid = lower + (upper - lower) / 2;
83 if(offset_to_addr[mid].offset <= offset) {
84 lower = mid;
85 } else {
86 upper = mid;
87 }
88 }
89
90 return offset_to_addr[lower].wasm_addr;
91 }
void diff(const std::string &a, const std::string &b)
◆ translate() [2/2]
std::uint32_t sysio::vm::profile_instr_map::translate |
( |
const void * | pc | ) |
const |
|
inline |
Definition at line 74 of file debug_info.hpp.
74 {
75 std::size_t
diff = (
reinterpret_cast<const char*
>(pc) -
reinterpret_cast<const char*
>(base_address));
76 if(
diff >= code_size ||
diff < offset_to_addr[0].offset)
return 0xFFFFFFFFu;
77 std::uint32_t offset =
diff;
78
79
80 std::size_t lower = 0, upper = offset_to_addr_len;
81 while(upper - lower > 1) {
82 std::size_t mid = lower + (upper - lower) / 2;
83 if(offset_to_addr[mid].offset <= offset) {
84 lower = mid;
85 } else {
86 upper = mid;
87 }
88 }
89
90 return offset_to_addr[lower].wasm_addr;
91 }
The documentation for this class was generated from the following files: