Make attach_command exception-safe
authorVladimir Prus <vladimir@codesourcery.com>
Mon, 3 Nov 2008 21:07:28 +0000 (21:07 +0000)
committerVladimir Prus <vladimir@codesourcery.com>
Mon, 3 Nov 2008 21:07:28 +0000 (21:07 +0000)
        * infcmd.c (attach_command): Call async_enable_stdin
        if exception is thrown.

gdb/ChangeLog
gdb/infcmd.c

index 920c5f429355c4cdc3712d42319a2fa514d43024..1c7b03cef2ae2ede6a9bb86d2182aaa1967b7303 100644 (file)
@@ -1,3 +1,9 @@
+2008-11-03  Vladimir Prus  <vladimir@codesourcery.com>
+
+       Make attach_command exception-safe
+        * infcmd.c (attach_command): Call async_enable_stdin
+        if exception is thrown.
+
 2008-11-03  Pedro Alves  <pedro@codesourcery.com>
 
        * gdbarch.sh (has_global_solist): Mention global breakpoints.
index 63d8ccabe9bdc88de6ecd182c2ed21c70946eb18..50e8fff74604189bfd3c44fbf93bcae50e040962 100644 (file)
@@ -2231,6 +2231,7 @@ attach_command (char *args, int from_tty)
   char *exec_file;
   char *full_exec_path = NULL;
   int async_exec = 0;
+  struct cleanup *back_to = make_cleanup (null_cleanup, NULL);
 
   dont_repeat ();              /* Not for the faint of heart */
 
@@ -2268,6 +2269,7 @@ attach_command (char *args, int from_tty)
     {
       /* Simulate synchronous execution */
       async_disable_stdin ();
+      make_cleanup ((make_cleanup_ftype *)async_enable_stdin, NULL);
     }
 
   target_attach (args, from_tty);
@@ -2321,6 +2323,7 @@ attach_command (char *args, int from_tty)
          add_continuation (inferior_thread (),
                            attach_command_continuation, a,
                            attach_command_continuation_free_args);
+         discard_cleanups (back_to);
          return;
        }
 
@@ -2328,6 +2331,7 @@ attach_command (char *args, int from_tty)
     }
 
   attach_command_post_wait (args, from_tty, async_exec);
+  discard_cleanups (back_to);
 }
 
 /*
This page took 0.031782 seconds and 4 git commands to generate.