How bad is running debug::exit on hardware really?
The book currently says in several places that calling debug::exit when running on actual hardware will corrupt OpenOCD and require restarting it. But looking into the implementation, it seems that it just invokes the REPORT_EXCEPTION system call with ApplicationExit as the exception code. This system call is documented in the semihosting interface. Presumably, if OpenOCD supports semihosting properly, this shouldn't cause problems unless there is an actual bug in OpenOCD itself. So why is this particular system call bad?
This bug report on OpenOCD may be related: #218 arm semihosting: target resumes after application exit. If this is indeed a bug in OpenOCD that has since been fixed, it may be more helpful if the book explained this and told the reader which version of OpenOCD to use in order to avoid the problem.