aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2008-11-03 21:07:28 +0000
committerVladimir Prus <vladimir@codesourcery.com>2008-11-03 21:07:28 +0000
commitcb0362bb7ad294feaa2e5f359813ad059e80b9ff (patch)
tree5ba817f49ed81f49d47c1964bf4f4e5938a4d9ca /gdb
parenta7bea99dc6c81daecb2827ce2adc8e461c3cf83b (diff)
downloadgdb-cb0362bb7ad294feaa2e5f359813ad059e80b9ff.zip
gdb-cb0362bb7ad294feaa2e5f359813ad059e80b9ff.tar.gz
gdb-cb0362bb7ad294feaa2e5f359813ad059e80b9ff.tar.bz2
Make attach_command exception-safe
* infcmd.c (attach_command): Call async_enable_stdin if exception is thrown.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/infcmd.c4
2 files changed, 10 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 920c5f4..1c7b03c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 63d8cca..50e8fff 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -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);
}
/*