I was having an issue in which, out of the blue, I could not debug my FRDM-K22F board with the P&E OpenOCD driver for anything, and it had been working flawlessly before. It would start to connect, then disconnect with no indication as to why it did so. You might see a message like:
Initializing.
Target has been RESET and is active.
Disconnected from "127.0.0.1" via 127.0.0.1
Target Disconnected.
The problem turns out to be that if you create a breakpoint for code you later remove, and do not COMPLETELY delete the breakpoint (not just disable it) the debugger just crashes without any warning at startup and provides nothing to indicate why. I just about pulled my hair out figuring this one out.
I found the answer on the P&E Forum: P&E Microcomputer Systems
Hope this tip saves someone some heartache!
Quick follow up - Since posting this I have at least two more encounters with this behavior and fixed it by deleting the breakpoints completely. I think the problem may occur not just if the code is removed, but if there are changes near the break point code.
I believe this is a GDB bug (problem with breakpoints/watchpoints on non-existing code, see Failed to Debug with GDB: Breakpoints or Expressions on non-existing Locations | MCU on Eclipse).
So this is not a problem of OpenOCD, P&E or Segger (the problem occurs for all of them), but a problem of the GDB used in the GNU 4.8 version. GNU 4.9 (launchpad, see above article) does not show the problem for me.
Erich