From d729566a19c83c452f3a962182d1c6d349562159 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 25 Mar 2009 21:42:35 +0000 Subject: * 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. --- gdb/cli/cli-cmds.c | 14 +++++--------- gdb/cli/cli-decode.c | 12 ------------ gdb/cli/cli-decode.h | 11 ----------- 3 files changed, 5 insertions(+), 32 deletions(-) (limited to 'gdb/cli') diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 1b40b4b..18d34bf 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -1248,9 +1248,8 @@ The commands below can be used to select other frames by number or address."), /* Define general commands. */ - c = add_com ("pwd", class_files, pwd_command, _("\ + add_com ("pwd", class_files, pwd_command, _("\ Print working directory. This is used for your program as well.")); - set_cmd_no_selected_thread_ok (c); c = add_cmd ("cd", class_files, cd_command, _("\ Set working directory to DIR for debugger and program being debugged.\n\ @@ -1291,7 +1290,6 @@ when GDB is started."), gdbinit); c = add_com ("help", class_support, help_command, _("Print list of commands.")); set_cmd_completer (c, command_completer); - set_cmd_no_selected_thread_ok (c); add_com_alias ("q", "quit", class_support, 1); add_com_alias ("h", "help", class_support, 1); @@ -1317,19 +1315,17 @@ Without an argument, history expansion is enabled."), show_history_expansion_p, &sethistlist, &showhistlist); - c = add_prefix_cmd ("info", class_info, info_command, _("\ + add_prefix_cmd ("info", class_info, info_command, _("\ Generic command for showing things about the program being debugged."), - &infolist, "info ", 0, &cmdlist); - set_cmd_no_selected_thread_ok (c); + &infolist, "info ", 0, &cmdlist); add_com_alias ("i", "info", class_info, 1); add_com ("complete", class_obscure, complete_command, _("List the completions for the rest of the line as a command.")); - c = add_prefix_cmd ("show", class_info, show_command, _("\ + add_prefix_cmd ("show", class_info, show_command, _("\ Generic command for showing things about the debugger."), - &showlist, "show ", 0, &cmdlist); - set_cmd_no_selected_thread_ok (c); + &showlist, "show ", 0, &cmdlist); /* Another way to get at the same thing. */ add_info ("set", show_command, _("Show all GDB settings.")); diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 8760ebf..4ebf6dc 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -112,18 +112,6 @@ get_cmd_context (struct cmd_list_element *cmd) return cmd->context; } -void -set_cmd_no_selected_thread_ok (struct cmd_list_element *cmd) -{ - cmd->flags |= CMD_NO_SELECTED_THREAD_OK; -} - -int -get_cmd_no_selected_thread_ok (struct cmd_list_element *cmd) -{ - return cmd->flags & CMD_NO_SELECTED_THREAD_OK; -} - enum cmd_types cmd_type (struct cmd_list_element *cmd) { diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h index 26ca2f7..b6475e0 100644 --- a/gdb/cli/cli-decode.h +++ b/gdb/cli/cli-decode.h @@ -48,10 +48,6 @@ cmd_types; #define DEPRECATED_WARN_USER 0x2 #define MALLOCED_REPLACEMENT 0x4 -/* This flag is set if the command is allowed to run when the target - has execution, but there's no selected thread. */ -#define CMD_NO_SELECTED_THREAD_OK 0x10 - struct cmd_list_element { /* Points to next command in this list. */ @@ -259,13 +255,6 @@ extern int cmd_cfunc_eq (struct cmd_list_element *cmd, extern void set_cmd_context (struct cmd_list_element *cmd, void *context); extern void *get_cmd_context (struct cmd_list_element *cmd); -/* Mark command as ok to call when there is no selected thread. There - is no way to disable this once set. */ -extern void set_cmd_no_selected_thread_ok (struct cmd_list_element *); - -/* Return true if command is no-selected-thread-ok. */ -extern int get_cmd_no_selected_thread_ok (struct cmd_list_element *); - extern struct cmd_list_element *lookup_cmd (char **, struct cmd_list_element *, char *, int, int); -- cgit v1.1