diff options
author | Pedro Alves <palves@redhat.com> | 2009-03-25 21:42:35 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2009-03-25 21:42:35 +0000 |
commit | d729566a19c83c452f3a962182d1c6d349562159 (patch) | |
tree | 6e824d4e47df13380876593dfc42b6eb34752612 /gdb/mi | |
parent | f04c6d38e2d725d7a813af49883eda0b07a91ad7 (diff) | |
download | gdb-d729566a19c83c452f3a962182d1c6d349562159.zip gdb-d729566a19c83c452f3a962182d1c6d349562159.tar.gz gdb-d729566a19c83c452f3a962182d1c6d349562159.tar.bz2 |
* infrun.c (normal_stop): Use has_stack_frames instead of
target_has_stack.
* mi/mi-main.c (mi_execute_command): Avoid calling inferior_thread
when there is no thread selected.
(mi_cmd_execute): Don't special case commands that can run without
a valid selected thread.
* top.c (execute_command): Don't special case commands that can
run without a valid selected thread. Use has_stack_frames.
* infcmd.c (ensure_valid_thread): New.
(continue_1, step_1, jump_command, signal_command): Use it.
(detach_command): Error out if there's no selected thread/inferior.
* thread.c (print_thread_info): Allow having no thread selected.
(switch_to_thread): Don't read the PC if there is no current thread.
(do_restore_current_thread_cleanup): Don't record the current
frame if there is no current thread.
(make_cleanup_restore_current_thread): Don't read frame info if
there is no selected thread.
(_initialize_thread): Don't mark commands as
"no_selected_thread_ok".
* frame.c (get_current_frame): Error out if there is no valid
selected thread.
(has_stack_frames): Return false if there is no valid
selected thread.
* cli/cli-cmds.c (init_cli_cmds): Don't mark commands as
"no_selected_thread_ok".
* cli/cli-decode.c (set_cmd_no_selected_thread_ok)
(get_cmd_no_selected_thread_ok): Delete.
* cli/cli-decode.h (CMD_NO_SELECTED_THREAD_OK): Delete.
(set_cmd_no_selected_thread_ok, get_cmd_no_selected_thread_ok):
Delete declaration.
* stack.c (get_selected_block): Use has_stack_frames.
Diffstat (limited to 'gdb/mi')
-rw-r--r-- | gdb/mi/mi-main.c | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index d7d8dc4..f7a1380 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -1284,21 +1284,23 @@ mi_execute_command (char *cmd, int from_tty) && strcmp (command->command, "thread-select") != 0) { struct mi_interp *mi = top_level_interpreter_data (); - struct thread_info *ti = inferior_thread (); - int report_change; + int report_change = 0; if (command->thread == -1) { - report_change = !ptid_equal (previous_ptid, null_ptid) - && !ptid_equal (inferior_ptid, previous_ptid); + report_change = (!ptid_equal (previous_ptid, null_ptid) + && !ptid_equal (inferior_ptid, previous_ptid) + && !ptid_equal (inferior_ptid, null_ptid)); } - else + else if (!ptid_equal (inferior_ptid, null_ptid)) { + struct thread_info *ti = inferior_thread (); report_change = (ti->num != command->thread); } if (report_change) { + struct thread_info *ti = inferior_thread (); target_terminal_ours (); fprintf_unfiltered (mi->event_channel, "thread-selected,id=\"%d\"", @@ -1353,28 +1355,7 @@ mi_cmd_execute (struct mi_parse *parse) } if (parse->cmd->argv_func != NULL) - { - if (target_can_async_p () - && target_has_execution - && is_exited (inferior_ptid) - && (strcmp (parse->command, "thread-info") != 0 - && strcmp (parse->command, "thread-list-ids") != 0 - && strcmp (parse->command, "thread-select") != 0 - && strcmp (parse->command, "list-thread-groups") != 0)) - { - struct ui_file *stb; - stb = mem_fileopen (); - - fputs_unfiltered ("Cannot execute command ", stb); - fputstr_unfiltered (parse->command, '"', stb); - fputs_unfiltered (" without a selected thread", stb); - - make_cleanup_ui_file_delete (stb); - error_stream (stb); - } - - parse->cmd->argv_func (parse->command, parse->argv, parse->argc); - } + parse->cmd->argv_func (parse->command, parse->argv, parse->argc); else if (parse->cmd->cli.cmd != 0) { /* FIXME: DELETE THIS. */ |