diff options
author | Pedro Alves <palves@redhat.com> | 2012-05-24 15:54:57 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2012-05-24 15:54:57 +0000 |
commit | b09846a918b74f0371149f730f8b391548b11a8d (patch) | |
tree | 500e64b3c7699c52fb8c23aaad473a0c7eb6708d /gdb | |
parent | 16224acd5cc40286a5e9b95704481a36b36fe6bd (diff) | |
download | gdb-b09846a918b74f0371149f730f8b391548b11a8d.zip gdb-b09846a918b74f0371149f730f8b391548b11a8d.tar.gz gdb-b09846a918b74f0371149f730f8b391548b11a8d.tar.bz2 |
2012-05-24 Pedro Alves <palves@redhat.com>
PR tui/14159
* tui/tui-hooks.c (tui_query_hook): Pre-compute the question
string, instead of reusing the va_list argument.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/tui/tui-hooks.c | 11 |
2 files changed, 17 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 18ae7f4..45c8605 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2012-05-24 Pedro Alves <palves@redhat.com> + + PR tui/14159 + + * tui/tui-hooks.c (tui_query_hook): Pre-compute the question + string, instead of reusing the va_list argument. + 2012-05-24 Tom Tromey <tromey@redhat.com> * cp-support.h (cp_finalize_namespace, cp_initialize_namespace): diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c index 17a9593..4d1e063 100644 --- a/gdb/tui/tui-hooks.c +++ b/gdb/tui/tui-hooks.c @@ -69,6 +69,13 @@ tui_query_hook (const char *msg, va_list argp) int retval; int ans2; int answer; + char *question; + struct cleanup *old_chain; + + /* Format the question outside of the loop, to avoid reusing + ARGP. */ + question = xstrvprintf (msg, argp); + old_chain = make_cleanup (xfree, question); echo (); while (1) @@ -76,7 +83,7 @@ tui_query_hook (const char *msg, va_list argp) wrap_here (""); /* Flush any buffered output. */ gdb_flush (gdb_stdout); - vfprintf_filtered (gdb_stdout, msg, argp); + fputs_filtered (question, gdb_stdout); printf_filtered (_("(y or n) ")); wrap_here (""); @@ -113,6 +120,8 @@ tui_query_hook (const char *msg, va_list argp) printf_filtered (_("Please answer y or n.\n")); } noecho (); + + do_cleanups (old_chain); return retval; } |