[Decompiler] Clean up the output (#245)

* fix parent issue

* fix compiler issue

* update

* add error messages

* fix error

* fix array access, temporary

* more clean

* fix

* rename arg variables better

* fix method name

* fix no return value in decompiler

* many small fixes

* cheat types so it works

* name map

* fix old test'
This commit is contained in:
water111
2021-02-09 20:59:14 -05:00
committed by GitHub
parent fa061ef7eb
commit 6e0ff4c9d0
55 changed files with 2042 additions and 595 deletions
@@ -100,6 +100,21 @@ Function& LinkedObjectFile::get_function_at_label(int label_id) {
return functions_by_seg.front().front(); // to avoid error
}
/*!
* Get the function starting at this label, or nullptr if there is none.
*/
const Function* LinkedObjectFile::try_get_function_at_label(int label_id) const {
auto& label = labels.at(label_id);
for (auto& func : functions_by_seg.at(label.target_segment)) {
// + 4 to skip past type tag to the first word, which is were the label points.
if (func.start_word * 4 + 4 == label.offset) {
return &func;
}
}
return nullptr;
}
/*!
* Get the name of the label.
*/