Consider that the debugged target is repeatedly making READC semihosting call after arm semihosting_redirect tcp 7777 all has been run. Target stops on the semihosting call while OpenOCD is waiting for data. We send for 10 bytes at once to the TCP socket.
Expected behavior: Data is buffered until target makes 10 READC semihosting calls to read all of it.
Actual behavior: Target gets one byte, rest of the data is flushed by semihosting_service_input_handler() before it can be used.
I suspect the regular READ semihosting call has the same issue.
I believe this can be fixed by removing making sure the server look does not read the data from the semihosting redirection socket.