Package com.tonic.analysis.instruction
Class UnknownInstruction
- java.lang.Object
-
- com.tonic.analysis.instruction.Instruction
-
- com.tonic.analysis.instruction.UnknownInstruction
-
public class UnknownInstruction extends Instruction
Represents an unknown or unhandled instruction.
-
-
Constructor Summary
Constructors Constructor Description UnknownInstruction(int opcode, int offset, int length)Constructs an UnknownInstruction with zero-filled operands.UnknownInstruction(int opcode, int offset, int length, byte[] bytecode)Constructs an UnknownInstruction, copying the real operand bytes from the source bytecode so the instruction round-trips throughwrite(java.io.DataOutputStream)and its operands can be inspected.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(AbstractBytecodeVisitor visitor)Accepts a visitor for bytecode analysis.intgetLocalChange()Returns the change in local variables caused by this instruction.byte[]getOperands()intgetStackChange()Returns the change in stack size caused by this instruction.StringtoString()Returns a string representation of the instruction.voidwrite(DataOutputStream dos)Writes the unknown opcode and its operands to the DataOutputStream.-
Methods inherited from class com.tonic.analysis.instruction.Instruction
getLength, getOffset, getOpcode, setOffset
-
-
-
-
Constructor Detail
-
UnknownInstruction
public UnknownInstruction(int opcode, int offset, int length)Constructs an UnknownInstruction with zero-filled operands.- Parameters:
opcode- The opcode of the instruction.offset- The bytecode offset of the instruction.length- The total length of the instruction in bytes.
-
UnknownInstruction
public UnknownInstruction(int opcode, int offset, int length, byte[] bytecode)Constructs an UnknownInstruction, copying the real operand bytes from the source bytecode so the instruction round-trips throughwrite(java.io.DataOutputStream)and its operands can be inspected.- Parameters:
opcode- The opcode of the instruction.offset- The bytecode offset of the instruction.length- The total length of the instruction in bytes.bytecode- The source bytecode array to copy operand bytes from.
-
-
Method Detail
-
getOperands
public byte[] getOperands()
- Returns:
- the raw operand bytes following the opcode
-
accept
public void accept(AbstractBytecodeVisitor visitor)
Description copied from class:InstructionAccepts a visitor for bytecode analysis.- Specified by:
acceptin classInstruction- Parameters:
visitor- The visitor to accept.
-
write
public void write(DataOutputStream dos) throws IOException
Writes the unknown opcode and its operands to the DataOutputStream.- Specified by:
writein classInstruction- Parameters:
dos- The DataOutputStream to write to.- Throws:
IOException- If an I/O error occurs.
-
getStackChange
public int getStackChange()
Returns the change in stack size caused by this instruction.- Specified by:
getStackChangein classInstruction- Returns:
- The stack size change (assumed to be 0 for unknown instructions).
-
getLocalChange
public int getLocalChange()
Returns the change in local variables caused by this instruction.- Specified by:
getLocalChangein classInstruction- Returns:
- The local variables size change (assumed to be 0 for unknown instructions).
-
toString
public String toString()
Returns a string representation of the instruction.- Overrides:
toStringin classInstruction- Returns:
- The unknown opcode in hexadecimal format.
-
-