Update rabbitizer & utilize use_dollar option

This commit is contained in:
Luke Street 2025-03-04 09:38:59 -07:00
parent 3f157f33a5
commit 1cdfa1e857
2 changed files with 13 additions and 21 deletions

2
Cargo.lock generated
View File

@ -3897,7 +3897,7 @@ dependencies = [
[[package]] [[package]]
name = "rabbitizer" name = "rabbitizer"
version = "2.0.0-dev0" version = "2.0.0-dev0"
source = "git+https://github.com/Decompollaborate/rabbitizer.git?branch=🦀#706fd145b788ec3d068d55904dd112c7989e0412" source = "git+https://github.com/Decompollaborate/rabbitizer.git?branch=🦀#06dc8b6c826c3d60e112d4c2cd70aa54e308be12"
dependencies = [ dependencies = [
"bitflags 2.9.0", "bitflags 2.9.0",
] ]

View File

@ -144,9 +144,11 @@ impl ArchMips {
fn instruction_display_flags( fn instruction_display_flags(
&self, &self,
_diff_config: &DiffObjConfig, diff_config: &DiffObjConfig,
) -> rabbitizer::InstructionDisplayFlags { ) -> rabbitizer::InstructionDisplayFlags {
rabbitizer::InstructionDisplayFlags::default().with_unknown_instr_comment(false) rabbitizer::InstructionDisplayFlags::default()
.with_unknown_instr_comment(false)
.with_use_dollar(diff_config.mips_register_prefix)
} }
fn parse_ins_ref( fn parse_ins_ref(
@ -207,7 +209,6 @@ impl Arch for ArchMips {
function_range, function_range,
resolved.section_index, resolved.section_index,
&display_flags, &display_flags,
diff_config,
cb, cb,
)?; )?;
Ok(()) Ok(())
@ -301,7 +302,6 @@ fn push_args(
function_range: Range<u64>, function_range: Range<u64>,
section_index: usize, section_index: usize,
display_flags: &rabbitizer::InstructionDisplayFlags, display_flags: &rabbitizer::InstructionDisplayFlags,
diff_config: &DiffObjConfig,
mut arg_cb: impl FnMut(InstructionPart) -> Result<()>, mut arg_cb: impl FnMut(InstructionPart) -> Result<()>,
) -> Result<()> { ) -> Result<()> {
let operands = instruction.valued_operands_iter(); let operands = instruction.valued_operands_iter();
@ -361,14 +361,11 @@ fn push_args(
})))?; })))?;
} }
arg_cb(InstructionPart::basic("("))?; arg_cb(InstructionPart::basic("("))?;
let mut value = arg_cb(InstructionPart::opaque(base.either_name(
base.either_name(instruction.flags().abi(), display_flags.named_gpr()); instruction.flags().abi(),
if !diff_config.mips_register_prefix { display_flags.named_gpr(),
if let Some(trimmed) = value.strip_prefix('$') { !display_flags.use_dollar(),
value = trimmed; )))?;
}
}
arg_cb(InstructionPart::opaque(value))?;
arg_cb(InstructionPart::basic(")"))?; arg_cb(InstructionPart::basic(")"))?;
} }
// ValuedOperand::r5900_immediate15(..) => match relocation { // ValuedOperand::r5900_immediate15(..) => match relocation {
@ -382,14 +379,9 @@ fn push_args(
// } // }
// }, // },
_ => { _ => {
let value = op.display(instruction, display_flags, None::<&str>).to_string(); arg_cb(InstructionPart::opaque(
if !diff_config.mips_register_prefix { op.display(instruction, display_flags, None::<&str>).to_string(),
if let Some(value) = value.strip_prefix('$') { ))?;
arg_cb(InstructionPart::opaque(value))?;
continue;
}
}
arg_cb(InstructionPart::opaque(value))?;
} }
} }
} }