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