How to debug the Haiku kernel?

Hi,guys
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: https://www.haiku-os.org/documents/dev/welcome_to_kernel_debugging_land

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