Ptrace in the kernel function

Since the kernel function has been launched and run on gpu device , how to stop it and execute it step by step.
Is it the same as cpu, is it also implemented by inserting interrupts with the system call ptrace function?

We have a CUDA Debugger API defined that provides the capabilities to debug applications running on the GPU. It is defined here: Debugger API :: CUDA Toolkit Documentation

For cuda-gdb, we don’t make calls/link directly to this API. Instead we communicate with the driver through an RPC like interface defined by cudbgprocess.

Thanks for your help.
I have seen the code in the gdb/cuda/libcudbgipc.c file and understand what you mean.
That is to say, the cudbgprocess code is not open source, but only provides a driver interface to the outside world. It is impossible to see how it is implemented, right?

Correct. Since cudbgprocess is part of the CUDA driver the source code is not released.

I totally get it.Thank you very much.