MCPcopy Index your code
hub / github.com/encounter/objdiff / test_process_instruction

Function test_process_instruction

objdiff-core/src/arch/x86.rs:576–609  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

574
575 #[test]
576 fn test_process_instruction() {
577 let arch = ArchX86 { arch: Architecture::X86, endianness: object::Endianness::Little };
578 let code = [0xc7, 0x85, 0x68, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00];
579 let opcode = iced_x86::Mnemonic::Mov as u16;
580 let mut parts = Vec::new();
581 arch.display_instruction(
582 ResolvedInstructionRef {
583 ins_ref: InstructionRef { address: 0x1234, size: 10, opcode, branch_dest: None },
584 code: &code,
585 ..Default::default()
586 },
587 &DiffObjConfig::default(),
588 &mut |part| {
589 parts.push(part.into_static());
590 Ok(())
591 },
592 )
593 .unwrap();
594 assert_eq!(parts, &[
595 InstructionPart::opcode("mov", opcode),
596 InstructionPart::opaque("dword"),
597 InstructionPart::basic(" "),
598 InstructionPart::opaque("ptr"),
599 InstructionPart::basic(" "),
600 InstructionPart::basic("["),
601 InstructionPart::opaque("ebp"),
602 InstructionPart::opaque("-"),
603 InstructionPart::signed(152i64),
604 InstructionPart::basic("]"),
605 InstructionPart::basic(","),
606 InstructionPart::basic(" "),
607 InstructionPart::unsigned(0u64),
608 ]);
609 }
610
611 #[test]
612 fn test_process_instruction_with_reloc_1() {

Callers

nothing calls this directly

Calls 3

pushMethod · 0.80
display_instructionMethod · 0.45
into_staticMethod · 0.45

Tested by

no test coverage detected