aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/utils.c
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2014-08-08 15:37:41 +0100
committerGary Benson <gbenson@redhat.com>2014-08-29 10:53:56 +0100
commit860789c7d5d6ef2f60e757feb21845bb230582a8 (patch)
tree88d7addfc8242d4c8377d4afcefec92ee71ce34c /gdb/gdbserver/utils.c
parentff55e1b54898ca4e2a90c005749505e33e32215c (diff)
downloadgdb-860789c7d5d6ef2f60e757feb21845bb230582a8.zip
gdb-860789c7d5d6ef2f60e757feb21845bb230582a8.tar.gz
gdb-860789c7d5d6ef2f60e757feb21845bb230582a8.tar.bz2
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.
Diffstat (limited to 'gdb/gdbserver/utils.c')
-rw-r--r--gdb/gdbserver/utils.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/gdb/gdbserver/utils.c b/gdb/gdbserver/utils.c
index e310b9e..2351a46 100644
--- a/gdb/gdbserver/utils.c
+++ b/gdb/gdbserver/utils.c
@@ -76,17 +76,13 @@ perror_with_name (const char *string)
void
verror (const char *string, va_list args)
{
-#ifndef IN_PROCESS_AGENT
- extern jmp_buf toplevel;
-#endif
-
+#ifdef IN_PROCESS_AGENT
fflush (stdout);
vfprintf (stderr, string, args);
fprintf (stderr, "\n");
-#ifndef IN_PROCESS_AGENT
- longjmp (toplevel, 1);
-#else
exit (1);
+#else
+ throw_verror (GENERIC_ERROR, string, args);
#endif
}