Files
jak-project/goalc/debugger/DebugInfo.cpp
T
water111 0b8a878533 [Compiler] Fix branch targets in disassembly (#379)
* fix diassembly

* update changelog

* fix exit crash

* doc
2021-04-23 15:07:22 -04:00

31 lines
983 B
C++

#include <utility>
#include "DebugInfo.h"
#include "third-party/fmt/core.h"
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);
result += disassemble_x86_function(generated_code.data(), generated_code.size(), 0x10000, 0x10000,
instructions, irs, had_failure);
return result;
}
std::string DebugInfo::disassemble_all_functions(bool* had_failure) {
std::string result;
for (auto& kv : m_functions) {
result += kv.second.disassemble_debug_info(had_failure) + "\n\n";
}
return result;
}
std::string DebugInfo::disassemble_function_by_name(const std::string& name, bool* had_failure) {
std::string result;
for (auto& kv : m_functions) {
if (kv.second.name == name) {
result += kv.second.disassemble_debug_info(had_failure) + "\n\n";
}
}
return result;
}