[decompiler] handle pointer to symbol value, clean up prints on offline test (#1978)

- fix issue described in
https://github.com/open-goal/jak-project/issues/1939
- fix `text`, which was manually patched with the wrong offset (was
reading the symbol value off by one byte)
- clean up some random useless prints
- make the offline tests keep trying if there's a comparison error,
clean up the output a bit so the diffs are all at the end.
This commit is contained in:
water111
2022-10-16 18:19:59 -04:00
committed by GitHub
parent e7bb0fb68d
commit ddd60fca48
21 changed files with 291 additions and 509 deletions
+8 -2
View File
@@ -189,11 +189,14 @@ void LinkedObjectFile::symbol_link_word(int source_segment,
* Add link information that a word's lower 16 bits are the offset of the given symbol relative to
* the symbol table register.
*/
void LinkedObjectFile::symbol_link_offset(int source_segment, int source_offset, const char* name) {
void LinkedObjectFile::symbol_link_offset(int source_segment,
int source_offset,
const char* name,
bool subtract_one) {
ASSERT((source_offset % 4) == 0);
auto& word = words_by_seg.at(source_segment).at(source_offset / 4);
ASSERT(word.kind() == LinkedWord::PLAIN_DATA);
word.set_to_symbol(LinkedWord::SYM_OFFSET, name);
word.set_to_symbol(subtract_one ? LinkedWord::SYM_VAL_OFFSET : LinkedWord::SYM_OFFSET, name);
}
/*!
@@ -312,6 +315,9 @@ void LinkedObjectFile::append_word_to_string(std::string& dest, const LinkedWord
case LinkedWord::SYM_OFFSET:
sprintf(buff, " .sym-off 0x%x %s\n", word.data >> 16, word.symbol_name().c_str());
break;
case LinkedWord::SYM_VAL_OFFSET:
sprintf(buff, " .sym-val-off 0x%x %s\n", word.data >> 16, word.symbol_name().c_str());
break;
default:
throw std::runtime_error("nyi");
}