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
+2 -4
View File
@@ -324,8 +324,6 @@ goos::Object decompile_structure(const TypeSpec& type,
// we can specify a more specific type.
auto got_type = TypeSpec(word.symbol_name);
if (ts.tc(actual_type, got_type)) {
lg::info("For type {}, got more specific type {}\n", actual_type.print(),
got_type.print());
actual_type = got_type;
if (actual_type == TypeSpec("string")) {
return decompile_string_at_label(label, words);
@@ -601,7 +599,7 @@ goos::Object decompile_value(const TypeSpec& type,
assert(bytes.size() == 4);
s32 value;
memcpy(&value, bytes.data(), 4);
if (value > 100 && value <= INT32_MAX) {
if (value > 100) {
return pretty_print::to_symbol(fmt::format("#x{:x}", value));
} else {
return pretty_print::to_symbol(fmt::format("{}", value));
@@ -615,7 +613,7 @@ goos::Object decompile_value(const TypeSpec& type,
assert(bytes.size() == 2);
s16 value;
memcpy(&value, bytes.data(), 2);
if (value > 100 && value <= INT16_MAX) {
if (value > 100) {
return pretty_print::to_symbol(fmt::format("#x{:x}", value));
} else {
return pretty_print::to_symbol(fmt::format("{}", value));