How to debug the Haiku kernel?

I want to understand the kernel logic through debugging,but I did not find the relevant documents.
What should I do?

The easiest way is to use the kernel debugger. It is hust a few keystrokes away. We have an introduction article here:

An alternative is running Haiku in a virtual machine where you can attach gdb. QEMU has some support for this.