mirror of
https://github.com/encounter/objdiff.git
synced 2025-12-10 05:57:42 +00:00
Instruction hover / context menu improvements
This commit is contained in:
@@ -49,6 +49,7 @@ impl ObjArch for ObjArchMips {
|
||||
let code = self.endianness.read_u32_bytes(chunk.try_into()?);
|
||||
let instruction = Instruction::new(code, cur_addr, InstrCategory::CPU);
|
||||
|
||||
let formatted = instruction.disassemble(None, 0);
|
||||
let op = instruction.unique_id as u16;
|
||||
ops.push(op);
|
||||
|
||||
@@ -123,6 +124,7 @@ impl ObjArch for ObjArchMips {
|
||||
reloc: reloc.cloned(),
|
||||
branch_dest,
|
||||
line,
|
||||
formatted,
|
||||
orig: None,
|
||||
});
|
||||
cur_addr += 4;
|
||||
|
||||
@@ -59,6 +59,7 @@ impl ObjArch for ObjArchPpc {
|
||||
|
||||
let orig = ins.basic().to_string();
|
||||
let simplified = ins.simplified();
|
||||
let formatted = simplified.to_string();
|
||||
|
||||
let mut reloc_arg = None;
|
||||
if let Some(reloc) = reloc {
|
||||
@@ -144,6 +145,7 @@ impl ObjArch for ObjArchPpc {
|
||||
op: ins.op as u16,
|
||||
branch_dest,
|
||||
line,
|
||||
formatted,
|
||||
orig: Some(orig),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ impl ObjArch for ObjArchX86 {
|
||||
reloc: None,
|
||||
branch_dest: None,
|
||||
line: None,
|
||||
formatted: String::new(),
|
||||
orig: None,
|
||||
},
|
||||
error: None,
|
||||
@@ -81,6 +82,7 @@ impl ObjArch for ObjArchX86 {
|
||||
reloc: reloc.cloned(),
|
||||
branch_dest: None,
|
||||
line: obj.line_info.as_ref().and_then(|m| m.get(&address).cloned()),
|
||||
formatted: String::new(),
|
||||
orig: None,
|
||||
};
|
||||
// Run the formatter, which will populate output.ins
|
||||
@@ -89,7 +91,7 @@ impl ObjArch for ObjArchX86 {
|
||||
return Err(error);
|
||||
}
|
||||
ensure!(output.ins_operands.len() == output.ins.args.len());
|
||||
output.ins.orig = Some(output.formatted.clone());
|
||||
output.ins.formatted.clone_from(&output.formatted);
|
||||
|
||||
// Make sure we've put the relocation somewhere in the instruction
|
||||
if reloc.is_some() && !output.ins.args.iter().any(|a| matches!(a, ObjInsArg::Reloc)) {
|
||||
|
||||
Reference in New Issue
Block a user