public function getFrame(int $index): StackFrame
    {
        if ($index < 0 || !isset($this->frames[$index])) {
            throw new Exception('Frame index is out of range');
        }

        return $this->frames[$index];
    }