diff options
author | Vladimir Prus <vladimir@codesourcery.com> | 2009-02-14 15:24:44 +0000 |
---|---|---|
committer | Vladimir Prus <vladimir@codesourcery.com> | 2009-02-14 15:24:44 +0000 |
commit | 1d33d6baa4963c315d33807eea8ab33742a90369 (patch) | |
tree | d4952c79cf2d6ae732371322331643bc82ba8512 /gdb/mi | |
parent | faafb0471077b19764561b55cec06713cefd0c07 (diff) | |
download | gdb-1d33d6baa4963c315d33807eea8ab33742a90369.zip gdb-1d33d6baa4963c315d33807eea8ab33742a90369.tar.gz gdb-1d33d6baa4963c315d33807eea8ab33742a90369.tar.bz2 |
Include frame information for *stopped due to CLI commands.
* ada-tasks.c (ada_normal_stop_observer): Adjust prototype.
* infcmd.c (finish_command_continuation): Pass '1' for
'print_frame' parameter to the observer.
* infrun.c (normal_stop): Don't print mi-specific information
here. Pass 'stop_print_frame' to the 'print_frame' parameter
of the observer.
* mi/mi-interp.c (mi_on_normal_stop): Adjust prototype.
If we need to print frame, and current uiout is not the MI one,
print frame again.
Diffstat (limited to 'gdb/mi')
-rw-r--r-- | gdb/mi/mi-interp.c | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index f530176..95dfdf4 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -51,7 +51,7 @@ static void mi1_command_loop (void); static void mi_insert_notify_hooks (void); static void mi_remove_notify_hooks (void); -static void mi_on_normal_stop (struct bpstats *bs); +static void mi_on_normal_stop (struct bpstats *bs, int print_frame); static void mi_new_thread (struct thread_info *t); static void mi_thread_exit (struct thread_info *t); @@ -317,17 +317,46 @@ mi_inferior_exit (int pid) } static void -mi_on_normal_stop (struct bpstats *bs) +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 *uiout = interp_ui_out (top_level_interpreter ()); + struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ()); struct mi_interp *mi = top_level_interpreter_data (); + if (print_frame) + { + if (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 = uiout; + uiout = mi_uiout; + print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC); + 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"); + } + fputs_unfiltered ("*stopped", raw_stdout); - mi_out_put (uiout, raw_stdout); - mi_out_rewind (uiout); + mi_out_put (mi_uiout, raw_stdout); + mi_out_rewind (mi_uiout); fputs_unfiltered ("\n", raw_stdout); gdb_flush (raw_stdout); } |