[Compiler] Fix branch targets in disassembly (#379)

* fix diassembly

* update changelog

* fix exit crash

* doc
This commit is contained in:
water111
2021-04-23 15:07:22 -04:00
committed by GitHub
parent 060b125324
commit 0b8a878533
6 changed files with 28 additions and 18 deletions
+2 -12
View File
@@ -1,5 +1,4 @@
#include <utility>
#include <vector>
#include "DebugInfo.h"
#include "third-party/fmt/core.h"
@@ -7,17 +6,8 @@ DebugInfo::DebugInfo(std::string obj_name) : m_obj_name(std::move(obj_name)) {}
std::string FunctionDebugInfo::disassemble_debug_info(bool* had_failure) {
std::string result = fmt::format("[{}]\n", name);
std::vector<u8> data;
u8 temp[128];
for (const auto& x : instructions) {
auto count = x.instruction.emit(temp);
for (int i = 0; i < count; i++) {
data.push_back(temp[i]);
}
}
result += disassemble_x86_function(data.data(), data.size(), 0x10000, 0x10000, instructions, irs,
had_failure);
result += disassemble_x86_function(generated_code.data(), generated_code.size(), 0x10000, 0x10000,
instructions, irs, had_failure);
return result;
}