0

gdb seems to get in a bad state after trying to step a line or two, after hitting a breakpoint. Is there something specific I can do in Eclipse to fix this?

Repro:

  1. Start debug session in Eclipse, attached to remote target
  2. Set a breakpoint in Eclipse, then trigger it on target.
  3. The breakpoint is hit correctly in Eclipse. Now 'step over' a line or two.

Expected Result:

  • 'step over' will execute one line, as you'd normally expect.

Actual Result:

  1. Instead of going to the next line number, it appears the program 'continues'. In the debug view in Eclipse, the tree displaying all threads minimizes them all, and they cannot be expanded to show the current stack. Also, the "step ..." buttons are no longer enabled, and the "pause" and "stop" buttons are able to be pressed. This implies the program is running, which is not expected, as we had previously pressed "step over". Looking on the target, it is not running, instead it is still paused.
  2. If we hit 'pause' in Eclipse, then open up the specific thread with the breakpoint, we can see the instruction pointer is back at the correct spot we expect it to be after hitting 'step over' previously. So, at first glance, it appears we just have a hiccup in our workflow, and need only to hit 'pause' and find our previous thread, whenever stepping doesn't behave right. But soon things just stop working...

I've been able to reproduce this problem without Eclipse, just using the command line gdb and remote gdbserver. The same behavior occurs. A hacky potential workaround there is -- once you've hit your breakpoint, 'set scheduler-locking on'. After that, you can step to your heart's content. But, I don't have a good understanding of what that's doing.

Anyone have any input?

Thanks.

patrick
  • 95
  • 2
  • 8

1 Answers1

0

After you've connected to the device, in the Eclipse GDB Console, enter:

set scheduler-locking step

This is a gdb client command that the Eclipse's UI doesn't support directly, so you have to enter it manually. You could also add it as a hook to another command that Eclipse calls during the setup process, so you don't have to type it manually. The caveat is that it must be called AFTER the device is connected. So, you can't just call this command directly in your gdbinit file, it must be a hook (if you're trying to automate this step, instead of typing the command directly in the console).

patrick
  • 95
  • 2
  • 8