More updated translations
[binutils-gdb.git] / gdb / completer.h
blob07953f1e2ee884d3311bc9673e876b1d40564f3f
1 /* Header for GDB line completion.
2 Copyright (C) 2000-2024 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 #ifndef GDB_COMPLETER_H
18 #define GDB_COMPLETER_H
20 #include "gdbsupport/gdb-hashtab.h"
21 #include "command.h"
23 /* Types of functions in struct match_list_displayer. */
25 struct match_list_displayer;
27 typedef void mld_crlf_ftype (const struct match_list_displayer *);
28 typedef void mld_putch_ftype (const struct match_list_displayer *, int);
29 typedef void mld_puts_ftype (const struct match_list_displayer *,
30 const char *);
31 typedef void mld_flush_ftype (const struct match_list_displayer *);
32 typedef void mld_erase_entire_line_ftype (const struct match_list_displayer *);
33 typedef void mld_beep_ftype (const struct match_list_displayer *);
34 typedef int mld_read_key_ftype (const struct match_list_displayer *);
36 /* Interface between CLI/TUI and gdb_match_list_displayer. */
38 struct match_list_displayer
40 /* The screen dimensions to work with when displaying matches. */
41 int height, width;
43 /* Print cr,lf. */
44 mld_crlf_ftype *crlf;
46 /* Not "putc" to avoid issues where it is a stdio macro. Sigh. */
47 mld_putch_ftype *putch;
49 /* Print a string. */
50 mld_puts_ftype *puts;
52 /* Flush all accumulated output. */
53 mld_flush_ftype *flush;
55 /* Erase the currently line on the terminal (but don't discard any text the
56 user has entered, readline may shortly re-print it). */
57 mld_erase_entire_line_ftype *erase_entire_line;
59 /* Ring the bell. */
60 mld_beep_ftype *beep;
62 /* Read one key. */
63 mld_read_key_ftype *read_key;
66 /* A list of completion candidates. Each element is a malloc string,
67 because ownership of the strings is transferred to readline, which
68 calls free on each element. */
69 typedef std::vector<gdb::unique_xmalloc_ptr<char>> completion_list;
71 /* The result of a successful completion match. When doing symbol
72 comparison, we use the symbol search name for the symbol name match
73 check, but the matched name that is shown to the user may be
74 different. For example, Ada uses encoded names for lookup, but
75 then wants to decode the symbol name to show to the user, and also
76 in some cases wrap the matched name in "<sym>" (meaning we can't
77 always use the symbol's print name). */
79 class completion_match
81 public:
82 /* Get the completion match result. See m_match/m_storage's
83 descriptions. */
84 const char *match ()
85 { return m_match; }
87 /* Set the completion match result. See m_match/m_storage's
88 descriptions. */
89 void set_match (const char *match)
90 { m_match = match; }
92 /* Get temporary storage for generating a match result, dynamically.
93 The built string is only good until the next clear() call. I.e.,
94 good until the next symbol comparison. */
95 std::string &storage ()
96 { return m_storage; }
98 /* Prepare for another completion matching sequence. */
99 void clear ()
101 m_match = NULL;
102 m_storage.clear ();
105 private:
106 /* The completion match result. This can either be a pointer into
107 M_STORAGE string, or it can be a pointer into the some other
108 string that outlives the completion matching sequence (usually, a
109 pointer to a symbol's name). */
110 const char *m_match;
112 /* Storage a symbol comparison routine can use for generating a
113 match result, dynamically. The built string is only good until
114 the next clear() call. I.e., good until the next symbol
115 comparison. */
116 std::string m_storage;
119 /* The result of a successful completion match, but for least common
120 denominator (LCD) computation. Some completers provide matches
121 that don't start with the completion "word". E.g., completing on
122 "b push_ba" on a C++ program usually completes to
123 std::vector<...>::push_back, std::string::push_back etc. In such
124 case, the symbol comparison routine will set the LCD match to point
125 into the "push_back" substring within the symbol's name string.
126 Also, in some cases, the symbol comparison routine will want to
127 ignore parts of the symbol name for LCD purposes, such as for
128 example symbols with abi tags in C++. In such cases, the symbol
129 comparison routine will set MARK_IGNORED_RANGE to mark the ignored
130 substrings of the matched string. The resulting LCD string with
131 the ignored parts stripped out is computed at the end of a
132 completion match sequence iff we had a positive match. */
134 class completion_match_for_lcd
136 public:
137 /* Get the resulting LCD, after a successful match. */
138 const char *match ()
139 { return m_match; }
141 /* Set the match for LCD. See m_match's description. */
142 void set_match (const char *match)
143 { m_match = match; }
145 /* Mark the range between [BEGIN, END) as ignored. */
146 void mark_ignored_range (const char *begin, const char *end)
148 gdb_assert (begin < end);
149 gdb_assert (m_ignored_ranges.empty ()
150 || m_ignored_ranges.back ().second < begin);
151 m_ignored_ranges.emplace_back (begin, end);
154 /* Get the resulting LCD, after a successful match. If there are
155 ignored ranges, then this builds a new string with the ignored
156 parts removed (and stores it internally). As such, the result of
157 this call is only good for the current completion match
158 sequence. */
159 const char *finish ()
161 if (m_ignored_ranges.empty ())
162 return m_match;
163 else
165 m_finished_storage.clear ();
167 gdb_assert (m_ignored_ranges.back ().second
168 <= (m_match + strlen (m_match)));
170 const char *prev = m_match;
171 for (const auto &range : m_ignored_ranges)
173 gdb_assert (prev < range.first);
174 gdb_assert (range.second > range.first);
175 m_finished_storage.append (prev, range.first);
176 prev = range.second;
178 m_finished_storage.append (prev);
180 return m_finished_storage.c_str ();
184 /* Prepare for another completion matching sequence. */
185 void clear ()
187 m_match = NULL;
188 m_ignored_ranges.clear ();
191 /* Return true if this object has had no match data set since its
192 creation, or the last call to clear. */
193 bool empty () const
195 return m_match == nullptr && m_ignored_ranges.empty ();
198 private:
199 /* The completion match result for LCD. This is usually either a
200 pointer into to a substring within a symbol's name, or to the
201 storage of the pairing completion_match object. */
202 const char *m_match;
204 /* The ignored substring ranges within M_MATCH. E.g., if we were
205 looking for completion matches for C++ functions starting with
206 "functio"
207 and successfully match:
208 "function[abi:cxx11](int)"
209 the ignored ranges vector will contain an entry that delimits the
210 "[abi:cxx11]" substring, such that calling finish() results in:
211 "function(int)"
213 std::vector<std::pair<const char *, const char *>> m_ignored_ranges;
215 /* Storage used by the finish() method, if it has to compute a new
216 string. */
217 std::string m_finished_storage;
220 /* Convenience aggregate holding info returned by the symbol name
221 matching routines (see symbol_name_matcher_ftype). */
222 struct completion_match_result
224 /* The completion match candidate. */
225 completion_match match;
227 /* The completion match, for LCD computation purposes. */
228 completion_match_for_lcd match_for_lcd;
230 /* Convenience that sets both MATCH and MATCH_FOR_LCD. M_FOR_LCD is
231 optional. If not specified, defaults to M. */
232 void set_match (const char *m, const char *m_for_lcd = NULL)
234 match.set_match (m);
235 if (m_for_lcd == NULL)
236 match_for_lcd.set_match (m);
237 else
238 match_for_lcd.set_match (m_for_lcd);
242 /* The final result of a completion that is handed over to either
243 readline or the "completion" command (which pretends to be
244 readline). Mainly a wrapper for a readline-style match list array,
245 though other bits of info are included too. */
247 struct completion_result
249 /* The type of a function that is used to format completion results when
250 using the 'complete' command. MATCH is the completion word to be
251 printed, and QUOTE_CHAR is a trailing quote character to (possibly)
252 add at the end of MATCH. QUOTE_CHAR can be the null-character in
253 which case no trailing quote should be added.
255 Return the possibly modified completion match word which should be
256 presented to the user. */
257 using match_format_func_t = std::string (*) (const char *match,
258 char quote_char);
260 /* Create an empty result. */
261 completion_result ();
263 /* Create a result. */
264 completion_result (char **match_list, size_t number_matches,
265 bool completion_suppress_append,
266 match_format_func_t match_format_func);
268 /* Destroy a result. */
269 ~completion_result ();
271 DISABLE_COPY_AND_ASSIGN (completion_result);
273 /* Move a result. */
274 completion_result (completion_result &&rhs) noexcept;
276 /* Release ownership of the match list array. */
277 char **release_match_list ();
279 /* Sort the match list. */
280 void sort_match_list ();
282 /* Called to display all matches (used by the 'complete' command).
283 PREFIX is everything before the completion word. WORD is the word
284 being completed, this is only used if we reach the maximum number of
285 completions, otherwise, each line of output consists of PREFIX
286 followed by one of the possible completion words.
288 The QUOTE_CHAR is usually appended after each possible completion
289 word and should be the quote character that appears before the
290 completion word, or the null-character if there is no quote before
291 the completion word.
293 The QUOTE_CHAR is not always appended to the completion output. For
294 example, filename completions will not append QUOTE_CHAR if the
295 completion is a directory name. This is all handled by calling this
296 function. */
297 void print_matches (const std::string &prefix, const char *word,
298 int quote_char);
300 private:
301 /* Destroy the match list array and its contents. */
302 void reset_match_list ();
304 public:
305 /* (There's no point in making these fields private, since the whole
306 point of this wrapper is to build data in the layout expected by
307 readline. Making them private would require adding getters for
308 the "complete" command, which would expose the same
309 implementation details anyway.) */
311 /* The match list array, in the format that readline expects.
312 match_list[0] contains the common prefix. The real match list
313 starts at index 1. The list is NULL terminated. If there's only
314 one match, then match_list[1] is NULL. If there are no matches,
315 then this is NULL. */
316 char **match_list;
317 /* The number of matched completions in MATCH_LIST. Does not
318 include the NULL terminator or the common prefix. */
319 size_t number_matches;
321 /* Whether readline should suppress appending a whitespace, when
322 there's only one possible completion. */
323 bool completion_suppress_append;
325 private:
326 /* A function which formats a single completion match ready for display
327 as part of the 'complete' command output. Different completion
328 functions can set different formatter functions. */
329 match_format_func_t m_match_formatter;
332 /* Object used by completers to build a completion match list to hand
333 over to readline. It tracks:
335 - How many unique completions have been generated, to terminate
336 completion list generation early if the list has grown to a size
337 so large as to be useless. This helps avoid GDB seeming to lock
338 up in the event the user requests to complete on something vague
339 that necessitates the time consuming expansion of many symbol
340 tables.
342 - The completer's idea of least common denominator (aka the common
343 prefix) between all completion matches to hand over to readline.
344 Some completers provide matches that don't start with the
345 completion "word". E.g., completing on "b push_ba" on a C++
346 program usually completes to std::vector<...>::push_back,
347 std::string::push_back etc. If all matches happen to start with
348 "std::", then readline would figure out that the lowest common
349 denominator is "std::", and thus would do a partial completion
350 with that. I.e., it would replace "push_ba" in the input buffer
351 with "std::", losing the original "push_ba", which is obviously
352 undesirable. To avoid that, such completers pass the substring
353 of the match that matters for common denominator computation as
354 MATCH_FOR_LCD argument to add_completion. The end result is
355 passed to readline in gdb_rl_attempted_completion_function.
357 - The custom word point to hand over to readline, for completers
358 that parse the input string in order to dynamically adjust
359 themselves depending on exactly what they're completing. E.g.,
360 the linespec completer needs to bypass readline's too-simple word
361 breaking algorithm.
363 class completion_tracker
365 public:
366 explicit completion_tracker (bool from_readline);
367 ~completion_tracker ();
369 DISABLE_COPY_AND_ASSIGN (completion_tracker);
371 /* Add the completion NAME to the list of generated completions if
372 it is not there already. If too many completions were already
373 found, this throws an error. */
374 void add_completion (gdb::unique_xmalloc_ptr<char> name,
375 completion_match_for_lcd *match_for_lcd = NULL,
376 const char *text = NULL, const char *word = NULL);
378 /* Add all completions matches in LIST. Elements are moved out of
379 LIST. */
380 void add_completions (completion_list &&list);
382 /* Remove completion matching NAME from the completion list, does nothing
383 if NAME is not already in the completion list. */
384 void remove_completion (const char *name);
386 /* Set the quote char to be appended after a unique completion is
387 added to the input line. Set to '\0' to clear. See
388 m_quote_char's description. */
389 void set_quote_char (int quote_char)
390 { m_quote_char = quote_char; }
392 /* The quote char to be appended after a unique completion is added
393 to the input line. Returns '\0' if no quote char has been set.
394 See m_quote_char's description. */
395 int quote_char () { return m_quote_char; }
397 /* Tell the tracker that the current completer wants to provide a
398 custom word point instead of a list of a break chars, in the
399 handle_brkchars phase. Such completers must also compute their
400 completions then. */
401 void set_use_custom_word_point (bool enable)
402 { m_use_custom_word_point = enable; }
404 /* Whether the current completer computes a custom word point. */
405 bool use_custom_word_point () const
406 { return m_use_custom_word_point; }
408 /* The custom word point. */
409 int custom_word_point () const
410 { return m_custom_word_point; }
412 /* Set the custom word point to POINT. */
413 void set_custom_word_point (int point)
414 { m_custom_word_point = point; }
416 /* Advance the custom word point by LEN. */
417 void advance_custom_word_point_by (int len);
419 /* Whether to tell readline to skip appending a whitespace after the
420 completion. See m_suppress_append_ws. */
421 bool suppress_append_ws () const
422 { return m_suppress_append_ws; }
424 /* Set whether to tell readline to skip appending a whitespace after
425 the completion. See m_suppress_append_ws. */
426 void set_suppress_append_ws (bool suppress)
427 { m_suppress_append_ws = suppress; }
429 /* Return true if we only have one completion, and it matches
430 exactly the completion word. I.e., completing results in what we
431 already have. */
432 bool completes_to_completion_word (const char *word);
434 /* Get a reference to the shared (between all the multiple symbol
435 name comparison calls) completion_match_result object, ready for
436 another symbol name match sequence. */
437 completion_match_result &reset_completion_match_result ()
439 completion_match_result &res = m_completion_match_result;
441 /* Clear any previous match. */
442 res.match.clear ();
443 res.match_for_lcd.clear ();
444 return m_completion_match_result;
447 /* True if we have any completion match recorded. */
448 bool have_completions () const
449 { return htab_elements (m_entries_hash.get ()) > 0; }
451 /* Discard the current completion match list and the current
452 LCD. */
453 void discard_completions ();
455 /* Build a completion_result containing the list of completion
456 matches to hand over to readline. The parameters are as in
457 rl_attempted_completion_function. */
458 completion_result build_completion_result (const char *text,
459 int start, int end);
461 /* Tells if the completion task is triggered by readline. See
462 m_from_readline. */
463 bool from_readline () const
464 { return m_from_readline; }
466 /* Set the function used to format the completion word before displaying
467 it to the user to F, this is used by the 'complete' command. */
468 void set_match_format_func (completion_result::match_format_func_t f)
470 gdb_assert (f != nullptr);
471 m_match_format_func = f;
474 private:
476 /* The type that we place into the m_entries_hash hash table. */
477 class completion_hash_entry;
479 /* Add the completion NAME to the list of generated completions if
480 it is not there already. If false is returned, too many
481 completions were found. */
482 bool maybe_add_completion (gdb::unique_xmalloc_ptr<char> name,
483 completion_match_for_lcd *match_for_lcd,
484 const char *text, const char *word);
486 /* Ensure that the lowest common denominator held in the member variable
487 M_LOWEST_COMMON_DENOMINATOR is valid. This method must be called if
488 there is any chance that new completions have been added to the
489 tracker before the lowest common denominator is read. */
490 void recompute_lowest_common_denominator ();
492 /* Callback used from recompute_lowest_common_denominator, called for
493 every entry in m_entries_hash. */
494 void recompute_lcd_visitor (completion_hash_entry *entry);
496 /* Completion match outputs returned by the symbol name matching
497 routines (see symbol_name_matcher_ftype). These results are only
498 valid for a single match call. This is here in order to be able
499 to conveniently share the same storage among all the calls to the
500 symbol name matching routines. */
501 completion_match_result m_completion_match_result;
503 /* The completion matches found so far, in a hash table, for
504 duplicate elimination as entries are added. Otherwise the user
505 is left scratching his/her head: readline and complete_command
506 will remove duplicates, and if removal of duplicates there brings
507 the total under max_completions the user may think gdb quit
508 searching too early. */
509 htab_up m_entries_hash;
511 /* If non-zero, then this is the quote char that needs to be
512 appended after completion (iff we have a unique completion). We
513 don't rely on readline appending the quote char as delimiter as
514 then readline wouldn't append the ' ' after the completion.
515 I.e., we want this:
517 before tab: "b 'function("
518 after tab: "b 'function()' "
520 int m_quote_char = '\0';
522 /* If true, the completer has its own idea of "word" point, and
523 doesn't want to rely on readline computing it based on brkchars.
524 Set in the handle_brkchars phase. */
525 bool m_use_custom_word_point = false;
527 /* The completer's idea of where the "word" we were looking at is
528 relative to RL_LINE_BUFFER. This is advanced in the
529 handle_brkchars phase as the completer discovers potential
530 completable words. */
531 int m_custom_word_point = 0;
533 /* If true, tell readline to skip appending a whitespace after the
534 completion. Automatically set if we have a unique completion
535 that already has a space at the end. A completer may also
536 explicitly set this. E.g., the linespec completer sets this when
537 the completion ends with the ":" separator between filename and
538 function name. */
539 bool m_suppress_append_ws = false;
541 /* Our idea of lowest common denominator to hand over to readline.
542 See intro. */
543 char *m_lowest_common_denominator = NULL;
545 /* If true, the LCD is unique. I.e., all completions had the same
546 MATCH_FOR_LCD substring, even if the completions were different.
547 For example, if "break function<tab>" found "a::function()" and
548 "b::function()", the LCD will be "function()" in both cases and
549 so we want to tell readline to complete the line with
550 "function()", instead of showing all the possible
551 completions. */
552 bool m_lowest_common_denominator_unique = false;
554 /* True if the value in M_LOWEST_COMMON_DENOMINATOR is correct. This is
555 set to true each time RECOMPUTE_LOWEST_COMMON_DENOMINATOR is called,
556 and reset to false whenever a new completion is added. */
557 bool m_lowest_common_denominator_valid = false;
559 /* To avoid calls to xrealloc in RECOMPUTE_LOWEST_COMMON_DENOMINATOR, we
560 track the maximum possible size of the lowest common denominator,
561 which we know as each completion is added. */
562 size_t m_lowest_common_denominator_max_length = 0;
564 /* Indicates that the completions are to be displayed by readline
565 interactively. The 'complete' command is a way to generate completions
566 not to be displayed by readline. */
567 bool m_from_readline;
569 /* The function used to format the completion word before it is printed
570 in the 'complete' command output. */
571 completion_result::match_format_func_t m_match_format_func;
574 /* Return a string to hand off to readline as a completion match
575 candidate, potentially composed of parts of MATCH_NAME and of
576 TEXT/WORD. For a description of TEXT/WORD see completer_ftype. */
578 extern gdb::unique_xmalloc_ptr<char>
579 make_completion_match_str (const char *match_name,
580 const char *text, const char *word);
582 /* Like above, but takes ownership of MATCH_NAME (i.e., can
583 reuse/return it). */
585 extern gdb::unique_xmalloc_ptr<char>
586 make_completion_match_str (gdb::unique_xmalloc_ptr<char> &&match_name,
587 const char *text, const char *word);
589 extern void gdb_display_match_list (char **matches, int len, int max,
590 const struct match_list_displayer *);
592 extern const char *get_max_completions_reached_message (void);
594 extern void complete_line (completion_tracker &tracker,
595 const char *text,
596 const char *line_buffer,
597 int point);
599 /* Complete LINE and return completion results. For completion purposes,
600 cursor position is assumed to be at the end of LINE. WORD is set to
601 the end of word to complete. QUOTE_CHAR is set to the opening quote
602 character if we found an unclosed quoted substring, '\0' otherwise. */
603 extern completion_result
604 complete (const char *line, char const **word, int *quote_char);
606 /* Assuming TEXT is an expression in the current language, find the
607 completion word point for TEXT, emulating the algorithm readline
608 uses to find the word point, using the current language's word
609 break characters. */
610 const char *advance_to_expression_complete_word_point
611 (completion_tracker &tracker, const char *text);
613 /* Assuming TEXT is a filename, find the completion word point for TEXT,
614 emulating the algorithm readline uses to find the word point. The
615 filenames that are located by this function assume no filename
616 quoting, this function should be paired with filename_completer. */
617 extern const char *advance_to_deprecated_filename_complete_word_point
618 (completion_tracker &tracker, const char *text);
620 /* Assuming TEXT is a filename, find the completion word point for TEXT,
621 emulating the algorithm readline uses to find the word point. The
622 filenames that are located by this function assume that filenames
623 can be quoted, this function should be paired with
624 filename_maybe_quoted_completer. */
625 extern const char *advance_to_filename_maybe_quoted_complete_word_point
626 (completion_tracker &tracker, const char *text);
628 extern void noop_completer (struct cmd_list_element *,
629 completion_tracker &tracker,
630 const char *, const char *);
632 /* Filename completer for commands that don't accept quoted filenames.
633 This completer does support completing a list of filenames that are
634 separated with the path separator (':' for UNIX and ';' for MS-DOS).
636 When adding a new command it is better to write the command so it
637 accepts quoted filenames and use filename_maybe_quoted_completer, for
638 examples see the 'exec' and 'exec-file' commands. */
640 extern void deprecated_filename_completer
641 (struct cmd_list_element *, completion_tracker &tracker,
642 const char *, const char *);
644 /* Filename completer for commands where the filename argument can be
645 quoted. This completer also supports completing a list of filenames
646 that are separated with the path separator (':' for UNIX and ';' for
647 MS-DOS). */
649 extern void filename_maybe_quoted_completer (struct cmd_list_element *,
650 completion_tracker &tracker,
651 const char *, const char *);
653 extern void expression_completer (struct cmd_list_element *,
654 completion_tracker &tracker,
655 const char *, const char *);
657 extern void location_completer (struct cmd_list_element *,
658 completion_tracker &tracker,
659 const char *, const char *);
661 extern void symbol_completer (struct cmd_list_element *,
662 completion_tracker &tracker,
663 const char *, const char *);
665 extern void command_completer (struct cmd_list_element *,
666 completion_tracker &tracker,
667 const char *, const char *);
669 extern void signal_completer (struct cmd_list_element *,
670 completion_tracker &tracker,
671 const char *, const char *);
673 extern void reg_or_group_completer (struct cmd_list_element *,
674 completion_tracker &tracker,
675 const char *, const char *);
677 extern void reggroup_completer (struct cmd_list_element *,
678 completion_tracker &tracker,
679 const char *, const char *);
681 /* Get the matching completer_handle_brkchars_ftype function for FN.
682 FN is one of the core completer functions above (filename,
683 location, symbol, etc.). This function is useful for cases when
684 the completer doesn't know the type of the completion until some
685 calculation is done (e.g., for Python functions). */
687 extern completer_handle_brkchars_ftype *
688 completer_handle_brkchars_func_for_completer (completer_ftype *fn);
690 /* Exported to linespec.c */
692 /* Return a list of all source files whose names begin with matching
693 TEXT. */
694 extern completion_list complete_source_filenames (const char *text);
696 /* Complete on expressions. Often this means completing on symbol
697 names, but some language parsers also have support for completing
698 field names. */
699 extern void complete_expression (completion_tracker &tracker,
700 const char *text, const char *word);
702 /* Called by custom word point completers that want to recurse into
703 the completion machinery to complete a command. Used to complete
704 COMMAND in "thread apply all COMMAND", for example. Note that
705 unlike command_completer, this fully recurses into the proper
706 completer for COMMAND, so that e.g.,
708 (gdb) thread apply all print -[TAB]
710 does the right thing and show the print options. */
711 extern void complete_nested_command_line (completion_tracker &tracker,
712 const char *text);
714 /* Called from command completion function to skip over /FMT
715 specifications, allowing the rest of the line to be completed. Returns
716 true if the /FMT is at the end of the current line and there is nothing
717 left to complete, otherwise false is returned.
719 In either case *ARGS can be updated to point after any part of /FMT that
720 is present.
722 This function is designed so that trying to complete '/' will offer no
723 completions, the user needs to insert the format specification
724 themselves. Trying to complete '/FMT' (where FMT is any non-empty set
725 of alpha-numeric characters) will cause readline to insert a single
726 space, setting the user up to enter the expression. */
728 extern bool skip_over_slash_fmt (completion_tracker &tracker,
729 const char **args);
731 /* Maximum number of candidates to consider before the completer
732 bails by throwing MAX_COMPLETIONS_REACHED_ERROR. Negative values
733 disable limiting. */
735 extern int max_completions;
737 #endif /* GDB_COMPLETER_H */