summaryrefslogtreecommitdiff
path: root/gdb/printcmd.c
diff options
context:
space:
mode:
authorPedro Alves <pedro@codesourcery.com>2011-08-05 15:17:53 +0000
committerPedro Alves <pedro@codesourcery.com>2011-08-05 15:17:53 +0000
commit101154f1453bae9d106d16d2370abc4654bc8f35 (patch)
tree8abfb0e1eaaad69e737971e062c66857c5db783c /gdb/printcmd.c
parentf1474dc4749ecf868dc8353c7563f899ba47b47b (diff)
downloadgdb-101154f1453bae9d106d16d2370abc4654bc8f35.tar.gz
gdb/
* exceptions.c (throw_exception): Don't disable the current display. * printcmd.c (disable_current_display_cleanup): New function. (do_one_display): Install a cleanup to disable the current display if doing the display throws. gdb/testsuite/ * gdb.trace/unavailable.exp (test_maybe_regvar_display): New procedure. (gdb_collect_args_test, gdb_collect_locals_test): Use it.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r--gdb/printcmd.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index f1ebb7e9e01..f3765955f60 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1656,6 +1656,14 @@ undisplay_command (char *args, int from_tty)
dont_repeat ();
}
+/* Cleanup that just disables the current display. */
+
+static void
+disable_current_display_cleanup (void *arg)
+{
+ disable_current_display ();
+}
+
/* Display a single auto-display.
Do nothing if the display cannot be printed in the current context,
or if the display is disabled. */
@@ -1663,6 +1671,7 @@ undisplay_command (char *args, int from_tty)
static void
do_one_display (struct display *d)
{
+ struct cleanup *old_chain;
int within_current_scope;
if (d->enabled_p == 0)
@@ -1715,6 +1724,7 @@ do_one_display (struct display *d)
return;
current_display_number = d->number;
+ old_chain = make_cleanup (disable_current_display_cleanup, NULL);
annotate_display_begin ();
printf_filtered ("%d", d->number);
@@ -1782,6 +1792,7 @@ do_one_display (struct display *d)
annotate_display_end ();
gdb_flush (gdb_stdout);
+ discard_cleanups (old_chain);
current_display_number = -1;
}