+2016-01-08 Yao Qi <yao.qi@linaro.org>
+
+ * extension.c: Include target.h.
+ (set_active_ext_lang): Only call install_gdb_sigint_handler,
+ check_quit_flag, and set_quit_flag if target_terminal_is_ours
+ returns false.
+ (restore_active_ext_lang): Likewise.
+ * target.c (target_terminal_is_ours): New function.
+ * target.h (target_terminal_is_ours): Declare.
+
2016-01-07 Maciej W. Rozycki <macro@imgtec.com>
* mips-tdep.c (mips_breakpoint_from_pc): Rename local `status'
#include "defs.h"
#include <signal.h>
+#include "target.h"
#include "auto-load.h"
#include "breakpoint.h"
#include "event-top.h"
= XCNEW (struct active_ext_lang_state);
previous->ext_lang = active_ext_lang;
+ previous->sigint_handler.handler_saved = 0;
active_ext_lang = now_active;
- /* If the newly active extension language uses cooperative SIGINT handling
- then ensure GDB's SIGINT handler is installed. */
- if (now_active->language == EXT_LANG_GDB
- || now_active->ops->check_quit_flag != NULL)
- install_gdb_sigint_handler (&previous->sigint_handler);
-
- /* If there's a SIGINT recorded in the cooperative extension languages,
- move it to the new language, or save it in GDB's global flag if the newly
- active extension language doesn't use cooperative SIGINT handling. */
- if (check_quit_flag ())
- set_quit_flag ();
+ if (target_terminal_is_ours ())
+ {
+ /* If the newly active extension language uses cooperative SIGINT
+ handling then ensure GDB's SIGINT handler is installed. */
+ if (now_active->language == EXT_LANG_GDB
+ || now_active->ops->check_quit_flag != NULL)
+ install_gdb_sigint_handler (&previous->sigint_handler);
+
+ /* If there's a SIGINT recorded in the cooperative extension languages,
+ move it to the new language, or save it in GDB's global flag if the
+ newly active extension language doesn't use cooperative SIGINT
+ handling. */
+ if (check_quit_flag ())
+ set_quit_flag ();
+ }
return previous;
}
active_ext_lang = previous->ext_lang;
- /* Restore the previous SIGINT handler if one was saved. */
- if (previous->sigint_handler.handler_saved)
- install_sigint_handler (&previous->sigint_handler);
-
- /* If there's a SIGINT recorded in the cooperative extension languages,
- move it to the new language, or save it in GDB's global flag if the newly
- active extension language doesn't use cooperative SIGINT handling. */
- if (check_quit_flag ())
- set_quit_flag ();
-
+ if (target_terminal_is_ours ())
+ {
+ /* Restore the previous SIGINT handler if one was saved. */
+ if (previous->sigint_handler.handler_saved)
+ install_sigint_handler (&previous->sigint_handler);
+
+ /* If there's a SIGINT recorded in the cooperative extension languages,
+ move it to the new language, or save it in GDB's global flag if the
+ newly active extension language doesn't use cooperative SIGINT
+ handling. */
+ if (check_quit_flag ())
+ set_quit_flag ();
+ }
xfree (previous);
}