Comment 4 for bug 1401565

Revision history for this message
Vojtech Musil (st.renegade) wrote :

Hello,

I would like to vote for a bug fix, as I was facing exactly the same issue. It took me two days to find out, whether the issue is in my compiler, debugger, source code etc. after I found this thread, which confirmed my concerns.

Never faced similar behaviour on IAR or Keil. This does not happen just on an infinite loop, but also on finite empty loop. My source code:

<code>
void main (void)
{
  /* Some initialization here */
  ...

  while (1)
  {
    GPIO_TogglePin(...);

    for (uint32_t i = 0U; i < 0xFFFFFU; i++)
    {
      ;
    }
  }
}
</code>

I would expect after stepping on the for loop to perform one iteration and end on the for loop again, however this is not the case and the gdb gets crazy. Luckily it was possible to stop it with ctrl+c, however not always. Sometimes I had to stop the gdb server.

After putting an empty instruction into the loop:

<code>
for (uint32_t i = 0U; i < 0xFFFFFU; i++)
{
  __asm("NOP");
}
</code>

the debugger was able to perform a step/next and stopped on the __asm("NOP") instruction.

I'm using openSDA v2.2 with a J-link debugger atop of this.

I hope it will be fixes, as there is no indication why this is happening.

Thanks and have a nice day,
ST Renegade