X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fcli%2Fcli-cmds.c;h=dcf53694f409db9db989fd752a34e2f8c6a20754;hb=9bf4bce9847504467f8af7e3c7886cce1794dbad;hp=2968662ab312198ff2037c59433c348fbc5ed147;hpb=b2a3b50908b8bfc54f21abfba0c351a41d6ef65f;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 2968662ab3..dcf53694f4 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -96,7 +96,7 @@ static void filter_sals (struct symtabs_and_lines *); /* Limit the call depth of user-defined commands */ -int max_user_call_depth; +unsigned int max_user_call_depth; /* Define all cmd_list_elements. */ @@ -136,10 +136,6 @@ struct cmd_list_element *detachlist; struct cmd_list_element *killlist; -/* Chain containing all defined "enable breakpoint" subcommands. */ - -struct cmd_list_element *enablebreaklist; - /* Chain containing all defined set subcommands */ struct cmd_list_element *setlist; @@ -188,8 +184,6 @@ struct cmd_list_element *setchecklist; struct cmd_list_element *showchecklist; -struct cmd_list_element *skiplist; - /* Command tracing state. */ int source_verbose = 0; @@ -254,7 +248,8 @@ static void complete_command (char *arg, int from_tty) { int argpoint; - char **completions, *point, *arg_prefix; + char *point, *arg_prefix; + VEC (char_ptr) *completions; dont_repeat (); @@ -282,33 +277,30 @@ complete_command (char *arg, int from_tty) if (completions) { - int item, size; + int ix, size = VEC_length (char_ptr, completions); + char *item, *prev = NULL; - for (size = 0; completions[size]; ++size) - ; - qsort (completions, size, sizeof (char *), compare_strings); + qsort (VEC_address (char_ptr, completions), size, + sizeof (char *), compare_strings); /* We do extra processing here since we only want to print each unique item once. */ - item = 0; - while (item < size) + for (ix = 0; VEC_iterate (char_ptr, completions, ix, item); ++ix) { int next_item; - printf_unfiltered ("%s%s\n", arg_prefix, completions[item]); - next_item = item + 1; - while (next_item < size - && ! strcmp (completions[item], completions[next_item])) + if (prev == NULL || strcmp (item, prev) != 0) { - xfree (completions[next_item]); - ++next_item; + printf_unfiltered ("%s%s\n", arg_prefix, item); + xfree (prev); + prev = item; } - - xfree (completions[item]); - item = next_item; + else + xfree (item); } - xfree (completions); + xfree (prev); + VEC_free (char_ptr, completions); } } @@ -321,10 +313,8 @@ is_complete_command (struct cmd_list_element *c) static void show_version (char *args, int from_tty) { - immediate_quit++; print_gdb_version (gdb_stdout); printf_filtered ("\n"); - immediate_quit--; } /* Handle the quit command. */ @@ -369,7 +359,7 @@ cd_command (char *dir, int from_tty) dont_repeat (); if (dir == 0) - error_no_arg (_("new working directory")); + dir = "~"; dir = tilde_expand (dir); make_cleanup (xfree, dir); @@ -963,7 +953,7 @@ list_command (char *arg, int from_tty) else sals_end = decode_line_1 (&arg1, DECODE_LINE_LIST_MODE, sal.symtab, sal.line); - filter_sals (&sals); + filter_sals (&sals_end); if (sals_end.nelts == 0) return; if (sals_end.nelts > 1) @@ -1101,7 +1091,7 @@ disassemble_current_function (int flags) frame = get_selected_frame (_("No frame selected.")); gdbarch = get_frame_arch (frame); - pc = get_frame_pc (frame); + pc = get_frame_address_in_block (frame); if (find_pc_partial_function (pc, &name, &low, &high) == 0) error (_("No function contains program counter for selected frame.")); #if defined(TUI) @@ -1425,7 +1415,6 @@ alias_command (char *args, int from_tty) } else { - int i; dyn_string_t alias_prefix_dyn_string, command_prefix_dyn_string; char *alias_prefix, *command_prefix; struct cmd_list_element *c_alias, *c_command; @@ -1545,13 +1534,14 @@ filter_sals (struct symtabs_and_lines *sals) ++out; } } - sals->nelts = out; if (sals->nelts == 0) { xfree (sals->sals); sals->sals = NULL; } + else + sals->nelts = out; } static void @@ -1581,7 +1571,6 @@ init_cmd_lists (void) stoplist = NULL; deletelist = NULL; detachlist = NULL; - enablebreaklist = NULL; setlist = NULL; unsetlist = NULL; showlist = NULL; @@ -1595,7 +1584,6 @@ init_cmd_lists (void) showprintlist = NULL; setchecklist = NULL; showchecklist = NULL; - skiplist = NULL; } static void @@ -1838,14 +1826,15 @@ is displayed."), show_remote_debug, &setdebuglist, &showdebuglist); - add_setshow_integer_cmd ("remotetimeout", no_class, &remote_timeout, _("\ + add_setshow_zuinteger_unlimited_cmd ("remotetimeout", no_class, + &remote_timeout, _("\ Set timeout limit to wait for target to respond."), _("\ Show timeout limit to wait for target to respond."), _("\ This value is used to set the time limit for gdb to wait for a response\n\ from the target."), - NULL, - show_remote_timeout, - &setlist, &showlist); + NULL, + show_remote_timeout, + &setlist, &showlist); add_prefix_cmd ("debug", no_class, set_debug, _("Generic command for setting gdb debugging flags"), @@ -1919,13 +1908,13 @@ With no argument, show definitions of all user defined commands."), &showlist); add_com ("apropos", class_support, apropos_command, _("Search for commands matching a REGEXP")); - add_setshow_integer_cmd ("max-user-call-depth", no_class, + add_setshow_uinteger_cmd ("max-user-call-depth", no_class, &max_user_call_depth, _("\ Set the max call depth for non-python user-defined commands."), _("\ Show the max call depth for non-python user-defined commands."), NULL, - NULL, - show_max_user_call_depth, - &setlist, &showlist); + NULL, + show_max_user_call_depth, + &setlist, &showlist); add_setshow_boolean_cmd ("trace-commands", no_class, &trace_commands, _("\ Set tracing of GDB CLI commands."), _("\