Package ghidra.app.util.bin.format.golang.rtti

# Class GoPcValueEvaluator

java.lang.Object
ghidra.app.util.bin.format.golang.rtti.GoPcValueEvaluator

public class GoPcValueEvaluator extends Object
Evaluates a sequence of (value_delta,pc_delta) leb128 pairs to calculate a value for a certain PC location.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GoPcValueEvaluator(GoFuncData func, long offset)`
  Creates a `GoPcValueEvaluator` instance, tied to the specified GoFuncData, starting at the specified offset in the moduledata's pctab.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `eval(long targetPC)`
  Returns the value encoded into the table at the specified pc.
  `List<Integer>`
  `evalAll(long targetPC)`
  Returns the set of all values for each unique pc section.
  `int`
  `evalNext()`
  `long`
  `getMaxPC()`
  Returns the largest PC value calculated when evaluating the result of the table's sequence.
  `long`
  `getPC()`
  `void`
  `reset()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### GoPcValueEvaluator

    public GoPcValueEvaluator(GoFuncData func, long offset) throws IOException
    Creates a `GoPcValueEvaluator` instance, tied to the specified GoFuncData, starting at the specified offset in the moduledata's pctab.
    Parameters:
      `func` - `GoFuncData`
      `offset` - offset in moduledata's pctab
    Throws:
      `IOException` - if error reading pctab

- ## Method Details

  - ### getPC

    public long getPC()

  - ### reset

    public void reset()

  - ### getMaxPC

    public long getMaxPC() throws IOException
    Returns the largest PC value calculated when evaluating the result of the table's sequence.
    Returns:
      largest PC value encountered
    Throws:
      `IOException` - if error evaluating result

  - ### eval

    public int eval(long targetPC) throws IOException
    Returns the value encoded into the table at the specified pc.
    Parameters:
      `targetPC` - pc
    Returns:
      value at specified pc, or -1 if error evaluating table
    Throws:
      `IOException` - if error reading data

  - ### evalNext

    public int evalNext() throws IOException
    Throws:
      `IOException`

  - ### evalAll

    public List<Integer> evalAll(long targetPC) throws IOException
    Returns the set of all values for each unique pc section.
    Parameters:
      `targetPC` - max pc to advance the sequence to when evaluating the table
    Returns:
      list of integer values
    Throws:
      `IOException` - if error reading data