]> git.sur5r.net Git - openocd/blobdiff - doc/openocd.texi
server: explicitly call "shutdown" when catch CTRL-C or a signal
[openocd] / doc / openocd.texi
index 43ebf8cb28a8b0658b646b354ea1ca3922928f9b..16aa26bf546179606adccefb215f805885ec311f 100644 (file)
@@ -7390,6 +7390,19 @@ Useful in connection with script files
 Close the OpenOCD server, disconnecting all clients (GDB, telnet,
 other). If option @option{error} is used, OpenOCD will return a
 non-zero exit code to the parent process.
+
+Like any TCL commands, also @command{shutdown} can be redefined, e.g.:
+@example
+# redefine shutdown
+rename shutdown original_shutdown
+proc shutdown @{@} @{
+    puts "This is my implementation of shutdown"
+    # my own stuff before exit OpenOCD
+    original_shutdown
+@}
+@end example
+If user types CTRL-C or kills OpenOCD, either the command @command{shutdown}
+or its replacement will be automatically executed before OpenOCD exits.
 @end deffn
 
 @anchor{debuglevel}