diff options
author | Elena Zannoni <ezannoni@kwikemart.cygnus.com> | 2004-03-23 20:41:49 +0000 |
---|---|---|
committer | Elena Zannoni <ezannoni@kwikemart.cygnus.com> | 2004-03-23 20:41:49 +0000 |
commit | 00687ffd41edb1fe6a9a95e2829028cb76fe876c (patch) | |
tree | 4c52196ee5d91da73744d9260bc180ae3ef36ee7 /gdb/cli/cli-cmds.c | |
parent | c91b2753f60a854d8f3517630465e7fc4d4490a9 (diff) | |
download | fsf-binutils-gdb-ezannoni_pie-20030916-branch.zip fsf-binutils-gdb-ezannoni_pie-20030916-branch.tar.gz fsf-binutils-gdb-ezannoni_pie-20030916-branch.tar.bz2 |
merge mainline changes into branchezannoni_pie-20030916-branch
Diffstat (limited to 'gdb/cli/cli-cmds.c')
-rw-r--r-- | gdb/cli/cli-cmds.c | 73 |
1 files changed, 42 insertions, 31 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 45794f7..9378ac8 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -1,6 +1,6 @@ /* GDB CLI commands. - Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -20,7 +20,8 @@ Boston, MA 02111-1307, USA. */ #include "defs.h" -#include <readline/tilde.h> +#include "readline/readline.h" +#include "readline/tilde.h" #include "completer.h" #include "target.h" /* For baud_rate, remote_debug and remote_timeout */ #include "gdb_wait.h" /* For shell escape implementation */ @@ -45,6 +46,10 @@ #include "cli/cli-setshow.h" #include "cli/cli-cmds.h" +#ifdef TUI +#include "tui/tui.h" /* For tui_active et.al. */ +#endif + #ifndef GDBINIT_FILENAME #define GDBINIT_FILENAME ".gdbinit" #endif @@ -59,8 +64,6 @@ static void pwd_command (char *, int); static void show_version (char *, int); -static void validate_comname (char *); - static void help_command (char *, int); static void show_command (char *, int); @@ -184,7 +187,6 @@ error_no_arg (char *why) /* The "info" command is defined as a prefix, with allow_unknown = 0. Therefore, its own definition is called only for "info" with no args. */ -/* ARGSUSED */ static void info_command (char *arg, int from_tty) { @@ -194,7 +196,6 @@ info_command (char *arg, int from_tty) /* The "show" command with no arguments shows all the settings. */ -/* ARGSUSED */ static void show_command (char *arg, int from_tty) { @@ -204,7 +205,6 @@ show_command (char *arg, int from_tty) /* Provide documentation on command or list given by COMMAND. FROM_TTY is ignored. */ -/* ARGSUSED */ static void help_command (char *command, int from_tty) { @@ -222,13 +222,12 @@ compare_strings (const void *arg1, const void *arg2) /* The "complete" command is used by Emacs to implement completion. */ -/* ARGSUSED */ static void complete_command (char *arg, int from_tty) { int i; int argpoint; - char **completions; + char **completions, *point, *arg_prefix; dont_repeat (); @@ -236,7 +235,23 @@ complete_command (char *arg, int from_tty) arg = ""; argpoint = strlen (arg); - completions = complete_line (arg, arg, argpoint); + /* complete_line assumes that its first argument is somewhere within, + and except for filenames at the beginning of, the word to be completed. + The following crude imitation of readline's word-breaking tries to + accomodate this. */ + point = arg + argpoint; + while (point > arg) + { + if (strchr (rl_completer_word_break_characters, point[-1]) != 0) + break; + point--; + } + + arg_prefix = alloca (point - arg + 1); + memcpy (arg_prefix, arg, point - arg); + arg_prefix[point - arg] = 0; + + completions = complete_line (point, arg, argpoint); if (completions) { @@ -252,7 +267,7 @@ complete_command (char *arg, int from_tty) while (item < size) { int next_item; - printf_unfiltered ("%s\n", completions[item]); + printf_unfiltered ("%s%s\n", arg_prefix, completions[item]); next_item = item + 1; while (next_item < size && ! strcmp (completions[item], completions[next_item])) @@ -275,7 +290,6 @@ is_complete_command (struct cmd_list_element *c) return cmd_cfunc_eq (c, complete_command); } -/* ARGSUSED */ static void show_version (char *args, int from_tty) { @@ -295,7 +309,6 @@ quit_command (char *args, int from_tty) quit_force (args, from_tty); } -/* ARGSUSED */ static void pwd_command (char *args, int from_tty) { @@ -303,7 +316,7 @@ pwd_command (char *args, int from_tty) error ("The \"pwd\" command does not take an argument: %s", args); getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)); - if (!STREQ (gdb_dirbuf, current_directory)) + if (strcmp (gdb_dirbuf, current_directory) != 0) printf_unfiltered ("Working directory %s\n (canonically %s).\n", current_directory, gdb_dirbuf); else @@ -439,12 +452,11 @@ source_command (char *args, int from_tty) do_cleanups (old_cleanups); } -/* ARGSUSED */ static void echo_command (char *text, int from_tty) { char *p = text; - register int c; + int c; if (text) while ((c = *p++) != '\0') @@ -469,7 +481,6 @@ echo_command (char *text, int from_tty) gdb_flush (gdb_stdout); } -/* ARGSUSED */ static void shell_escape (char *arg, int from_tty) { @@ -514,9 +525,9 @@ shell_escape (char *arg, int from_tty) p++; /* Get past '/' */ if (!arg) - execl (user_shell, p, 0); + execl (user_shell, p, (char *) 0); else - execl (user_shell, p, "-c", arg, 0); + execl (user_shell, p, "-c", arg, (char *) 0); fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", user_shell, safe_strerror (errno)); @@ -565,7 +576,7 @@ edit_command (char *arg, int from_tty) /* Now should only be one argument -- decode it in SAL */ arg1 = arg; - sals = decode_line_1 (&arg1, 0, 0, 0, 0); + sals = decode_line_1 (&arg1, 0, 0, 0, 0, 0); if (! sals.nelts) return; /* C++ */ if (sals.nelts > 1) { @@ -659,7 +670,7 @@ list_command (char *arg, int from_tty) /* "l" or "l +" lists next ten lines. */ - if (arg == 0 || STREQ (arg, "+")) + if (arg == 0 || strcmp (arg, "+") == 0) { print_source_lines (cursal.symtab, cursal.line, cursal.line + get_lines_to_list (), 0); @@ -667,7 +678,7 @@ list_command (char *arg, int from_tty) } /* "l -" lists previous ten lines, the ones before the ten just listed. */ - if (STREQ (arg, "-")) + if (strcmp (arg, "-") == 0) { print_source_lines (cursal.symtab, max (get_first_line_listed () - get_lines_to_list (), 1), @@ -689,7 +700,7 @@ list_command (char *arg, int from_tty) dummy_beg = 1; else { - sals = decode_line_1 (&arg1, 0, 0, 0, 0); + sals = decode_line_1 (&arg1, 0, 0, 0, 0, 0); if (!sals.nelts) return; /* C++ */ @@ -722,9 +733,9 @@ list_command (char *arg, int from_tty) else { if (dummy_beg) - sals_end = decode_line_1 (&arg1, 0, 0, 0, 0); + sals_end = decode_line_1 (&arg1, 0, 0, 0, 0, 0); else - sals_end = decode_line_1 (&arg1, 0, sal.symtab, sal.line, 0); + sals_end = decode_line_1 (&arg1, 0, sal.symtab, sal.line, 0, 0); if (sals_end.nelts == 0) return; if (sals_end.nelts > 1) @@ -820,7 +831,6 @@ list_command (char *arg, int from_tty) Two arguments are interpeted as bounds within which to dump assembly. */ -/* ARGSUSED */ static void disassemble_command (char *arg, int from_tty) { @@ -844,8 +854,9 @@ disassemble_command (char *arg, int from_tty) #if defined(TUI) /* NOTE: cagney/2003-02-13 The `tui_active' was previously `tui_version'. */ - else if (tui_active) - low = tuiGetLowDisassemblyAddress (low, pc); + if (tui_active) + /* FIXME: cagney/2004-02-07: This should be an observer. */ + low = tui_get_low_disassembly_address (low, pc); #endif low += FUNCTION_START_OFFSET; } @@ -858,8 +869,9 @@ disassemble_command (char *arg, int from_tty) #if defined(TUI) /* NOTE: cagney/2003-02-13 The `tui_active' was previously `tui_version'. */ - else if (tui_active) - low = tuiGetLowDisassemblyAddress (low, pc); + if (tui_active) + /* FIXME: cagney/2004-02-07: This should be an observer. */ + low = tui_get_low_disassembly_address (low, pc); #endif low += FUNCTION_START_OFFSET; } @@ -920,7 +932,6 @@ make_command (char *arg, int from_tty) shell_escape (p, from_tty); } -/* ARGSUSED */ static void show_user (char *args, int from_tty) { |