]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/cli/cli-cmds.c
*** empty log message ***
[thirdparty/binutils-gdb.git] / gdb / cli / cli-cmds.c
CommitLineData
d318976c 1/* GDB CLI commands.
8926118c
AC
2
3 Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
d318976c
FN
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22#include "defs.h"
23#include "completer.h"
24#include "target.h" /* For baud_rate, remote_debug and remote_timeout */
25#include "gdb_wait.h" /* For shell escape implementation */
f77b92bf 26#include "gdb_regex.h" /* Used by apropos_command */
fe4e3eb8 27#include "filenames.h" /* for DOSish file names */
d318976c 28
d318976c 29#include "ui-out.h"
d318976c
FN
30
31#include "top.h"
32#include "cli/cli-decode.h"
33#include "cli/cli-script.h"
34#include "cli/cli-setshow.h"
35#include "cli/cli-cmds.h"
36
37#ifndef GDBINIT_FILENAME
38#define GDBINIT_FILENAME ".gdbinit"
39#endif
40
d318976c
FN
41/* From gdb/top.c */
42
43extern void dont_repeat (void);
44
45extern void set_verbose (char *, int, struct cmd_list_element *);
46
47extern void show_history (char *, int);
48
49extern void set_history (char *, int);
50
51extern void show_commands (char *, int);
52
53/* Prototypes for local functions */
54
55static void complete_command (char *, int);
56
57static void echo_command (char *, int);
58
59static void pwd_command (char *, int);
60
61static void show_version (char *, int);
62
63static void validate_comname (char *);
64
65static void help_command (char *, int);
66
67static void show_command (char *, int);
68
69static void info_command (char *, int);
70
71static void show_debug (char *, int);
72
73static void set_debug (char *, int);
74
75static void show_user (char *, int);
76
77static void make_command (char *, int);
78
79static void shell_escape (char *, int);
80
81void apropos_command (char *, int);
82\f
83/* Define all cmd_list_elements. */
84
85/* Chain containing all defined commands. */
86
87struct cmd_list_element *cmdlist;
88
89/* Chain containing all defined info subcommands. */
90
91struct cmd_list_element *infolist;
92
93/* Chain containing all defined enable subcommands. */
94
95struct cmd_list_element *enablelist;
96
97/* Chain containing all defined disable subcommands. */
98
99struct cmd_list_element *disablelist;
100
101/* Chain containing all defined toggle subcommands. */
102
103struct cmd_list_element *togglelist;
104
105/* Chain containing all defined stop subcommands. */
106
107struct cmd_list_element *stoplist;
108
109/* Chain containing all defined delete subcommands. */
110
111struct cmd_list_element *deletelist;
112
113/* Chain containing all defined "enable breakpoint" subcommands. */
114
115struct cmd_list_element *enablebreaklist;
116
117/* Chain containing all defined set subcommands */
118
119struct cmd_list_element *setlist;
120
121/* Chain containing all defined unset subcommands */
122
123struct cmd_list_element *unsetlist;
124
125/* Chain containing all defined show subcommands. */
126
127struct cmd_list_element *showlist;
128
129/* Chain containing all defined \"set history\". */
130
131struct cmd_list_element *sethistlist;
132
133/* Chain containing all defined \"show history\". */
134
135struct cmd_list_element *showhistlist;
136
137/* Chain containing all defined \"unset history\". */
138
139struct cmd_list_element *unsethistlist;
140
141/* Chain containing all defined maintenance subcommands. */
142
143struct cmd_list_element *maintenancelist;
144
145/* Chain containing all defined "maintenance info" subcommands. */
146
147struct cmd_list_element *maintenanceinfolist;
148
149/* Chain containing all defined "maintenance print" subcommands. */
150
151struct cmd_list_element *maintenanceprintlist;
152
153struct cmd_list_element *setprintlist;
154
155struct cmd_list_element *showprintlist;
156
157struct cmd_list_element *setdebuglist;
158
159struct cmd_list_element *showdebuglist;
160
161struct cmd_list_element *setchecklist;
162
163struct cmd_list_element *showchecklist;
164\f
165/* Utility used everywhere when at least one argument is needed and
166 none is supplied. */
167
168void
169error_no_arg (char *why)
170{
171 error ("Argument required (%s).", why);
172}
173
174/* The "info" command is defined as a prefix, with allow_unknown = 0.
175 Therefore, its own definition is called only for "info" with no args. */
176
177/* ARGSUSED */
178static void
179info_command (char *arg, int from_tty)
180{
181 printf_unfiltered ("\"info\" must be followed by the name of an info command.\n");
182 help_list (infolist, "info ", -1, gdb_stdout);
183}
184
185/* The "show" command with no arguments shows all the settings. */
186
187/* ARGSUSED */
188static void
189show_command (char *arg, int from_tty)
190{
191 cmd_show_list (showlist, from_tty, "");
192}
193\f
194/* Provide documentation on command or list given by COMMAND. FROM_TTY
195 is ignored. */
196
197/* ARGSUSED */
198static void
199help_command (char *command, int from_tty)
200{
201 help_cmd (command, gdb_stdout);
202}
203\f
204/* The "complete" command is used by Emacs to implement completion. */
205
206/* ARGSUSED */
207static void
208complete_command (char *arg, int from_tty)
209{
210 int i;
211 int argpoint;
212 char *completion;
213
214 dont_repeat ();
215
216 if (arg == NULL)
217 arg = "";
218 argpoint = strlen (arg);
219
220 for (completion = line_completion_function (arg, i = 0, arg, argpoint);
221 completion;
222 completion = line_completion_function (arg, ++i, arg, argpoint))
223 {
224 printf_unfiltered ("%s\n", completion);
b8c9b27d 225 xfree (completion);
d318976c
FN
226 }
227}
228
229int is_complete_command (void (*func) (char *args, int from_tty))
230{
231 return func == complete_command;
232}
233
234/* ARGSUSED */
235static void
236show_version (char *args, int from_tty)
237{
238 immediate_quit++;
239 print_gdb_version (gdb_stdout);
240 printf_filtered ("\n");
241 immediate_quit--;
242}
243
244/* Handle the quit command. */
245
246void
247quit_command (char *args, int from_tty)
248{
249 if (!quit_confirm ())
250 error ("Not confirmed.");
251 quit_force (args, from_tty);
252}
253
254/* ARGSUSED */
255static void
256pwd_command (char *args, int from_tty)
257{
258 if (args)
259 error ("The \"pwd\" command does not take an argument: %s", args);
260 getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
261
262 if (!STREQ (gdb_dirbuf, current_directory))
263 printf_unfiltered ("Working directory %s\n (canonically %s).\n",
264 current_directory, gdb_dirbuf);
265 else
266 printf_unfiltered ("Working directory %s.\n", current_directory);
267}
268
269void
270cd_command (char *dir, int from_tty)
271{
272 int len;
273 /* Found something other than leading repetitions of "/..". */
274 int found_real_path;
275 char *p;
276
277 /* If the new directory is absolute, repeat is a no-op; if relative,
278 repeat might be useful but is more likely to be a mistake. */
279 dont_repeat ();
280
281 if (dir == 0)
282 error_no_arg ("new working directory");
283
284 dir = tilde_expand (dir);
b8c9b27d 285 make_cleanup (xfree, dir);
d318976c
FN
286
287 if (chdir (dir) < 0)
288 perror_with_name (dir);
289
c3690141 290#ifdef HAVE_DOS_BASED_FILE_SYSTEM
d318976c
FN
291 /* There's too much mess with DOSish names like "d:", "d:.",
292 "d:./foo" etc. Instead of having lots of special #ifdef'ed code,
293 simply get the canonicalized name of the current directory. */
294 dir = getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
295#endif
296
297 len = strlen (dir);
fe4e3eb8 298 if (IS_DIR_SEPARATOR (dir[len - 1]))
d318976c
FN
299 {
300 /* Remove the trailing slash unless this is a root directory
301 (including a drive letter on non-Unix systems). */
302 if (!(len == 1) /* "/" */
c3690141 303#ifdef HAVE_DOS_BASED_FILE_SYSTEM
fe4e3eb8 304 && !(len == 3 && dir[1] == ':') /* "d:/" */
d318976c
FN
305#endif
306 )
307 len--;
308 }
309
310 dir = savestring (dir, len);
fe4e3eb8 311 if (IS_ABSOLUTE_PATH (dir))
d318976c
FN
312 current_directory = dir;
313 else
314 {
fe4e3eb8 315 if (IS_DIR_SEPARATOR (current_directory[strlen (current_directory) - 1]))
d318976c
FN
316 current_directory = concat (current_directory, dir, NULL);
317 else
318 current_directory = concat (current_directory, SLASH_STRING, dir, NULL);
b8c9b27d 319 xfree (dir);
d318976c
FN
320 }
321
322 /* Now simplify any occurrences of `.' and `..' in the pathname. */
323
324 found_real_path = 0;
325 for (p = current_directory; *p;)
326 {
fe4e3eb8
EZ
327 if (IS_DIR_SEPARATOR (p[0]) && p[1] == '.'
328 && (p[2] == 0 || IS_DIR_SEPARATOR (p[2])))
d318976c 329 strcpy (p, p + 2);
fe4e3eb8
EZ
330 else if (IS_DIR_SEPARATOR (p[0]) && p[1] == '.' && p[2] == '.'
331 && (p[3] == 0 || IS_DIR_SEPARATOR (p[3])))
d318976c
FN
332 {
333 if (found_real_path)
334 {
335 /* Search backwards for the directory just before the "/.."
336 and obliterate it and the "/..". */
337 char *q = p;
fe4e3eb8 338 while (q != current_directory && !IS_DIR_SEPARATOR (q[-1]))
d318976c
FN
339 --q;
340
341 if (q == current_directory)
342 /* current_directory is
343 a relative pathname ("can't happen"--leave it alone). */
344 ++p;
345 else
346 {
347 strcpy (q - 1, p + 3);
348 p = q - 1;
349 }
350 }
351 else
352 /* We are dealing with leading repetitions of "/..", for example
353 "/../..", which is the Mach super-root. */
354 p += 3;
355 }
356 else
357 {
358 found_real_path = 1;
359 ++p;
360 }
361 }
362
363 forget_cached_source_info ();
364
365 if (from_tty)
366 pwd_command ((char *) 0, 1);
367}
368\f
369void
370source_command (char *args, int from_tty)
371{
372 FILE *stream;
373 struct cleanup *old_cleanups;
374 char *file = args;
375
376 if (file == NULL)
377 {
378 error ("source command requires pathname of file to source.");
379 }
380
381 file = tilde_expand (file);
b8c9b27d 382 old_cleanups = make_cleanup (xfree, file);
d318976c
FN
383
384 stream = fopen (file, FOPEN_RT);
385 if (!stream)
386 {
387 if (from_tty)
388 perror_with_name (file);
389 else
390 return;
391 }
392
393 script_from_file (stream, file);
394
395 do_cleanups (old_cleanups);
396}
397
398/* ARGSUSED */
399static void
400echo_command (char *text, int from_tty)
401{
402 char *p = text;
403 register int c;
404
405 if (text)
406 while ((c = *p++) != '\0')
407 {
408 if (c == '\\')
409 {
410 /* \ at end of argument is used after spaces
411 so they won't be lost. */
412 if (*p == 0)
413 return;
414
415 c = parse_escape (&p);
416 if (c >= 0)
417 printf_filtered ("%c", c);
418 }
419 else
420 printf_filtered ("%c", c);
421 }
422
423 /* Force this output to appear now. */
424 wrap_here ("");
425 gdb_flush (gdb_stdout);
426}
427
428/* ARGSUSED */
429static void
430shell_escape (char *arg, int from_tty)
431{
432#ifdef CANT_FORK
433 /* If ARG is NULL, they want an inferior shell, but `system' just
434 reports if the shell is available when passed a NULL arg. */
435 int rc = system (arg ? arg : "");
436
437 if (!arg)
438 arg = "inferior shell";
439
440 if (rc == -1)
441 {
442 fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", arg,
443 safe_strerror (errno));
444 gdb_flush (gdb_stderr);
445 }
446 else if (rc)
447 {
448 fprintf_unfiltered (gdb_stderr, "%s exited with status %d\n", arg, rc);
449 gdb_flush (gdb_stderr);
450 }
2584159e 451#ifdef GLOBAL_CURDIR
d318976c
FN
452 /* Make sure to return to the directory GDB thinks it is, in case the
453 shell command we just ran changed it. */
454 chdir (current_directory);
455#endif
456#else /* Can fork. */
457 int rc, status, pid;
458 char *p, *user_shell;
459
460 if ((user_shell = (char *) getenv ("SHELL")) == NULL)
461 user_shell = "/bin/sh";
462
463 /* Get the name of the shell for arg0 */
464 if ((p = strrchr (user_shell, '/')) == NULL)
465 p = user_shell;
466 else
467 p++; /* Get past '/' */
468
469 if ((pid = fork ()) == 0)
470 {
471 if (!arg)
472 execl (user_shell, p, 0);
473 else
474 execl (user_shell, p, "-c", arg, 0);
475
476 fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", user_shell,
477 safe_strerror (errno));
478 gdb_flush (gdb_stderr);
479 _exit (0177);
480 }
481
482 if (pid != -1)
483 while ((rc = wait (&status)) != pid && rc != -1)
484 ;
485 else
486 error ("Fork failed");
487#endif /* Can fork. */
488}
489
490static void
491make_command (char *arg, int from_tty)
492{
493 char *p;
494
495 if (arg == 0)
496 p = "make";
497 else
498 {
499 p = xmalloc (sizeof ("make ") + strlen (arg));
500 strcpy (p, "make ");
501 strcpy (p + sizeof ("make ") - 1, arg);
502 }
503
504 shell_escape (p, from_tty);
505}
506
507/* ARGSUSED */
508static void
509show_user (char *args, int from_tty)
510{
511 struct cmd_list_element *c;
512 extern struct cmd_list_element *cmdlist;
513
514 if (args)
515 {
516 c = lookup_cmd (&args, cmdlist, "", 0, 1);
517 if (c->class != class_user)
518 error ("Not a user command.");
519 show_user_1 (c, gdb_stdout);
520 }
521 else
522 {
523 for (c = cmdlist; c; c = c->next)
524 {
525 if (c->class == class_user)
526 show_user_1 (c, gdb_stdout);
527 }
528 }
529}
530
531/* Search through names of commands and documentations for a certain
532 regular expression.
533*/
534void
535apropos_command (char *searchstr, int from_tty)
536{
537 extern struct cmd_list_element *cmdlist; /*This is the main command list*/
538 regex_t pattern;
539 char *pattern_fastmap;
540 char errorbuffer[512];
2e94c453 541 pattern_fastmap = xcalloc (256, sizeof (char));
d318976c
FN
542 if (searchstr == NULL)
543 error("REGEXP string is empty");
544
545 if (regcomp(&pattern,searchstr,REG_ICASE) == 0)
546 {
547 pattern.fastmap=pattern_fastmap;
548 re_compile_fastmap(&pattern);
549 apropos_cmd (gdb_stdout,cmdlist,&pattern,"");
550 }
551 else
552 {
553 regerror(regcomp(&pattern,searchstr,REG_ICASE),NULL,errorbuffer,512);
554 error("Error in regular expression:%s",errorbuffer);
555 }
2b5436af 556 xfree (pattern_fastmap);
d318976c
FN
557}
558\f
559static void
560set_debug (char *arg, int from_tty)
561{
562 printf_unfiltered ("\"set debug\" must be followed by the name of a print subcommand.\n");
563 help_list (setdebuglist, "set debug ", -1, gdb_stdout);
564}
565
566static void
567show_debug (char *args, int from_tty)
568{
569 cmd_show_list (showdebuglist, from_tty, "");
570}
571
572void
573init_cmd_lists (void)
574{
575 cmdlist = NULL;
576 infolist = NULL;
577 enablelist = NULL;
578 disablelist = NULL;
579 togglelist = NULL;
580 stoplist = NULL;
581 deletelist = NULL;
582 enablebreaklist = NULL;
583 setlist = NULL;
584 unsetlist = NULL;
585 showlist = NULL;
586 sethistlist = NULL;
587 showhistlist = NULL;
588 unsethistlist = NULL;
589 maintenancelist = NULL;
590 maintenanceinfolist = NULL;
591 maintenanceprintlist = NULL;
592 setprintlist = NULL;
593 showprintlist = NULL;
594 setchecklist = NULL;
595 showchecklist = NULL;
596}
597
598\f
599void
600init_cli_cmds (void)
601{
602 struct cmd_list_element *c;
603
604 /* Define the classes of commands.
605 They will appear in the help list in the reverse of this order. */
606
e00d1dc8 607 add_cmd ("internals", class_maintenance, NULL,
d318976c
FN
608 "Maintenance commands.\n\
609Some gdb commands are provided just for use by gdb maintainers.\n\
610These commands are subject to frequent change, and may not be as\n\
611well documented as user commands.",
612 &cmdlist);
e00d1dc8
AC
613 add_cmd ("obscure", class_obscure, NULL, "Obscure features.", &cmdlist);
614 add_cmd ("aliases", class_alias, NULL, "Aliases of other commands.", &cmdlist);
615 add_cmd ("user-defined", class_user, NULL, "User-defined commands.\n\
d318976c
FN
616The commands in this class are those defined by the user.\n\
617Use the \"define\" command to define a command.", &cmdlist);
e00d1dc8 618 add_cmd ("support", class_support, NULL, "Support facilities.", &cmdlist);
d318976c 619 if (!dbx_commands)
e00d1dc8
AC
620 add_cmd ("status", class_info, NULL, "Status inquiries.", &cmdlist);
621 add_cmd ("files", class_files, NULL, "Specifying and examining files.", &cmdlist);
622 add_cmd ("breakpoints", class_breakpoint, NULL, "Making program stop at certain points.", &cmdlist);
623 add_cmd ("data", class_vars, NULL, "Examining data.", &cmdlist);
624 add_cmd ("stack", class_stack, NULL, "Examining the stack.\n\
d318976c
FN
625The stack is made up of stack frames. Gdb assigns numbers to stack frames\n\
626counting from zero for the innermost (currently executing) frame.\n\n\
627At any time gdb identifies one frame as the \"selected\" frame.\n\
628Variable lookups are done with respect to the selected frame.\n\
629When the program being debugged stops, gdb selects the innermost frame.\n\
630The commands below can be used to select other frames by number or address.",
631 &cmdlist);
e00d1dc8 632 add_cmd ("running", class_run, NULL, "Running the program.", &cmdlist);
d318976c
FN
633
634 /* Define general commands. */
635
636 add_com ("pwd", class_files, pwd_command,
637 "Print working directory. This is used for your program as well.");
638 c = add_cmd ("cd", class_files, cd_command,
639 "Set working directory to DIR for debugger and program being debugged.\n\
640The change does not take effect for the program being debugged\n\
641until the next time it is started.", &cmdlist);
642 c->completer = filename_completer;
643
644 add_com ("echo", class_support, echo_command,
645 "Print a constant string. Give string as argument.\n\
646C escape sequences may be used in the argument.\n\
647No newline is added at the end of the argument;\n\
648use \"\\n\" if you want a newline to be printed.\n\
649Since leading and trailing whitespace are ignored in command arguments,\n\
650if you want to print some you must use \"\\\" before leading whitespace\n\
651to be printed or after trailing whitespace.");
652 add_com ("document", class_support, document_command,
653 "Document a user-defined command.\n\
654Give command name as argument. Give documentation on following lines.\n\
655End with a line of just \"end\".");
656 add_com ("define", class_support, define_command,
657 "Define a new command name. Command name is argument.\n\
658Definition appears on following lines, one command per line.\n\
659End with a line of just \"end\".\n\
660Use the \"document\" command to give documentation for the new command.\n\
661Commands defined in this way may have up to ten arguments.");
662
d318976c
FN
663 c = add_cmd ("source", class_support, source_command,
664 "Read commands from a file named FILE.\n\
665Note that the file \"" GDBINIT_FILENAME "\" is read automatically in this way\n\
666when gdb is started.", &cmdlist);
d318976c
FN
667 c->completer = filename_completer;
668
669 add_com ("quit", class_support, quit_command, "Exit gdb.");
db60ec62
EZ
670 c = add_com ("help", class_support, help_command, "Print list of commands.");
671 c->completer = command_completer;
d318976c
FN
672 add_com_alias ("q", "quit", class_support, 1);
673 add_com_alias ("h", "help", class_support, 1);
674
675 c = add_set_cmd ("verbose", class_support, var_boolean, (char *) &info_verbose,
676 "Set ",
677 &setlist),
678 add_show_from_set (c, &showlist);
9f60d481 679 set_cmd_sfunc (c, set_verbose);
d318976c
FN
680 set_verbose (NULL, 0, c);
681
682 add_prefix_cmd ("history", class_support, set_history,
683 "Generic command for setting command history parameters.",
684 &sethistlist, "set history ", 0, &setlist);
685 add_prefix_cmd ("history", class_support, show_history,
686 "Generic command for showing command history parameters.",
687 &showhistlist, "show history ", 0, &showlist);
688
689 add_show_from_set
690 (add_set_cmd ("expansion", no_class, var_boolean, (char *) &history_expansion_p,
691 "Set history expansion on command input.\n\
692Without an argument, history expansion is enabled.", &sethistlist),
693 &showhistlist);
694
695 add_prefix_cmd ("info", class_info, info_command,
696 "Generic command for showing things about the program being debugged.",
697 &infolist, "info ", 0, &cmdlist);
698 add_com_alias ("i", "info", class_info, 1);
699
700 add_com ("complete", class_obscure, complete_command,
701 "List the completions for the rest of the line as a command.");
702
703 add_prefix_cmd ("show", class_info, show_command,
704 "Generic command for showing things about the debugger.",
705 &showlist, "show ", 0, &cmdlist);
706 /* Another way to get at the same thing. */
707 add_info ("set", show_command, "Show all GDB settings.");
708
709 add_cmd ("commands", no_class, show_commands,
710 "Show the history of commands you typed.\n\
711You can supply a command number to start with, or a `+' to start after\n\
712the previous command number shown.",
713 &showlist);
714
715 add_cmd ("version", no_class, show_version,
716 "Show what version of GDB this is.", &showlist);
717
718 add_com ("while", class_support, while_command,
719 "Execute nested commands WHILE the conditional expression is non zero.\n\
720The conditional expression must follow the word `while' and must in turn be\n\
721followed by a new line. The nested commands must be entered one per line,\n\
722and should be terminated by the word `end'.");
723
724 add_com ("if", class_support, if_command,
725 "Execute nested commands once IF the conditional expression is non zero.\n\
726The conditional expression must follow the word `if' and must in turn be\n\
727followed by a new line. The nested commands must be entered one per line,\n\
728and should be terminated by the word 'else' or `end'. If an else clause\n\
729is used, the same rules apply to its nested commands as to the first ones.");
730
731 /* If target is open when baud changes, it doesn't take effect until the
732 next open (I think, not sure). */
733 add_show_from_set (add_set_cmd ("remotebaud", no_class,
734 var_zinteger, (char *) &baud_rate,
735 "Set baud rate for remote serial I/O.\n\
736This value is used to set the speed of the serial port when debugging\n\
737using remote targets.", &setlist),
738 &showlist);
739
740 c = add_set_cmd ("remotedebug", no_class, var_zinteger,
741 (char *) &remote_debug,
742 "Set debugging of remote protocol.\n\
743When enabled, each packet sent or received with the remote target\n\
744is displayed.", &setlist);
745 deprecate_cmd (c, "set debug remote");
746 deprecate_cmd (add_show_from_set (c, &showlist), "show debug remote");
747
748 add_show_from_set (add_set_cmd ("remote", no_class, var_zinteger,
749 (char *) &remote_debug,
750 "Set debugging of remote protocol.\n\
751When enabled, each packet sent or received with the remote target\n\
752is displayed.", &setdebuglist),
753 &showdebuglist);
754
755 add_show_from_set (
756 add_set_cmd ("remotetimeout", no_class, var_integer, (char *) &remote_timeout,
757 "Set timeout limit to wait for target to respond.\n\
758This value is used to set the time limit for gdb to wait for a response\n\
759from the target.", &setlist),
760 &showlist);
761
762 add_prefix_cmd ("debug", no_class, set_debug,
763 "Generic command for setting gdb debugging flags",
764 &setdebuglist, "set debug ", 0, &setlist);
765
766 add_prefix_cmd ("debug", no_class, show_debug,
767 "Generic command for showing gdb debugging flags",
768 &showdebuglist, "show debug ", 0, &showlist);
769
fa58ee11
EZ
770 c = add_com ("shell", class_support, shell_escape,
771 "Execute the rest of the line as a shell command. \n\
d318976c 772With no arguments, run an inferior shell.");
fa58ee11 773 c->completer = filename_completer;
d318976c
FN
774
775 /* NOTE: cagney/2000-03-20: Being able to enter ``(gdb) !ls'' would
776 be a really useful feature. Unfortunately, the below wont do
777 this. Instead it adds support for the form ``(gdb) ! ls''
778 (i.e. the space is required). If the ``!'' command below is
779 added the complains about no ``!'' command would be replaced by
780 complains about how the ``!'' command is broken :-) */
781 if (xdb_commands)
782 add_com_alias ("!", "shell", class_support, 0);
783
fa58ee11
EZ
784 c = add_com ("make", class_support, make_command,
785 "Run the ``make'' program using the rest of the line as arguments.");
786 c->completer = filename_completer;
d318976c
FN
787 add_cmd ("user", no_class, show_user,
788 "Show definitions of user defined commands.\n\
789Argument is the name of the user defined command.\n\
790With no argument, show definitions of all user defined commands.", &showlist);
791 add_com ("apropos", class_support, apropos_command, "Search for commands matching a REGEXP");
792}