Ctrl+G is for cancelling Emacs commands, but that output is coming from the debugger that's being run in the comint buffer. The Emacs command has already completed, it just sent the TAB to the debugger process.
Try Ctrl+C Ctrl+C, which sends an interrupt to the subprocess. However, it's possible that the subprocess has already finished sending the list of results, and it's all in the pty buffer.