mirror of
https://github.com/open-goal/jak-project
synced 2026-05-23 06:54:31 -04:00
[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:
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user