Reads and returns a number of instructions captured by STRACE.

        The number of instructions must be a non-negative value of at most
        ``0x10000`` (``65536``).

        Args:
          self (JLink): the ``JLink`` instance.
          num_instructions (int): number of instructions to fetch.

        Returns:
          A list of instruction addresses in order from most recently executed
          to oldest executed instructions.  Note that the number of
          instructions returned can be less than the number of instructions
          requested in the case that there are not ``num_instructions`` in the
          trace buffer.

        Raises:
          JLinkException: on error.
          ValueError: if ``num_instructions < 0`` or
            ``num_instructions > 0x10000``.

def strace_read(self, num_instructions):
        """Reads and returns a number of instructions captured by STRACE.

        The number of instructions must be a non-negative value of at most
        ``0x10000`` (``65536``).

        Args:
          self (JLink): the ``JLink`` instance.
          num_instructions (int): number of instructions to fetch.

        Returns:
          A list of instruction addresses in order from most recently executed
          to oldest executed instructions.  Note that the number of
          instructions returned can be less than the number of instructions
          requested in the case that there are not ``num_instructions`` in the
          trace buffer.

        Raises:
          JLinkException: on error.
          ValueError: if ``num_instructions < 0`` or
            ``num_instructions > 0x10000``.
        """
        if num_instructions < 0 or num_instructions > 0x10000:
            raise ValueError('Invalid instruction count.')

        buf = (ctypes.c_uint32 * num_instructions)()
        buf_size = num_instructions
        res = self._dll.JLINK_STRACE_Read(ctypes.byref(buf), buf_size)
        if res < 0:
            raise errors.JLinkException('Failed to read from STRACE buffer.')

        return list(buf)[:res]