Class GccAnalysisUtils

java.lang.Object
ghidra.app.plugin.exceptionhandlers.gcc.GccAnalysisUtils

public class GccAnalysisUtils extends Object
Utility methods for use by the gcc exception handling analysis.
  • Constructor Details

    • GccAnalysisUtils

      public GccAnalysisUtils()
  • Method Details

    • 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.
    • readULEB128Info

      public static LEB128Info readULEB128Info(Program program, Address addr) throws MemoryAccessException
      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:
      LEB128Info (value + metadata)
      Throws:
      MemoryAccessException
    • readSLEB128Info

      public static LEB128Info readSLEB128Info(Program program, Address addr) throws MemoryAccessException
      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:
      LEB128Info (value + metadata)
      Throws:
      MemoryAccessException