or use your favorite gdb frontend and connect to :33303
But if in Code::Blocks I select
Debug --> Attach to process...
and type in the number (33303 here) Code::Blocks writes
Attaching to program with pid: 33303
Debugger name and version: GNU gdb (Ubuntu 10.l-2ubuntu2) 10.1.90.20210411-git
Attaching failed: pt race: No such process.
Attaching to process 33303
Debugger finished with status 0
Unfortunately GDB isn’t something I use regularly so I can’t really answer what frontend might help best, however for the issue you’re having, I think you may be getting confused between attaching to a PID and connecting to a TCP port. Just for testing purposes I’d see if the regular GDB executable can connect, e.g:
gdb -ex="target remote 127.0.0.1:33303"
Hopefully someone else wiser in the ways of GDB might be able to assist you. I imagine codeblocks might have a way to connect to a GDB server via TCP, but I haven’t ever used it so I couldn’t be specific there, sorry.