You could look at 'sdldebug.bbc' (in the lib/ directory) to discover the gory details, but in short it uses files as the means of communication. There are two files, one for each direction: sdldebug.cmd which sends commands from the IDE to the executing program (run, pause, halt, single step) and sdldebug.dat which returns data from the executing program back to the IDE. This data consists of pointers to the 'current' line and 'error' line, so that they can be highlighted, and either a list of variables and their values (used by the listvars.bbc utility) or a list of times spent in each line (used by the profiler.bbc utility), depending on whether Run...Debug or Run...Profile was issued.
Sharing the same process for the IDE and the running program (which the BB4W IDE does) simplifies the communication between them, but makes it far more likely that a major crash in the running BBC BASIC program will take down the IDE too - and it happens! Of the two approaches, I much prefer the security of knowing that however catastrophically the BASIC program may fail, the IDE (and the potentially unsaved program) should survive. I do know that there are a couple of residual bugs in SDLIDE.bbc than can cause it to crash, but I've never tracked them down.
Unfortunately in the absence of an assembler you can't see the debug facilities in action on a 64-bit build at present, but they work nicely on the 32-bit x86 (downloadable from my website) and Raspberry Pi builds.