0
\$\begingroup\$

I'm using a J-Link and the corresponding Linux GDB-Server from Segger. When I start debugging with Eclipse the program is automatically halted at the first instruction in the startup assembler code. When I try to step i never get to the next line. Instead I see the GDB-Server output filling up with these messages.

Performing single step...
...Target halted (PC = 0x080005A4)
Reading all registers
Performing single step...
...Target halted (PC = 0x080005A4)
Reading all registers
Performing single step...
...Target halted (PC = 0x080005A4)
Reading all registers
Performing single step...
...Target halted (PC = 0x080005A4)
Reading all registers

Using the command line I have a similar issue. It seems that somehow the PC is not advanced after the instruction.

Any hints why I might be getting this kind of behavior?

\$\endgroup\$
  • \$\begingroup\$ Posting some disassembly of the affected region might help. Is the instruction immediately below this a HALT instruction? \$\endgroup\$ – Brian Drummond Apr 10 '13 at 6:56
  • \$\begingroup\$ The instruction writes zero into r0. The next instruction branches (b) to a loop label that initializes BSS. I'm currently not at home but I will post the startup sequence as soon as I can. I'm pretty sure its a configuration or linker-script problem. And I was hoping someone has had the same problem / behavior before. \$\endgroup\$ – everclear Apr 10 '13 at 10:35
  • \$\begingroup\$ I'm sorry for not posting this earlier. The solution wasthat I simply choose the wrong 'flash device' in the gdb monitor settings. I gave the whole device 'stm32f100vbt6b' while I should have given 'stm32f100vb'. Unfortunately the server does not report unknown device names. \$\endgroup\$ – everclear Apr 18 '13 at 15:39
1
\$\begingroup\$

The reason is most likely that the instruction you are trying to step is an endless loop, as typically used with an RTOS in the idle loop. Eclipse is now seeing that that the PC has not changed and tries again. Remedy: Check what the instruction is; if this is so, add a nop to the loop. With SEGGER's J-Link, you may as well use other free GDB tool chains such emide or em::Blocks.

\$\endgroup\$
  • \$\begingroup\$ Sometimes, just adding an assembly "nop" in the body of the infinite loop and ensuring that this "nop" is not removed by any optimization setting would solve that issue. \$\endgroup\$ – Blup1980 May 9 '14 at 6:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.