Use exceptions and cleanups in gdbserver
This commit replaces the hacky "exception" system in gdbserver with
the exceptions and cleanups subsystem from GDB.
Only the catch/cleanup code in what was "main" has been updated to
use the new system. Other parts of gdbserver can now be converted
to use TRY_CATCH and cleanups on an as-needed basis.
A side-effect of this commit is that some error messages will change
slightly, and in cases with multiple errors the error messages will
be printed in a different order.
gdb/gdbserver/ChangeLog:
* server.h (setjmp.h): Do not include.
(toplevel): Do not declare.
(common-exceptions.h): Include.
(cleanups.h): Likewise.
* server.c (toplevel): Do not define.
(exit_code): New static global.
(detach_or_kill_for_exit_cleanup): New function.
(main): New function. Original main renamed to...
(captured_main): New function.
* utils.c (verror) [!IN_PROCESS_AGENT]: Use throw_verror.