JTAG/SWD and entering debug monitor

How does a JTAG/SWD debugger know when BKPT is executed?

My guess is that BKPT triggers entry to debug monitor and entering debug monitor sets something in the debug port, but what, and how does a debugger know about it?