Cortex-M0+ check if running under debugger control
Plainly, you can't by reading register. You just can't access those.  

However, there are some other workarounds:
  - See if semihosting is online BKPT 0xAB. But it throws an hardfault when its 
not...
  - Have the debug initialisation script write a bit somewhere in memory.
  - Read the SWD pin states, if the hardware supports that.