man 2 ptrace is really one of the worst man pages in existence, and it's made doubly bad because there are only two real clients that you can reference, one of which is pretty much the definition of an awful legacy codebase and the other which is over- and strangely-engineered and at times not even correct or complete. Actually, triply bad because ptrace(2) itself is the worst API and it bleeds into some other fairly reasonable APIs for signals and process notifications.
I guess the silver lining is that if you ever find yourself in the position of having to implement ptrace (like I did recently) you can get away with a surprisingly broken and incomplete API and GDB at least will take it mostly in stride, as long as you don't mess up a couple of the fundamental operations (your wait4(2) has to mostly be correct, a couple of the SIGTRAPs need the right codes). It's still really difficult to do–my implementation was designed by cross-checking against strace output and only supports basic single-task debugging–but you can return strange errors or "I don't support this" and GDB for the most part is OK with that, because not only is ptrace a broken API many of its implementations are broken themselves, or certain features are strangely missing in some places.
I obviously don't know the details of what you were doing but it's generally easier to implement the gdbserver protocol than to implement ptrace itself.
I guess the silver lining is that if you ever find yourself in the position of having to implement ptrace (like I did recently) you can get away with a surprisingly broken and incomplete API and GDB at least will take it mostly in stride, as long as you don't mess up a couple of the fundamental operations (your wait4(2) has to mostly be correct, a couple of the SIGTRAPs need the right codes). It's still really difficult to do–my implementation was designed by cross-checking against strace output and only supports basic single-task debugging–but you can return strange errors or "I don't support this" and GDB for the most part is OK with that, because not only is ptrace a broken API many of its implementations are broken themselves, or certain features are strangely missing in some places.