aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2012-01-13 20:02:36 +0000
committerPedro Alves <palves@redhat.com>2012-01-13 20:02:36 +0000
commitf128d5e9da0bd12c7f0b75ea2c6289ff61e85a52 (patch)
tree03912c5d6c14d283f14f441053219afb802704ac
parent9241a8bcf3da010eb1ec0ca6568e13243ce898ff (diff)
downloadgdb-f128d5e9da0bd12c7f0b75ea2c6289ff61e85a52.zip
gdb-f128d5e9da0bd12c7f0b75ea2c6289ff61e85a52.tar.gz
gdb-f128d5e9da0bd12c7f0b75ea2c6289ff61e85a52.tar.bz2
2012-01-13 Pedro Alves <palves@redhat.com>
* server.c (main): Avoid infinite loop while detaching/killing after a longjmp.
-rw-r--r--gdb/gdbserver/ChangeLog5
-rw-r--r--gdb/gdbserver/server.c10
2 files changed, 15 insertions, 0 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 4bbba37..89a4cdd 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,8 @@
+2012-01-13 Pedro Alves <palves@redhat.com>
+
+ * server.c (main): Avoid infinite loop while detaching/killing
+ after a longjmp.
+
2012-01-09 Doug Evans <dje@google.com>
* server.c (start_inferior): Set last_ptid in --wrapper case.
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index a3bc6c9..f312a5c 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -2719,6 +2719,16 @@ main (int argc, char *argv[])
if (setjmp (toplevel))
{
+ /* If something fails and longjmps while detaching or killing
+ inferiors, we'd end up here again, stuck in an infinite loop
+ trap. Be sure that if that happens, we exit immediately
+ instead. */
+ if (setjmp (toplevel))
+ {
+ fprintf (stderr, "Detach or kill failed. Exiting\n");
+ exit (1);
+ }
+
detach_or_kill_for_exit ();
exit (1);
}