Clean up some errors/crashes in decompiler (#452)

* fix offline tests, clean up some warnings

* clean up warnings during decomp

* fix remaining crash issues
This commit is contained in:
water111
2021-05-11 16:43:13 -04:00
committed by GitHub
parent 1d72e79df8
commit 433993074a
18 changed files with 194 additions and 113 deletions
+3 -3
View File
@@ -183,6 +183,7 @@ void ObjectFileDB::ir2_basic_block_pass() {
total_functions++;
func.ir2.env.file = &data.linked_data;
func.ir2.env.dts = &dts;
func.ir2.env.func = &func;
// first, find basic blocks.
auto blocks = find_blocks_in_function(data.linked_data, segment_id, func);
@@ -206,14 +207,12 @@ void ObjectFileDB::ir2_basic_block_pass() {
// run analysis
// build a control flow graph, just looking at branch instructions.
// if (func.guessed_name.to_string() == "abs") {
func.cfg = build_cfg(data.linked_data, segment_id, func);
if (!func.cfg->is_fully_resolved()) {
lg::warn("Function {} from {} failed to build control flow graph!",
func.guessed_name.to_string(), data.to_unique_name());
failed_to_build_cfg++;
}
// }
// if we got an inspect method, inspect it.
if (func.is_inspect_method) {
@@ -317,7 +316,8 @@ void ObjectFileDB::ir2_type_analysis_pass() {
if (!func.suspected_asm) {
non_asm_functions++;
TypeSpec ts;
if (lookup_function_type(func.guessed_name, data.to_unique_name(), &ts)) {
if (lookup_function_type(func.guessed_name, data.to_unique_name(), &ts) &&
func.ir2.atomic_ops_succeeded) {
func.type = ts;
attempted_functions++;
// try type analysis here.