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

Reply via email to