static void tui_on_normal_stop (struct bpstats *bs, int print_frame) { if (!interp_quiet_p (tui_interp)) { if (print_frame) print_stop_event (tui_ui_out (tui_interp)); } }
static void mi_on_normal_stop (struct bpstats *bs, int print_frame) { /* Since this can be called when CLI command is executing, using cli interpreter, be sure to use MI uiout for output, not the current one. */ struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ()); if (print_frame) { int core; if (current_uiout != mi_uiout) { /* The normal_stop function has printed frame information into CLI uiout, or some other non-MI uiout. There's no way we can extract proper fields from random uiout object, so we print the frame again. In practice, this can only happen when running a CLI command in MI. */ struct ui_out *saved_uiout = current_uiout; struct target_waitstatus last; ptid_t last_ptid; current_uiout = mi_uiout; get_last_target_status (&last_ptid, &last); print_stop_event (&last); current_uiout = saved_uiout; } ui_out_field_int (mi_uiout, "thread-id", pid_to_thread_id (inferior_ptid)); if (non_stop) { struct cleanup *back_to = make_cleanup_ui_out_list_begin_end (mi_uiout, "stopped-threads"); ui_out_field_int (mi_uiout, NULL, pid_to_thread_id (inferior_ptid)); do_cleanups (back_to); } else ui_out_field_string (mi_uiout, "stopped-threads", "all"); core = target_core_of_thread (inferior_ptid); if (core != -1) ui_out_field_int (mi_uiout, "core", core); } fputs_unfiltered ("*stopped", raw_stdout); mi_out_put (mi_uiout, raw_stdout); mi_out_rewind (mi_uiout); mi_print_timing_maybe (); fputs_unfiltered ("\n", raw_stdout); gdb_flush (raw_stdout); }
static void cli_on_normal_stop (struct bpstats *bs, int print_frame) { if (!print_frame) return; SWITCH_THRU_ALL_UIS () { struct interp *interp = top_level_interpreter (); struct cli_interp *cli = as_cli_interp (interp); struct thread_info *thread; if (cli == NULL) continue; thread = inferior_thread (); if (should_print_stop_to_console (interp, thread)) print_stop_event (cli->cli_uiout); } }
static void mi_on_normal_stop (struct bpstats *bs, int print_frame) { /* Since this can be called when CLI command is executing, using cli interpreter, be sure to use MI uiout for output, not the current one. */ struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ()); if (print_frame) { int core; if (current_uiout != mi_uiout) { /* The normal_stop function has printed frame information into CLI uiout, or some other non-MI uiout. There's no way we can extract proper fields from random uiout object, so we print the frame again. In practice, this can only happen when running a CLI command in MI. */ struct ui_out *saved_uiout = current_uiout; struct target_waitstatus last; ptid_t last_ptid; current_uiout = mi_uiout; get_last_target_status (&last_ptid, &last); print_stop_event (&last); current_uiout = saved_uiout; } /* Otherwise, frame information has already been printed by normal_stop. */ else { /* Breakpoint hits should always be mirrored to the console. Deciding what to mirror to the console wrt to breakpoints and random stops gets messy real fast. E.g., say "s" trips on a breakpoint. We'd clearly want to mirror the event to the console in this case. But what about more complicated cases like "s&; thread n; s&", and one of those steps spawning a new thread, and that thread hitting a breakpoint? It's impossible in general to track whether the thread had any relation to the commands that had been executed. So we just simplify and always mirror breakpoints and random events to the console. Also, CLI execution commands (-interpreter-exec console "next", for example) in async mode have the opposite issue as described in the "then" branch above -- normal_stop has already printed frame information to MI uiout, but nothing has printed the same information to the CLI channel. We should print the source line to the console when stepping or other similar commands, iff the step was started by a console command (but not if it was started with -exec-step or similar). */ struct thread_info *tp = inferior_thread (); if ((!tp->control.stop_step && !tp->control.proceed_to_finish) || (tp->control.command_interp != NULL && tp->control.command_interp != top_level_interpreter ())) { struct mi_interp *mi = top_level_interpreter_data (); struct target_waitstatus last; ptid_t last_ptid; struct cleanup *old_chain; /* Set the current uiout to CLI uiout temporarily. */ old_chain = make_cleanup (restore_current_uiout_cleanup, current_uiout); current_uiout = mi->cli_uiout; get_last_target_status (&last_ptid, &last); print_stop_event (&last); do_cleanups (old_chain); } } ui_out_field_int (mi_uiout, "thread-id", pid_to_thread_id (inferior_ptid)); if (non_stop) { struct cleanup *back_to = make_cleanup_ui_out_list_begin_end (mi_uiout, "stopped-threads"); ui_out_field_int (mi_uiout, NULL, pid_to_thread_id (inferior_ptid)); do_cleanups (back_to); } else ui_out_field_string (mi_uiout, "stopped-threads", "all"); core = target_core_of_thread (inferior_ptid); if (core != -1) ui_out_field_int (mi_uiout, "core", core); } fputs_unfiltered ("*stopped", raw_stdout); mi_out_put (mi_uiout, raw_stdout); mi_out_rewind (mi_uiout); mi_print_timing_maybe (); fputs_unfiltered ("\n", raw_stdout); gdb_flush (raw_stdout); }
static void mi_on_normal_stop (struct bpstats *bs, int print_frame) { /* Since this can be called when CLI command is executing, using cli interpreter, be sure to use MI uiout for output, not the current one. */ struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ()); if (print_frame) { struct thread_info *tp; int core; tp = inferior_thread (); if (tp->thread_fsm != NULL && thread_fsm_finished_p (tp->thread_fsm)) { enum async_reply_reason reason; reason = thread_fsm_async_reply_reason (tp->thread_fsm); ui_out_field_string (mi_uiout, "reason", async_reason_lookup (reason)); } print_stop_event (mi_uiout); /* Breakpoint hits should always be mirrored to the console. Deciding what to mirror to the console wrt to breakpoints and random stops gets messy real fast. E.g., say "s" trips on a breakpoint. We'd clearly want to mirror the event to the console in this case. But what about more complicated cases like "s&; thread n; s&", and one of those steps spawning a new thread, and that thread hitting a breakpoint? It's impossible in general to track whether the thread had any relation to the commands that had been executed. So we just simplify and always mirror breakpoints and random events to the console. OTOH, we should print the source line to the console when stepping or other similar commands, iff the step was started by a console command, but not if it was started with -exec-step or similar. */ if ((bpstat_what (tp->control.stop_bpstat).main_action == BPSTAT_WHAT_STOP_NOISY) || !(tp->thread_fsm != NULL && thread_fsm_finished_p (tp->thread_fsm)) || (tp->control.command_interp != NULL && tp->control.command_interp != top_level_interpreter ())) { struct mi_interp *mi = (struct mi_interp *) top_level_interpreter_data (); print_stop_event (mi->cli_uiout); } ui_out_field_int (mi_uiout, "thread-id", pid_to_thread_id (inferior_ptid)); if (non_stop) { struct cleanup *back_to = make_cleanup_ui_out_list_begin_end (mi_uiout, "stopped-threads"); ui_out_field_int (mi_uiout, NULL, pid_to_thread_id (inferior_ptid)); do_cleanups (back_to); } else ui_out_field_string (mi_uiout, "stopped-threads", "all"); core = target_core_of_thread (inferior_ptid); if (core != -1) ui_out_field_int (mi_uiout, "core", core); } fputs_unfiltered ("*stopped", raw_stdout); mi_out_put (mi_uiout, raw_stdout); mi_out_rewind (mi_uiout); mi_print_timing_maybe (); fputs_unfiltered ("\n", raw_stdout); gdb_flush (raw_stdout); }