2025-04-12 18:41:40 +03:00
|
|
|
namespace X86Disassembler.X86;
|
|
|
|
|
2025-04-14 22:08:50 +03:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
2025-04-12 18:41:40 +03:00
|
|
|
/// <summary>
|
2025-04-12 19:57:42 +03:00
|
|
|
/// Represents an x86 instruction
|
2025-04-12 18:41:40 +03:00
|
|
|
/// </summary>
|
|
|
|
public class Instruction
|
|
|
|
{
|
|
|
|
/// <summary>
|
2025-04-12 19:57:42 +03:00
|
|
|
/// Gets or sets the address of the instruction
|
2025-04-12 18:41:40 +03:00
|
|
|
/// </summary>
|
2025-04-14 02:07:17 +03:00
|
|
|
public ulong Address { get; set; }
|
2025-04-12 18:41:40 +03:00
|
|
|
|
|
|
|
/// <summary>
|
2025-04-14 22:08:50 +03:00
|
|
|
/// Gets or sets the type of the instruction
|
2025-04-12 18:41:40 +03:00
|
|
|
/// </summary>
|
2025-04-14 22:08:50 +03:00
|
|
|
public InstructionType Type { get; set; } = InstructionType.Unknown;
|
|
|
|
|
2025-04-12 18:41:40 +03:00
|
|
|
/// <summary>
|
2025-04-14 22:08:50 +03:00
|
|
|
/// Gets or sets the structured operands of the instruction
|
2025-04-12 18:41:40 +03:00
|
|
|
/// </summary>
|
2025-04-14 22:08:50 +03:00
|
|
|
public List<Operand> StructuredOperands { get; set; } = [];
|
2025-04-12 18:41:40 +03:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Returns a string representation of the instruction
|
|
|
|
/// </summary>
|
2025-04-12 19:57:42 +03:00
|
|
|
/// <returns>A string representation of the instruction</returns>
|
2025-04-12 18:41:40 +03:00
|
|
|
public override string ToString()
|
|
|
|
{
|
2025-04-14 22:08:50 +03:00
|
|
|
return $"{Address:X8} {Type:G} {string.Join(",", StructuredOperands)}";
|
2025-04-12 18:41:40 +03:00
|
|
|
}
|
|
|
|
}
|