I have made some quick test on what GDB sends with the commands "quit", 
"detach" and "disconnect". Either by using "-d" flag on OpenOCD side and with 
command "set debug remote 1" at GDB side.
* "quit": GDB send the low-level packet "$D#44", then it exit
* "detach": GDB send the low-level packet "$D#44" too, but does not exit
* "disconnect": GDB simply closes the TCP connection with OpenOCD and does not 
exit

There is no way for OpenOCD to discriminate between "quit" and "detach", plus 
no way to discriminate between "disconnect" and GDB crash or killed or network 
connection dropped when GDB is running on another PC over the network.

I don't see what can be implemented in OpenOCD to address this ticket.

There is the non-stop mode of GDB, but so far it is not supported by OpenOCD.
In non-stop mode, GDB returns the prompt to the user even when the target is 
running.
In this case the user can quit GDB and left the target in the current state 
(e.g.  running).


---

** [tickets:#314] quit doesn't properly detach**

**Status:** new
**Milestone:** 0.11.0
**Created:** Thu Aug 19, 2021 05:02 AM UTC by Wren Turkal
**Last Updated:** Thu Aug 19, 2021 05:32 AM UTC
**Owner:** nobody


The quit command is supposed to detach (and thus continue) the inferior before 
exiting.

If one wants to disconnect without continuing the inferior, there is also a 
disconnect command.

I noticed this change: http://openocd.zylin.com/#/c/5600/1

Here's the gdb docs on attach/detach: 
https://ftp.gnu.org/old-gnu/Manuals/gdb/html_node/gdb_22.html

Here's the gdb docs on detach/disconnect: 
https://sourceware.org/gdb/current/onlinedocs/gdb/Connecting.html#Connecting

It would be lovely to have the right semantics so that quiting continues while 
disconnect does not change the execution state to match these semantics.


---

Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/openocd/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/openocd/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.


Reply via email to