[goalc] Address-to-line (#783)

* refactor debug info stuff before adding form to emit

* source mapping working for non-macro sourced forms

* support macros
This commit is contained in:
water111
2021-08-26 20:33:00 -04:00
committed by GitHub
parent 7a5562106e
commit 24fe2c78c0
32 changed files with 772 additions and 677 deletions
+10 -7
View File
@@ -4,27 +4,30 @@
DebugInfo::DebugInfo(std::string obj_name) : m_obj_name(std::move(obj_name)) {}
std::string FunctionDebugInfo::disassemble_debug_info(bool* had_failure) {
std::string FunctionDebugInfo::disassemble_debug_info(bool* had_failure,
const goos::Reader* reader) {
std::string result = fmt::format("[{}]\n", name);
result += disassemble_x86_function(generated_code.data(), generated_code.size(), 0x10000, 0x10000,
instructions, irs, had_failure);
result += disassemble_x86_function(generated_code.data(), generated_code.size(), reader, 0x10000,
0x10000, instructions, function.get(), had_failure);
return result;
}
std::string DebugInfo::disassemble_all_functions(bool* had_failure) {
std::string DebugInfo::disassemble_all_functions(bool* had_failure, const goos::Reader* reader) {
std::string result;
for (auto& kv : m_functions) {
result += kv.second.disassemble_debug_info(had_failure) + "\n\n";
result += kv.second.disassemble_debug_info(had_failure, reader) + "\n\n";
}
return result;
}
std::string DebugInfo::disassemble_function_by_name(const std::string& name, bool* had_failure) {
std::string DebugInfo::disassemble_function_by_name(const std::string& name,
bool* had_failure,
const goos::Reader* reader) {
std::string result;
for (auto& kv : m_functions) {
if (kv.second.name == name) {
result += kv.second.disassemble_debug_info(had_failure) + "\n\n";
result += kv.second.disassemble_debug_info(had_failure, reader) + "\n\n";
}
}
return result;