Class SlaFormat

java.lang.Object
ghidra.pcode.utils.SlaFormat

public class SlaFormat extends Object
Encoding values for the .sla file format
  • Field Details

    • FORMAT_VERSION

      public static final int FORMAT_VERSION
      FORMAT_VERSION will be incremented whenever the format of the .sla files change.

      Version 4: Compressed and packed file format Version 3: January 2021: added source file information for each constructor.
      Version 2: April 2019: Changed numbering of Overlay spaces.
      Version 1: Initial version.

      See Also:
    • MAX_FILE_SIZE

      public static final int MAX_FILE_SIZE
      Absolute limit on the number of bytes in a .sla file
      See Also:
    • ATTRIB_VAL

      public static final AttributeId ATTRIB_VAL
    • ATTRIB_ID

      public static final AttributeId ATTRIB_ID
    • ATTRIB_SPACE

      public static final AttributeId ATTRIB_SPACE
    • ATTRIB_S

      public static final AttributeId ATTRIB_S
    • ATTRIB_OFF

      public static final AttributeId ATTRIB_OFF
    • ATTRIB_CODE

      public static final AttributeId ATTRIB_CODE
    • ATTRIB_MASK

      public static final AttributeId ATTRIB_MASK
    • ATTRIB_INDEX

      public static final AttributeId ATTRIB_INDEX
    • ATTRIB_NONZERO

      public static final AttributeId ATTRIB_NONZERO
    • ATTRIB_PIECE

      public static final AttributeId ATTRIB_PIECE
    • ATTRIB_NAME

      public static final AttributeId ATTRIB_NAME
    • ATTRIB_SCOPE

      public static final AttributeId ATTRIB_SCOPE
    • ATTRIB_STARTBIT

      public static final AttributeId ATTRIB_STARTBIT
    • ATTRIB_SIZE

      public static final AttributeId ATTRIB_SIZE
    • ATTRIB_TABLE

      public static final AttributeId ATTRIB_TABLE
    • ATTRIB_CT

      public static final AttributeId ATTRIB_CT
    • ATTRIB_MINLEN

      public static final AttributeId ATTRIB_MINLEN
    • ATTRIB_BASE

      public static final AttributeId ATTRIB_BASE
    • ATTRIB_NUMBER

      public static final AttributeId ATTRIB_NUMBER
    • ATTRIB_CONTEXT

      public static final AttributeId ATTRIB_CONTEXT
    • ATTRIB_PARENT

      public static final AttributeId ATTRIB_PARENT
    • ATTRIB_SUBSYM

      public static final AttributeId ATTRIB_SUBSYM
    • ATTRIB_LINE

      public static final AttributeId ATTRIB_LINE
    • ATTRIB_SOURCE

      public static final AttributeId ATTRIB_SOURCE
    • ATTRIB_LENGTH

      public static final AttributeId ATTRIB_LENGTH
    • ATTRIB_FIRST

      public static final AttributeId ATTRIB_FIRST
    • ATTRIB_PLUS

      public static final AttributeId ATTRIB_PLUS
    • ATTRIB_SHIFT

      public static final AttributeId ATTRIB_SHIFT
    • ATTRIB_ENDBIT

      public static final AttributeId ATTRIB_ENDBIT
    • ATTRIB_SIGNBIT

      public static final AttributeId ATTRIB_SIGNBIT
    • ATTRIB_ENDBYTE

      public static final AttributeId ATTRIB_ENDBYTE
    • ATTRIB_STARTBYTE

      public static final AttributeId ATTRIB_STARTBYTE
    • ATTRIB_VERSION

      public static final AttributeId ATTRIB_VERSION
    • ATTRIB_BIGENDIAN

      public static final AttributeId ATTRIB_BIGENDIAN
    • ATTRIB_ALIGN

      public static final AttributeId ATTRIB_ALIGN
    • ATTRIB_UNIQBASE

      public static final AttributeId ATTRIB_UNIQBASE
    • ATTRIB_MAXDELAY

      public static final AttributeId ATTRIB_MAXDELAY
    • ATTRIB_UNIQMASK

      public static final AttributeId ATTRIB_UNIQMASK
    • ATTRIB_NUMSECTIONS

      public static final AttributeId ATTRIB_NUMSECTIONS
    • ATTRIB_DEFAULTSPACE

      public static final AttributeId ATTRIB_DEFAULTSPACE
    • ATTRIB_DELAY

      public static final AttributeId ATTRIB_DELAY
    • ATTRIB_WORDSIZE

      public static final AttributeId ATTRIB_WORDSIZE
    • ATTRIB_PHYSICAL

      public static final AttributeId ATTRIB_PHYSICAL
    • ATTRIB_SCOPESIZE

      public static final AttributeId ATTRIB_SCOPESIZE
    • ATTRIB_SYMBOLSIZE

      public static final AttributeId ATTRIB_SYMBOLSIZE
    • ATTRIB_VARNODE

      public static final AttributeId ATTRIB_VARNODE
    • ATTRIB_LOW

      public static final AttributeId ATTRIB_LOW
    • ATTRIB_HIGH

      public static final AttributeId ATTRIB_HIGH
    • ATTRIB_FLOW

      public static final AttributeId ATTRIB_FLOW
    • ATTRIB_CONTAIN

      public static final AttributeId ATTRIB_CONTAIN
    • ATTRIB_I

      public static final AttributeId ATTRIB_I
    • ATTRIB_NUMCT

      public static final AttributeId ATTRIB_NUMCT
    • ATTRIB_SECTION

      public static final AttributeId ATTRIB_SECTION
    • ATTRIB_LABELS

      public static final AttributeId ATTRIB_LABELS
    • ELEM_CONST_REAL

      public static final ElementId ELEM_CONST_REAL
    • ELEM_VARNODE_TPL

      public static final ElementId ELEM_VARNODE_TPL
    • ELEM_CONST_SPACEID

      public static final ElementId ELEM_CONST_SPACEID
    • ELEM_CONST_HANDLE

      public static final ElementId ELEM_CONST_HANDLE
    • ELEM_OP_TPL

      public static final ElementId ELEM_OP_TPL
    • ELEM_MASK_WORD

      public static final ElementId ELEM_MASK_WORD
    • ELEM_PAT_BLOCK

      public static final ElementId ELEM_PAT_BLOCK
    • ELEM_PRINT

      public static final ElementId ELEM_PRINT
    • ELEM_PAIR

      public static final ElementId ELEM_PAIR
    • ELEM_CONTEXT_PAT

      public static final ElementId ELEM_CONTEXT_PAT
    • ELEM_NULL

      public static final ElementId ELEM_NULL
    • ELEM_OPERAND_EXP

      public static final ElementId ELEM_OPERAND_EXP
    • ELEM_OPERAND_SYM

      public static final ElementId ELEM_OPERAND_SYM
    • ELEM_OPERAND_SYM_HEAD

      public static final ElementId ELEM_OPERAND_SYM_HEAD
    • ELEM_OPER

      public static final ElementId ELEM_OPER
    • ELEM_DECISION

      public static final ElementId ELEM_DECISION
    • ELEM_OPPRINT

      public static final ElementId ELEM_OPPRINT
    • ELEM_INSTRUCT_PAT

      public static final ElementId ELEM_INSTRUCT_PAT
    • ELEM_COMBINE_PAT

      public static final ElementId ELEM_COMBINE_PAT
    • ELEM_CONSTRUCTOR

      public static final ElementId ELEM_CONSTRUCTOR
    • ELEM_CONSTRUCT_TPL

      public static final ElementId ELEM_CONSTRUCT_TPL
    • ELEM_SCOPE

      public static final ElementId ELEM_SCOPE
    • ELEM_VARNODE_SYM

      public static final ElementId ELEM_VARNODE_SYM
    • ELEM_VARNODE_SYM_HEAD

      public static final ElementId ELEM_VARNODE_SYM_HEAD
    • ELEM_USEROP

      public static final ElementId ELEM_USEROP
    • ELEM_USEROP_HEAD

      public static final ElementId ELEM_USEROP_HEAD
    • ELEM_TOKENFIELD

      public static final ElementId ELEM_TOKENFIELD
    • ELEM_VAR

      public static final ElementId ELEM_VAR
    • ELEM_CONTEXTFIELD

      public static final ElementId ELEM_CONTEXTFIELD
    • ELEM_HANDLE_TPL

      public static final ElementId ELEM_HANDLE_TPL
    • ELEM_CONST_RELATIVE

      public static final ElementId ELEM_CONST_RELATIVE
    • ELEM_CONTEXT_OP

      public static final ElementId ELEM_CONTEXT_OP
    • ELEM_SLEIGH

      public static final ElementId ELEM_SLEIGH
    • ELEM_SPACES

      public static final ElementId ELEM_SPACES
    • ELEM_SOURCEFILES

      public static final ElementId ELEM_SOURCEFILES
    • ELEM_SOURCEFILE

      public static final ElementId ELEM_SOURCEFILE
    • ELEM_SPACE

      public static final ElementId ELEM_SPACE
    • ELEM_SYMBOL_TABLE

      public static final ElementId ELEM_SYMBOL_TABLE
    • ELEM_VALUE_SYM

      public static final ElementId ELEM_VALUE_SYM
    • ELEM_VALUE_SYM_HEAD

      public static final ElementId ELEM_VALUE_SYM_HEAD
    • ELEM_CONTEXT_SYM

      public static final ElementId ELEM_CONTEXT_SYM
    • ELEM_CONTEXT_SYM_HEAD

      public static final ElementId ELEM_CONTEXT_SYM_HEAD
    • ELEM_END_SYM

      public static final ElementId ELEM_END_SYM
    • ELEM_END_SYM_HEAD

      public static final ElementId ELEM_END_SYM_HEAD
    • ELEM_SPACE_OTHER

      public static final ElementId ELEM_SPACE_OTHER
    • ELEM_SPACE_UNIQUE

      public static final ElementId ELEM_SPACE_UNIQUE
    • ELEM_AND_EXP

      public static final ElementId ELEM_AND_EXP
    • ELEM_DIV_EXP

      public static final ElementId ELEM_DIV_EXP
    • ELEM_LSHIFT_EXP

      public static final ElementId ELEM_LSHIFT_EXP
    • ELEM_MINUS_EXP

      public static final ElementId ELEM_MINUS_EXP
    • ELEM_MULT_EXP

      public static final ElementId ELEM_MULT_EXP
    • ELEM_NOT_EXP

      public static final ElementId ELEM_NOT_EXP
    • ELEM_OR_EXP

      public static final ElementId ELEM_OR_EXP
    • ELEM_PLUS_EXP

      public static final ElementId ELEM_PLUS_EXP
    • ELEM_RSHIFT_EXP

      public static final ElementId ELEM_RSHIFT_EXP
    • ELEM_SUB_EXP

      public static final ElementId ELEM_SUB_EXP
    • ELEM_XOR_EXP

      public static final ElementId ELEM_XOR_EXP
    • ELEM_INTB

      public static final ElementId ELEM_INTB
    • ELEM_END_EXP

      public static final ElementId ELEM_END_EXP
    • ELEM_NEXT2_EXP

      public static final ElementId ELEM_NEXT2_EXP
    • ELEM_START_EXP

      public static final ElementId ELEM_START_EXP
    • ELEM_EPSILON_SYM

      public static final ElementId ELEM_EPSILON_SYM
    • ELEM_EPSILON_SYM_HEAD

      public static final ElementId ELEM_EPSILON_SYM_HEAD
    • ELEM_NAME_SYM

      public static final ElementId ELEM_NAME_SYM
    • ELEM_NAME_SYM_HEAD

      public static final ElementId ELEM_NAME_SYM_HEAD
    • ELEM_NAMETAB

      public static final ElementId ELEM_NAMETAB
    • ELEM_NEXT2_SYM

      public static final ElementId ELEM_NEXT2_SYM
    • ELEM_NEXT2_SYM_HEAD

      public static final ElementId ELEM_NEXT2_SYM_HEAD
    • ELEM_START_SYM

      public static final ElementId ELEM_START_SYM
    • ELEM_START_SYM_HEAD

      public static final ElementId ELEM_START_SYM_HEAD
    • ELEM_SUBTABLE_SYM

      public static final ElementId ELEM_SUBTABLE_SYM
    • ELEM_SUBTABLE_SYM_HEAD

      public static final ElementId ELEM_SUBTABLE_SYM_HEAD
    • ELEM_VALUEMAP_SYM

      public static final ElementId ELEM_VALUEMAP_SYM
    • ELEM_VALUEMAP_SYM_HEAD

      public static final ElementId ELEM_VALUEMAP_SYM_HEAD
    • ELEM_VALUETAB

      public static final ElementId ELEM_VALUETAB
    • ELEM_VARLIST_SYM

      public static final ElementId ELEM_VARLIST_SYM
    • ELEM_VARLIST_SYM_HEAD

      public static final ElementId ELEM_VARLIST_SYM_HEAD
    • ELEM_OR_PAT

      public static final ElementId ELEM_OR_PAT
    • ELEM_COMMIT

      public static final ElementId ELEM_COMMIT
    • ELEM_CONST_START

      public static final ElementId ELEM_CONST_START
    • ELEM_CONST_NEXT

      public static final ElementId ELEM_CONST_NEXT
    • ELEM_CONST_NEXT2

      public static final ElementId ELEM_CONST_NEXT2
    • ELEM_CONST_CURSPACE

      public static final ElementId ELEM_CONST_CURSPACE
    • ELEM_CONST_CURSPACE_SIZE

      public static final ElementId ELEM_CONST_CURSPACE_SIZE
    • ELEM_CONST_FLOWREF

      public static final ElementId ELEM_CONST_FLOWREF
    • ELEM_CONST_FLOWREF_SIZE

      public static final ElementId ELEM_CONST_FLOWREF_SIZE
    • ELEM_CONST_FLOWDEST

      public static final ElementId ELEM_CONST_FLOWDEST
    • ELEM_CONST_FLOWDEST_SIZE

      public static final ElementId ELEM_CONST_FLOWDEST_SIZE
  • Constructor Details

    • SlaFormat

      public SlaFormat()
  • Method Details

    • isSlaFormat

      public static boolean isSlaFormat(InputStream stream) throws IOException
      Try to read the header bytes of the .sla format from the given stream. If the header bytes and the version byte match, \b true is returned, and the stream can be passed to the decoder.
      Parameters:
      stream - is the given stream
      Returns:
      true if the .sla header bytes are found
      Throws:
      IOException - for any errors reading from the stream
    • writeSlaHeader

      public static void writeSlaHeader(OutputStream stream) throws IOException
      Write a .sla file header,including the format version number to the given stream.
      Parameters:
      stream - is the given stream
      Throws:
      IOException - for problems writing to the stream
    • buildEncoder

      public static PackedEncode buildEncoder(ResourceFile sleighFile) throws IOException
      Build the encoder for compressing and encoding a .sla file (as a stream). The given file is opened and a header is immediately written. The returned encoder is ready immediately to receive the .sla elements and attributes.
      Parameters:
      sleighFile - is the .sla file (to be created)
      Returns:
      the encoder
      Throws:
      IOException - for any problems opening or writing to the file
    • buildDecoder

      public static PackedDecode buildDecoder(ResourceFile sleighFile) throws IOException
      Build the decoder for decompressing and decoding the .sla file (as a stream). The given file is opened and the header bytes are checked. The returned decoder is immediately ready to read.
      Parameters:
      sleighFile - is the given .sla file
      Returns:
      the decoder
      Throws:
      IOException - if the header is invalid or there are problems reading the file