I often use openOCD and GDB/Insight to attach to a running target that I
don't want to halt, or even cannot halt it during my debugging session.
I just want to take to see the call stack and program counter when it
crashes or when it reaches a special code line.

It's not a good idea to force everyone to halt their target when
connecting, when there is the possibility to script this behavior. It
might be your case that you want to halt it, but some other may not want
that.

In your case I think it would be the best to write a "gdb-attach" event
in your script and you can do whatever you want, like resetting the CPU,
blink LED's in this script.

Regards,
Michael

On 02.05.2011 21:14, Jie Zhang wrote:
> When GDB connects to OpenOCD, OpenOCD does not halt the target by
> default. To halt the target, users have to add "halt" to gdb-attach
> event hook in target configuration file or type the command "monitor
> halt" from GDB command line interface. The latter method caused some
> confusion for me.
>
> Since OpenOCD does not halt the target when GDB connects, it will
> return all zeros when GDB asks for register value. GDB cached such
> value internally. Then I typed "monitor halt" in GDB, OpenOCD halts
> the target. But when I ask GDB about the register value of the target,
> GDB still returns the cached all zeros to me without retrieving them
> again. This bacause GDB has no idea that the target is still running
> when it connects to OpenOCD and the target is halted by "monitor
> halt". To get meaningful register values, I have to "continue" and
> "^C" in GDB to cause GDB to retrieve register values again.
>
> Then my question is why not just halt the target when GDB connects to
> OpenOCD? In this way, GDB will get the correct register information
> when it connects to OpenOCD and show the correct stop address.
>
> Regards
> Jie
>
>
> _______________________________________________
> Openocd-development mailing list
> Openocd-development@lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/openocd-development

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to