aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1994-03-24 15:00:52 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1994-03-24 15:00:52 +0000
commit0997322359c7bba03dd0c50d51d80ff7adae1cdf (patch)
treeebc2f6676d65c09cbb4824d5cb9ef390a8e7a8a8 /gdb
parentad15bea9df8294fe18f69b43f0aba5582a44e807 (diff)
downloadgdb-0997322359c7bba03dd0c50d51d80ff7adae1cdf.zip
gdb-0997322359c7bba03dd0c50d51d80ff7adae1cdf.tar.gz
gdb-0997322359c7bba03dd0c50d51d80ff7adae1cdf.tar.bz2
* main.c (complete_command): New command, from Rick Sladkey
<jrs@world.std.com>. (symbol_completion_function): Don't declare rl_point and rl_line_buffer; they are now declared in readline.h. (show_commands): Don't declare history_base; it is declared in history.h. * command.c (lookup_cmd): Don't delete trailing whitespace.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog16
-rw-r--r--gdb/command.c3
-rw-r--r--gdb/main.c37
3 files changed, 50 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2796397..df51834 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,21 @@
Wed Mar 23 07:50:33 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
+ * main.c (complete_command): New command, from Rick Sladkey
+ <jrs@world.std.com>.
+ (symbol_completion_function): Don't declare rl_point and
+ rl_line_buffer; they are now declared in readline.h.
+ (show_commands): Don't declare history_base; it is declared in
+ history.h.
+ * command.c (lookup_cmd): Don't delete trailing whitespace.
+
+Wed Mar 23 16:14:52 1994 Stu Grossman (grossman at cygnus.com)
+
+ * minsyms.c (prim_record_minimal_symbol): Move section deduction
+ code from prim_record_minimal_symbol_and_info() to here. Callers
+ of the latter can legitimately supply a section number of -1.
+
+Wed Mar 23 07:50:33 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
+
* gdbtypes.h, gdbtypes.c: Add comments regarding whether static
member functions have an element in args for a (nonexistent) this
pointer.
diff --git a/gdb/command.c b/gdb/command.c
index 2cf2813..d82f1fd 100644
--- a/gdb/command.c
+++ b/gdb/command.c
@@ -684,12 +684,15 @@ lookup_cmd (line, list, cmdtype, allow_unknown, ignore_help_classes)
struct cmd_list_element *last_list = 0;
struct cmd_list_element *c =
lookup_cmd_1 (line, list, &last_list, ignore_help_classes);
+#if 0
+ /* This is wrong for complete_command. */
char *ptr = (*line) + strlen (*line) - 1;
/* Clear off trailing whitespace. */
while (ptr >= *line && (*ptr == ' ' || *ptr == '\t'))
ptr--;
*(ptr + 1) = '\0';
+#endif
if (!c)
{
diff --git a/gdb/main.c b/gdb/main.c
index edefa30..96b6cde 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -40,8 +40,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* readline defines this. */
#undef savestring
-#ifdef USG
#include <sys/types.h>
+#ifdef USG
+/* What is this for? X_OK? */
#include <unistd.h>
#endif
@@ -147,6 +148,9 @@ static void
info_command PARAMS ((char *, int));
static void
+complete_command PARAMS ((char *, int));
+
+static void
do_nothing PARAMS ((int));
static int
@@ -856,7 +860,6 @@ GDB manual (available as on-line info or a printed manual).\n", gdb_stdout);
if (!SET_TOP_LEVEL ())
{
cd_command (cdarg, 0);
- init_source_path ();
}
}
do_cleanups (ALL_CLEANUPS);
@@ -1323,7 +1326,7 @@ filename_completer (text, word)
"p b-a" ambiguous (all symbols starting with a)
"p b-" ambiguous (all symbols)
"file Make" "file" (word break hard to screw up here)
- "file ../gdb.stabs/wi" "erd" (needs to not break word at slash)
+ "file ../gdb.stabs/we" "ird" (needs to not break word at slash)
*/
/* Generate completions one by one for the completer. Each time we are
@@ -1359,8 +1362,6 @@ symbol_completion_function (text, matches)
/* Pointer within tmp_command which corresponds to text. */
char *word;
struct cmd_list_element *c, *result_list;
- extern char *rl_line_buffer;
- extern int rl_point;
if (matches == 0)
{
@@ -1973,6 +1974,28 @@ info_command (arg, from_tty)
help_list (infolist, "info ", -1, gdb_stdout);
}
+/* The "complete" command is used by Emacs to implement completion. */
+
+/* ARGSUSED */
+static void
+complete_command (arg, from_tty)
+ char *arg;
+ int from_tty;
+{
+ int i;
+ char *completion;
+
+ dont_repeat ();
+
+ strcpy (rl_line_buffer, arg);
+ rl_point = strlen (arg);
+
+ for (completion = symbol_completion_function (rl_line_buffer, i = 0);
+ completion;
+ completion = symbol_completion_function (rl_line_buffer, ++i))
+ printf_unfiltered ("%s\n", completion);
+}
+
/* The "show" command with no arguments shows all the settings. */
/* ARGSUSED */
@@ -2492,7 +2515,6 @@ show_commands (args, from_tty)
int hist_len;
extern HIST_ENTRY *history_get PARAMS ((int));
- extern int history_base;
/* Print out some of the commands from the command history. */
/* First determine the length of the history list. */
@@ -2856,6 +2878,9 @@ ie. the number of previous commands to keep a record of.", &sethistlist);
&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.");
+
add_prefix_cmd ("show", class_info, show_command,
"Generic command for showing things about the debugger.",
&showlist, "show ", 0, &cmdlist);