diff --git a/gdb/utils.c b/gdb/utils.c index 5188828..b1e08a6 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1292,6 +1292,16 @@ defaulted_query (const char *ctlstr, const char defchar, va_list args) if (!confirm || server_command) return def_value; + if (deprecated_query_hook) + { + int res; + + old_chain = make_cleanup_restore_target_terminal (); + res = deprecated_query_hook (ctlstr, args); + do_cleanups (old_chain); + return res; + } + /* If input isn't coming from the user directly, just say what question we're asking, and then answer the default automatically. This way, important error messages don't get lost when talking to GDB @@ -1314,16 +1324,6 @@ defaulted_query (const char *ctlstr, const char defchar, va_list args) return def_value; } - if (deprecated_query_hook) - { - int res; - - old_chain = make_cleanup_restore_target_terminal (); - res = deprecated_query_hook (ctlstr, args); - do_cleanups (old_chain); - return res; - } - /* Format the question outside of the loop, to avoid reusing args. */ question = xstrvprintf (ctlstr, args); old_chain = make_cleanup (xfree, question);