|
|
|
@ -30,9 +30,9 @@ std::vector<decomp::symbol_t> routine_t::decompose() {
|
|
|
|
|
relocs.push_back(comp::reloc_t(scn_reloc->virtual_address, sym_hash));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.push_back(
|
|
|
|
|
decomp::symbol_t(m_sym->name.to_string(m_img->get_strings()).data(),
|
|
|
|
|
m_sym->value, m_data, m_scn, relocs));
|
|
|
|
|
result.push_back(decomp::symbol_t(
|
|
|
|
|
m_sym->name.to_string(m_img->get_strings()).data(), m_sym->value,
|
|
|
|
|
m_data, m_scn, m_sym, relocs, decomp_type_t::none));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case instr_split: {
|
|
|
|
@ -86,12 +86,28 @@ std::vector<decomp::symbol_t> routine_t::decompose() {
|
|
|
|
|
relocs.push_back(comp::reloc_t(reloc_offset, sym_hash));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// add a reloc to the next instruction...
|
|
|
|
|
// note that the offset is ZERO... comp_t will understand that
|
|
|
|
|
// relocs with offset ZERO means the next instructions...
|
|
|
|
|
//
|
|
|
|
|
auto next_inst_sym =
|
|
|
|
|
std::string(m_sym->name.to_string(m_img->get_strings()))
|
|
|
|
|
.append("@")
|
|
|
|
|
.append(std::to_string(offset +
|
|
|
|
|
xed_decoded_inst_get_length(&instr)));
|
|
|
|
|
|
|
|
|
|
relocs.push_back(
|
|
|
|
|
comp::reloc_t(0, decomp::symbol_t::hash(next_inst_sym)));
|
|
|
|
|
|
|
|
|
|
// get the instructions bytes
|
|
|
|
|
//
|
|
|
|
|
std::vector<std::uint8_t> inst_bytes(
|
|
|
|
|
m_data.data() + offset,
|
|
|
|
|
m_data.data() + offset + xed_decoded_inst_get_length(&instr));
|
|
|
|
|
|
|
|
|
|
result.push_back(
|
|
|
|
|
decomp::symbol_t(new_sym_name, offset, inst_bytes, m_scn, relocs));
|
|
|
|
|
result.push_back(decomp::symbol_t(new_sym_name, offset, inst_bytes,
|
|
|
|
|
m_scn, m_sym, relocs,
|
|
|
|
|
decomp_type_t::instr_split));
|
|
|
|
|
|
|
|
|
|
// after creating the symbol and dealing with relocs then print the
|
|
|
|
|
// information we have concluded...
|
|
|
|
@ -106,6 +122,11 @@ std::vector<decomp::symbol_t> routine_t::decompose() {
|
|
|
|
|
xed_decoded_inst_zero_set_mode(&instr, &istate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// remove the relocation to the next symbol from the last instruction
|
|
|
|
|
//
|
|
|
|
|
auto last_inst = result.back();
|
|
|
|
|
auto last_inst_relocs = last_inst.relocs();
|
|
|
|
|
last_inst_relocs.erase(last_inst_relocs.end() - 1);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|