pub struct Disassembler<'a> { /* private fields */ }
Available on crate feature
disas
only.Expand description
A Pulley bytecode disassembler.
This is implemented as an OpVisitor
, where you pass a Disassembler
to a
Decoder
in order to disassemble instructions from a bytecode stream.
Alternatively, you can use the Disassembler::disassemble_all
method to
disassemble a complete bytecode stream.
Implementations§
Source§impl<'a> Disassembler<'a>
impl<'a> Disassembler<'a>
Sourcepub fn disassemble_all(bytecode: &'a [u8]) -> Result<String>
pub fn disassemble_all(bytecode: &'a [u8]) -> Result<String>
Disassemble every instruction in the given bytecode stream.
Sourcepub fn new(bytecode: &'a [u8]) -> Self
pub fn new(bytecode: &'a [u8]) -> Self
Create a new Disassembler
that can be used to incrementally
disassemble instructions from the given bytecode stream.
Sourcepub fn offsets(&mut self, offsets: bool) -> &mut Self
pub fn offsets(&mut self, offsets: bool) -> &mut Self
Whether to prefix each instruction’s disassembly with its offset.
True by default.
Trait Implementations§
Source§impl ExtendedOpVisitor for Disassembler<'_>
impl ExtendedOpVisitor for Disassembler<'_>
Source§impl<'a> OpVisitor for Disassembler<'a>
impl<'a> OpVisitor for Disassembler<'a>
Source§type BytecodeStream = SafeBytecodeStream<'a>
type BytecodeStream = SafeBytecodeStream<'a>
Available on crate feature
decode
only.The type of this visitor’s bytecode stream.
Source§type Return = ()
type Return = ()
Available on crate feature
decode
only.The type of values returned by each visitor method.
Source§fn bytecode(&mut self) -> &mut Self::BytecodeStream
fn bytecode(&mut self) -> &mut Self::BytecodeStream
Available on crate feature
decode
only.Get this visitor’s underlying bytecode stream.
Source§fn before_visit(&mut self)
fn before_visit(&mut self)
Available on crate feature
decode
only.A callback invoked before starting to decode an instruction. Read more
Source§fn after_visit(&mut self)
fn after_visit(&mut self)
Available on crate feature
decode
only.A callback invoked after an instruction has been completely
decoded. Read more
Source§fn ret(&mut self)
fn ret(&mut self)
Available on crate feature
decode
only.Transfer control the address in the
lr
register.Source§fn call(&mut self, offset: PcRelOffset)
fn call(&mut self, offset: PcRelOffset)
Available on crate feature
decode
only.Transfer control to the PC at the given offset and set the
lr
register to the PC just after this instruction.Source§fn jump(&mut self, offset: PcRelOffset)
fn jump(&mut self, offset: PcRelOffset)
Available on crate feature
decode
only.Unconditionally transfer control to the PC at the given offset.
Source§fn br_if(&mut self, cond: XReg, offset: PcRelOffset)
fn br_if(&mut self, cond: XReg, offset: PcRelOffset)
Available on crate feature
decode
only.Conditionally transfer control to the given PC offset if
cond
contains a non-zero value.Source§fn br_if_not(&mut self, cond: XReg, offset: PcRelOffset)
fn br_if_not(&mut self, cond: XReg, offset: PcRelOffset)
Available on crate feature
decode
only.Conditionally transfer control to the given PC offset if
cond
contains a zero value.Source§fn br_if_xeq32(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
fn br_if_xeq32(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
Available on crate feature
decode
only.Branch if
a == b
.Source§fn br_if_xneq32(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
fn br_if_xneq32(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
Available on crate feature
decode
only.Branch if
a !=
b.Source§fn br_if_xslt32(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
fn br_if_xslt32(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
Available on crate feature
decode
only.Branch if signed
a < b
.Source§fn br_if_xslteq32(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
fn br_if_xslteq32(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
Available on crate feature
decode
only.Branch if signed
a <= b
.Source§fn br_if_xult32(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
fn br_if_xult32(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
Available on crate feature
decode
only.Branch if unsigned
a < b
.Source§fn br_if_xulteq32(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
fn br_if_xulteq32(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
Available on crate feature
decode
only.Branch if unsigned
a <= b
.Source§fn br_if_xeq64(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
fn br_if_xeq64(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
Available on crate feature
decode
only.Branch if
a == b
.Source§fn br_if_xneq64(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
fn br_if_xneq64(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
Available on crate feature
decode
only.Branch if
a !=
b.Source§fn br_if_xslt64(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
fn br_if_xslt64(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
Available on crate feature
decode
only.Branch if signed
a < b
.Source§fn br_if_xslteq64(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
fn br_if_xslteq64(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
Available on crate feature
decode
only.Branch if signed
a <= b
.Source§fn br_if_xult64(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
fn br_if_xult64(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
Available on crate feature
decode
only.Branch if unsigned
a < b
.Source§fn br_if_xulteq64(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
fn br_if_xulteq64(&mut self, a: XReg, b: XReg, offset: PcRelOffset)
Available on crate feature
decode
only.Branch if unsigned
a <= b
.Source§fn xmov(&mut self, dst: XReg, src: XReg)
fn xmov(&mut self, dst: XReg, src: XReg)
Available on crate feature
decode
only.Move between
x
registers.Source§fn fmov(&mut self, dst: FReg, src: FReg)
fn fmov(&mut self, dst: FReg, src: FReg)
Available on crate feature
decode
only.Move between
f
registers.Source§fn vmov(&mut self, dst: VReg, src: VReg)
fn vmov(&mut self, dst: VReg, src: VReg)
Available on crate feature
decode
only.Move between
v
registers.Source§fn xconst8(&mut self, dst: XReg, imm: i8)
fn xconst8(&mut self, dst: XReg, imm: i8)
Available on crate feature
decode
only.Set
dst = sign_extend(imm8)
.Source§fn xconst16(&mut self, dst: XReg, imm: i16)
fn xconst16(&mut self, dst: XReg, imm: i16)
Available on crate feature
decode
only.Set
dst = sign_extend(imm16)
.Source§fn xconst32(&mut self, dst: XReg, imm: i32)
fn xconst32(&mut self, dst: XReg, imm: i32)
Available on crate feature
decode
only.Set
dst = sign_extend(imm32)
.Source§fn xconst64(&mut self, dst: XReg, imm: i64)
fn xconst64(&mut self, dst: XReg, imm: i64)
Available on crate feature
decode
only.Set
dst = imm64
.Source§fn xadd32(&mut self, operands: BinaryOperands<XReg>)
fn xadd32(&mut self, operands: BinaryOperands<XReg>)
Available on crate feature
decode
only.32-bit wrapping addition:
low32(dst) = low32(src1) + low32(src2)
. Read moreSource§fn xadd64(&mut self, operands: BinaryOperands<XReg>)
fn xadd64(&mut self, operands: BinaryOperands<XReg>)
Available on crate feature
decode
only.64-bit wrapping addition:
dst = src1 + src2
.Source§fn xeq64(&mut self, operands: BinaryOperands<XReg>)
fn xeq64(&mut self, operands: BinaryOperands<XReg>)
Available on crate feature
decode
only.64-bit equality.
Source§fn xneq64(&mut self, operands: BinaryOperands<XReg>)
fn xneq64(&mut self, operands: BinaryOperands<XReg>)
Available on crate feature
decode
only.64-bit inequality.
Source§fn xslt64(&mut self, operands: BinaryOperands<XReg>)
fn xslt64(&mut self, operands: BinaryOperands<XReg>)
Available on crate feature
decode
only.64-bit signed less-than.
Source§fn xslteq64(&mut self, operands: BinaryOperands<XReg>)
fn xslteq64(&mut self, operands: BinaryOperands<XReg>)
Available on crate feature
decode
only.64-bit signed less-than-equal.
Source§fn xult64(&mut self, operands: BinaryOperands<XReg>)
fn xult64(&mut self, operands: BinaryOperands<XReg>)
Available on crate feature
decode
only.64-bit unsigned less-than.
Source§fn xulteq64(&mut self, operands: BinaryOperands<XReg>)
fn xulteq64(&mut self, operands: BinaryOperands<XReg>)
Available on crate feature
decode
only.64-bit unsigned less-than-equal.
Source§fn xeq32(&mut self, operands: BinaryOperands<XReg>)
fn xeq32(&mut self, operands: BinaryOperands<XReg>)
Available on crate feature
decode
only.32-bit equality.
Source§fn xneq32(&mut self, operands: BinaryOperands<XReg>)
fn xneq32(&mut self, operands: BinaryOperands<XReg>)
Available on crate feature
decode
only.32-bit inequality.
Source§fn xslt32(&mut self, operands: BinaryOperands<XReg>)
fn xslt32(&mut self, operands: BinaryOperands<XReg>)
Available on crate feature
decode
only.32-bit signed less-than.
Source§fn xslteq32(&mut self, operands: BinaryOperands<XReg>)
fn xslteq32(&mut self, operands: BinaryOperands<XReg>)
Available on crate feature
decode
only.32-bit signed less-than-equal.
Source§fn xult32(&mut self, operands: BinaryOperands<XReg>)
fn xult32(&mut self, operands: BinaryOperands<XReg>)
Available on crate feature
decode
only.32-bit unsigned less-than.
Source§fn xulteq32(&mut self, operands: BinaryOperands<XReg>)
fn xulteq32(&mut self, operands: BinaryOperands<XReg>)
Available on crate feature
decode
only.32-bit unsigned less-than-equal.
Source§fn load32_u(&mut self, dst: XReg, ptr: XReg)
fn load32_u(&mut self, dst: XReg, ptr: XReg)
Available on crate feature
decode
only.dst = zero_extend(load32(ptr))
Source§fn load32_s(&mut self, dst: XReg, ptr: XReg)
fn load32_s(&mut self, dst: XReg, ptr: XReg)
Available on crate feature
decode
only.dst = sign_extend(load32(ptr))
Source§fn load64(&mut self, dst: XReg, ptr: XReg)
fn load64(&mut self, dst: XReg, ptr: XReg)
Available on crate feature
decode
only.dst = load64(ptr)
Source§fn load32_u_offset8(&mut self, dst: XReg, ptr: XReg, offset: i8)
fn load32_u_offset8(&mut self, dst: XReg, ptr: XReg, offset: i8)
Available on crate feature
decode
only.dst = zero_extend(load32(ptr + offset8))
Source§fn load32_s_offset8(&mut self, dst: XReg, ptr: XReg, offset: i8)
fn load32_s_offset8(&mut self, dst: XReg, ptr: XReg, offset: i8)
Available on crate feature
decode
only.dst = sign_extend(load32(ptr + offset8))
Source§fn load64_offset8(&mut self, dst: XReg, ptr: XReg, offset: i8)
fn load64_offset8(&mut self, dst: XReg, ptr: XReg, offset: i8)
Available on crate feature
decode
only.dst = load64(ptr + offset8)
Source§fn load32_u_offset64(&mut self, dst: XReg, ptr: XReg, offset: i64)
fn load32_u_offset64(&mut self, dst: XReg, ptr: XReg, offset: i64)
Available on crate feature
decode
only.dst = zero_extend(load32(ptr + offset64))
Source§fn load32_s_offset64(&mut self, dst: XReg, ptr: XReg, offset: i64)
fn load32_s_offset64(&mut self, dst: XReg, ptr: XReg, offset: i64)
Available on crate feature
decode
only.dst = sign_extend(load32(ptr + offset64))
Source§fn load64_offset64(&mut self, dst: XReg, ptr: XReg, offset: i64)
fn load64_offset64(&mut self, dst: XReg, ptr: XReg, offset: i64)
Available on crate feature
decode
only.dst = load64(ptr + offset64)
Source§fn store32(&mut self, ptr: XReg, src: XReg)
fn store32(&mut self, ptr: XReg, src: XReg)
Available on crate feature
decode
only.*ptr = low32(src)
Source§fn store32_offset8(&mut self, ptr: XReg, offset: i8, src: XReg)
fn store32_offset8(&mut self, ptr: XReg, offset: i8, src: XReg)
Available on crate feature
decode
only.*(ptr + sign_extend(offset8)) = low32(src)
Source§fn store64_offset8(&mut self, ptr: XReg, offset: i8, src: XReg)
fn store64_offset8(&mut self, ptr: XReg, offset: i8, src: XReg)
Available on crate feature
decode
only.*(ptr + sign_extend(offset8)) = src
Source§fn store32_offset64(&mut self, ptr: XReg, offset: i64, src: XReg)
fn store32_offset64(&mut self, ptr: XReg, offset: i64, src: XReg)
Available on crate feature
decode
only.*(ptr + sign_extend(offset64)) = low32(src)
Source§fn store64_offset64(&mut self, ptr: XReg, offset: i64, src: XReg)
fn store64_offset64(&mut self, ptr: XReg, offset: i64, src: XReg)
Available on crate feature
decode
only.*(ptr + sign_extend(offset64)) = src
Source§fn xpush32(&mut self, src: XReg)
fn xpush32(&mut self, src: XReg)
Available on crate feature
decode
only.*sp = low32(src); sp += 4
Source§fn xpush32_many(&mut self, srcs: RegSet<XReg>)
fn xpush32_many(&mut self, srcs: RegSet<XReg>)
Available on crate feature
decode
only.for src in srcs { xpush32 src }
Source§fn xpush64_many(&mut self, srcs: RegSet<XReg>)
fn xpush64_many(&mut self, srcs: RegSet<XReg>)
Available on crate feature
decode
only.for src in srcs { xpush64 src }
Source§fn xpop32_many(&mut self, dsts: RegSet<XReg>)
fn xpop32_many(&mut self, dsts: RegSet<XReg>)
Available on crate feature
decode
only.for dst in dsts.rev() { xpop32 dst }
Source§fn xpop64_many(&mut self, dsts: RegSet<XReg>)
fn xpop64_many(&mut self, dsts: RegSet<XReg>)
Available on crate feature
decode
only.for dst in dsts.rev() { xpop64 dst }
Source§fn bitcast_int_from_float_32(&mut self, dst: XReg, src: FReg)
fn bitcast_int_from_float_32(&mut self, dst: XReg, src: FReg)
Available on crate feature
decode
only.low32(dst) = bitcast low32(src) as i32
Source§fn bitcast_int_from_float_64(&mut self, dst: XReg, src: FReg)
fn bitcast_int_from_float_64(&mut self, dst: XReg, src: FReg)
Available on crate feature
decode
only.dst = bitcast src as i64
Source§fn bitcast_float_from_int_32(&mut self, dst: FReg, src: XReg)
fn bitcast_float_from_int_32(&mut self, dst: FReg, src: XReg)
Available on crate feature
decode
only.low32(dst) = bitcast low32(src) as f32
Source§fn bitcast_float_from_int_64(&mut self, dst: FReg, src: XReg)
fn bitcast_float_from_int_64(&mut self, dst: FReg, src: XReg)
Available on crate feature
decode
only.dst = bitcast src as f64
Auto Trait Implementations§
impl<'a> Freeze for Disassembler<'a>
impl<'a> RefUnwindSafe for Disassembler<'a>
impl<'a> Send for Disassembler<'a>
impl<'a> Sync for Disassembler<'a>
impl<'a> Unpin for Disassembler<'a>
impl<'a> UnwindSafe for Disassembler<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more