Class GccAnalysisUtils


  • public class GccAnalysisUtils
    extends java.lang.Object
    Utility methods for use by the gcc exception handling analysis.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int getSLEB128Length​(Program program, Address addr)
      Gets the size of a signed little endian base 128 integer.
      static int getULEB128Length​(Program program, Address addr)
      Gets the size of an unsigned little endian base 128 integer.
      static byte readByte​(Program program, Address addr)
      Reads a byte from the program's memory at the indicated address.
      static void readBytes​(Program program, Address addr, byte[] buffer)
      Reads buffer.length number of bytes from the program's memory starting at the indicated address.
      static long readDWord​(Program program, Address addr)
      Reads a double word from the program's memory starting at the indicated address.
      static long readQWord​(Program program, Address addr)
      Reads a quad word from the program's memory starting at the indicated address.
      static long readSLEB128​(Program program, Address addr)
      Reads an signed little endian base 128 integer from memory.
      static long readULEB128​(Program program, Address addr)
      Reads an unsigned little endian base 128 integer from memory.
      static int readWord​(Program program, Address addr)
      Reads a word from the program's memory starting at the indicated address.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GccAnalysisUtils

        public GccAnalysisUtils()
    • Method Detail

      • readByte

        public static byte readByte​(Program program,
                                    Address addr)
                             throws MemoryAccessException
        Reads a byte from the program's memory at the indicated address.
        Parameters:
        program - the program containing the byte to read
        addr - the address to start reading
        Returns:
        the byte
        Throws:
        MemoryAccessException - if the byte can't be read.
      • readWord

        public static int readWord​(Program program,
                                   Address addr)
                            throws MemoryAccessException
        Reads a word from the program's memory starting at the indicated address.
        Parameters:
        program - the program containing the bytes to read
        addr - the address to start reading
        Returns:
        the word
        Throws:
        MemoryAccessException - if 2 bytes can't be read.
      • readDWord

        public static long readDWord​(Program program,
                                     Address addr)
                              throws MemoryAccessException
        Reads a double word from the program's memory starting at the indicated address.
        Parameters:
        program - the program containing the bytes to read
        addr - the address to start reading
        Returns:
        the double word
        Throws:
        MemoryAccessException - if 4 bytes can't be read.
      • readQWord

        public static long readQWord​(Program program,
                                     Address addr)
                              throws MemoryAccessException
        Reads a quad word from the program's memory starting at the indicated address.
        Parameters:
        program - the program containing the bytes to read
        addr - the address to start reading
        Returns:
        the quad word
        Throws:
        MemoryAccessException - if 8 bytes can't be read.
      • readBytes

        public static void readBytes​(Program program,
                                     Address addr,
                                     byte[] buffer)
                              throws MemoryAccessException
        Reads buffer.length number of bytes from the program's memory starting at the indicated address.
        Parameters:
        program - the program containing the bytes to read
        addr - the address to start reading
        buffer - the array to save the bytes that were read.
        Throws:
        MemoryAccessException - if the expected number of bytes can't be read.
      • readULEB128

        public static long readULEB128​(Program program,
                                       Address addr)
        Reads an unsigned little endian base 128 integer from memory.
        Parameters:
        program - the program with memory to be read.
        addr - the address in memory to begin reading the unsigned LEB128.
        Returns:
        the unsigned LEB128 integer.
      • getULEB128Length

        public static int getULEB128Length​(Program program,
                                           Address addr)
        Gets the size of an unsigned little endian base 128 integer.
        Parameters:
        program - the program with memory to be read.
        addr - the address in memory to begin reading the unsigned LEB128.
        Returns:
        the length of the unsigned LEB128 integer.
      • readSLEB128

        public static long readSLEB128​(Program program,
                                       Address addr)
        Reads an signed little endian base 128 integer from memory.
        Parameters:
        program - the program with memory to be read.
        addr - the address in memory to begin reading the signed LEB128.
        Returns:
        the signed LEB128 integer.
      • getSLEB128Length

        public static int getSLEB128Length​(Program program,
                                           Address addr)
        Gets the size of a signed little endian base 128 integer.
        Parameters:
        program - the program with memory to be read.
        addr - the address in memory to begin reading the signed LEB128.
        Returns:
        the length of the signed LEB128 integer.