J-link stops in delay() method

I am trying to use J_link EDU to debug a MKR Wifi1010 (ATSAMD21G18A) but have run into a problem.

When the code executes the delay() method the debugger stops on the following line of code

unsigned long micros( void )
{
  uint32_t ticks, ticks2;
  uint32_t pend, pend2;
  uint32_t count, count2;

  ticks2  = SysTick->VAL;
  pend2   = !!(SCB->ICSR & SCB_ICSR_PENDSTSET_Msk)  ;
  count2  = _ulTickCount ;

  do
  {
    ticks=ticks2;
    pend=pend2;
    count=count2;
    ticks2  = SysTick->VAL;
    pend2   = !!(SCB->ICSR & SCB_ICSR_PENDSTSET_Msk)  ;
    count2  = _ulTickCount ;
  } while ((pend != pend2) || (count != count2) || (ticks < ticks2));

//DEBUGGER STOPS HERE
  return ((count+pend) * 1000) + (((SysTick->LOAD  - ticks)*(1048576/(VARIANT_MCK/1000000)))>>20) ;
  // this is an optimization to turn a runtime division into two compile-time divisions and
  // a runtime multiplication and shift, saving a few cycles
}

The Debugger ’ log contains the message
Program

received signal SIGTRAP, Trace/breakpoint trap.
Read 4 bytes @ address 0x00000B74 (Data = 0xE7FEBE0D)
Read 2 bytes @ address 0x00000B74 (Data = 0xBE0D)
0x00000b74 in ?? ()

Pressing the RUN button causes the debugger to stop at the same point again.

Does anyone know what is happeniing and if there is any workaround?

thanks