It appears to me that ps -T enumerates thread IDs starting with zero, and GDB starting with one. This should be unified.

Or instead of manually allocating numbers, some other handle should be used, that has a global meaning for the running GNU Mach kernel, or a process-wide meaning, for example a port number.

Also see GDB thread IDs.