diff options
author | Peter Schauer <Peter.Schauer@mytum.de> | 1994-10-29 09:51:32 +0000 |
---|---|---|
committer | Peter Schauer <Peter.Schauer@mytum.de> | 1994-10-29 09:51:32 +0000 |
commit | 9ed8604f38b6ffad8600789ce048a0f4e12c4e5d (patch) | |
tree | 4170b1e4143f1cce5c5217ed09b7f1036f346205 /gdb/top.c | |
parent | b7966a5adc3cbf38544dca97a9025df896a3db4c (diff) | |
download | gdb-9ed8604f38b6ffad8600789ce048a0f4e12c4e5d.zip gdb-9ed8604f38b6ffad8600789ce048a0f4e12c4e5d.tar.gz gdb-9ed8604f38b6ffad8600789ce048a0f4e12c4e5d.tar.bz2 |
* top.c (line_completion_function): Renamed from
symbol_completion_function, takes the line buffer and the
point in the line buffer as additional arguments.
(readline_line_completion_function): New function, interface
between readline and line_completion_function.
(init_main): Use it.
(complete_command): Use line_completion_function instead of
abusing rl_line_buffer. Free completion strings after printing
them.
* symtab.c (completion_list_add_name): Recheck for duplicates
if we intend to add a modified symbol.
* gdbtypes.h (cplus_struct_type): nfn_fields_total no longer
includes the number of methods from the baseclasses.
* stabsread.c (attach_fn_fields_to_type): No longer add the
number of methods from the baseclasses to TYPE_NFN_FIELDS_TOTAL,
the baseclass type might not have been completely filled in yet.
* symtab.c (total_number_of_methods): New function to compute
the total number of methods for a type, including the methods
from baseclasses.
(decode_line_1): Use it instead of TYPE_NFN_FIELDS_TOTAL to
allocate the symbol array for find_methods.
* stabsread.c (scan_file_globals): Add default case to minimal
symbol type switch, to avoid gcc -Wall warnings.
* config/rs6000/tm-rs6000.h (INIT_EXTRA_FRAME_INFO):
Don't test for zero backchain pointer to recognize a signal
handler frame, if read() gets interrupted by a signal, the
backchain will be non zero.
(SIG_FRAME_FP_OFFSET): Move to here from rs6000-tdep.c,
improve comment.
(SIG_FRAME_PC_OFFSET): New definition.
(FRAME_SAVED_PC): Return saved pc from sigcontext if this
is a signal handler frame.
* rs6000-tdep.c (function_frame_info): Do not error out
if we can't access the instructions.
* config/rs6000/tm-rs6000.h (CONVERT_FROM_FUNC_PTR_ADDR):
New definition to get the function address from a function pointer.
* valops.c (find_function_addr): Use it when calling a user
function through a function pointer.
Diffstat (limited to 'gdb/top.c')
-rw-r--r-- | gdb/top.c | 77 |
1 files changed, 44 insertions, 33 deletions
@@ -58,7 +58,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Prototypes for local functions */ -static char * symbol_completion_function PARAMS ((char *, int)); +static char * line_completion_function PARAMS ((char *, int, char *, int)); + +static char * readline_line_completion_function PARAMS ((char *, int)); static void command_loop_marker PARAMS ((int)); @@ -1169,30 +1171,32 @@ filename_completer (text, word) */ /* Generate completions one by one for the completer. Each time we are - called return another potential completion to the caller. The function - is misnamed; it just completes on commands or passes the buck to the - command's completer function; the stuff specific to symbol completion + called return another potential completion to the caller. + line_completion just completes on commands or passes the buck to the + command's completer function, the stuff specific to symbol completion is in make_symbol_completion_list. - TEXT is readline's idea of the "word" we are looking at; we don't really - like readline's ideas about word breaking so we ignore it. + TEXT is the caller's idea of the "word" we are looking at. MATCHES is the number of matches that have currently been collected from calling this completion function. When zero, then we need to initialize, otherwise the initialization has already taken place and we can just return the next potential completion string. - Returns NULL if there are no more completions, else a pointer to a string - which is a possible completion. + LINE_BUFFER is available to be looked at; it contains the entire text + of the line. POINT is the offset in that line of the cursor. You + should pretend that the line ends at POINT. - RL_LINE_BUFFER is available to be looked at; it contains the entire text - of the line. RL_POINT is the offset in that line of the cursor. You - should pretend that the line ends at RL_POINT. */ + Returns NULL if there are no more completions, else a pointer to a string + which is a possible completion, it is the caller's responsibility to + free the string. */ static char * -symbol_completion_function (text, matches) +line_completion_function (text, matches, line_buffer, point) char *text; int matches; + char *line_buffer; + int point; { static char **list = (char **)NULL; /* Cache of completions */ static int index; /* Next cached completion */ @@ -1228,17 +1232,17 @@ symbol_completion_function (text, matches) gdb_completer_word_break_characters; /* Decide whether to complete on a list of gdb commands or on symbols. */ - tmp_command = (char *) alloca (rl_point + 1); + tmp_command = (char *) alloca (point + 1); p = tmp_command; - strncpy (tmp_command, rl_line_buffer, rl_point); - tmp_command[rl_point] = '\0'; + strncpy (tmp_command, line_buffer, point); + tmp_command[point] = '\0'; /* Since text always contains some number of characters leading up - to rl_point, we can find the equivalent position in tmp_command + to point, we can find the equivalent position in tmp_command by subtracting that many characters from the end of tmp_command. */ - word = tmp_command + rl_point - strlen (text); + word = tmp_command + point - strlen (text); - if (rl_point == 0) + if (point == 0) { /* An empty line we want to consider ambiguous; that is, it could be any command. */ @@ -1271,7 +1275,7 @@ symbol_completion_function (text, matches) q = p; while (*q && (isalnum (*q) || *q == '-' || *q == '_')) ++q; - if (q != tmp_command + rl_point) + if (q != tmp_command + point) { /* There is something beyond the ambiguous command, so there are no possible completions. For @@ -1303,7 +1307,7 @@ symbol_completion_function (text, matches) { /* We've recognized a full command. */ - if (p == tmp_command + rl_point) + if (p == tmp_command + point) { /* There is no non-whitespace in the line beyond the command. */ @@ -1402,6 +1406,16 @@ symbol_completion_function (text, matches) return (output); } +/* Line completion interface function for readline. */ + +static char * +readline_line_completion_function (text, matches) + char *text; + int matches; +{ + return line_completion_function (text, matches, rl_line_buffer, rl_point); +} + /* Skip over a possibly quoted word (as defined by the quote characters and word break characters the completer uses). Returns pointer to the location after the "word". */ @@ -2137,25 +2151,22 @@ complete_command (arg, from_tty) int from_tty; { int i; + int argpoint; char *completion; dont_repeat (); if (arg == NULL) - { - rl_line_buffer[0] = '\0'; - rl_point = 0; - } - else - { - strcpy (rl_line_buffer, arg); - rl_point = strlen (arg); - } + arg = ""; + argpoint = strlen (arg); - for (completion = symbol_completion_function (rl_line_buffer, i = 0); + for (completion = line_completion_function (arg, i = 0, arg, argpoint); completion; - completion = symbol_completion_function (rl_line_buffer, ++i)) - printf_unfiltered ("%s\n", completion); + completion = line_completion_function (arg, ++i, arg, argpoint)) + { + printf_unfiltered ("%s\n", completion); + free (completion); + } } /* The "show" command with no arguments shows all the settings. */ @@ -3005,7 +3016,7 @@ init_main () write_history_p = 0; /* Setup important stuff for command line editing. */ - rl_completion_entry_function = (int (*)()) symbol_completion_function; + rl_completion_entry_function = (int (*)()) readline_line_completion_function; rl_completer_word_break_characters = gdb_completer_word_break_characters; rl_completer_quote_characters = gdb_completer_quote_characters; rl_readline_name = "gdb"; |