2002-03-27 Elena Zannoni <ezannoni@redhat.com>
[deliverable/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
83d31a92
TT
204/* String compare function for qsort. */
205static int
206compare_strings (const void *arg1, const void *arg2)
207{
208 const char **s1 = (const char **) arg1;
209 const char **s2 = (const char **) arg2;
210 return strcmp (*s1, *s2);
211}
212
d318976c
FN
213/* The "complete" command is used by Emacs to implement completion. */
214
215/* ARGSUSED */
216static void
217complete_command (char *arg, int from_tty)
218{
219 int i;
220 int argpoint;
83d31a92 221 char **completions;
d318976c
FN
222
223 dont_repeat ();
224
225 if (arg == NULL)
226 arg = "";
227 argpoint = strlen (arg);
228
83d31a92
TT
229 completions = complete_line (arg, arg, argpoint);
230
231 if (completions)
d318976c 232 {
83d31a92
TT
233 int item, size;
234
235 for (size = 0; completions[size]; ++size)
236 ;
237 qsort (completions, size, sizeof (char *), compare_strings);
238
239 /* We do extra processing here since we only want to print each
240 unique item once. */
241 item = 0;
242 while (item < size)
243 {
244 int next_item;
245 printf_unfiltered ("%s\n", completions[item]);
246 next_item = item + 1;
247 while (next_item < size
248 && ! strcmp (completions[item], completions[next_item]))
249 {
250 xfree (completions[next_item]);
251 ++next_item;
252 }
253
254 xfree (completions[item]);
255 item = next_item;
256 }
257
258 xfree (completions);
d318976c
FN
259 }
260}
261
bbaca940
AC
262int
263is_complete_command (struct cmd_list_element *c)
d318976c 264{
bbaca940 265 return cmd_cfunc_eq (c, complete_command);
d318976c
FN
266}
267
268/* ARGSUSED */
269static void
270show_version (char *args, int from_tty)
271{
272 immediate_quit++;
273 print_gdb_version (gdb_stdout);
274 printf_filtered ("\n");
275 immediate_quit--;
276}
277
278/* Handle the quit command. */
279
280void
281quit_command (char *args, int from_tty)
282{
283 if (!quit_confirm ())
284 error ("Not confirmed.");
285 quit_force (args, from_tty);
286}
287
288/* ARGSUSED */
289static void
290pwd_command (char *args, int from_tty)
291{
292 if (args)
293 error ("The \"pwd\" command does not take an argument: %s", args);
294 getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
295
296 if (!STREQ (gdb_dirbuf, current_directory))
297 printf_unfiltered ("Working directory %s\n (canonically %s).\n",
298 current_directory, gdb_dirbuf);
299 else
300 printf_unfiltered ("Working directory %s.\n", current_directory);
301}
302
303void
304cd_command (char *dir, int from_tty)
305{
306 int len;
307 /* Found something other than leading repetitions of "/..". */
308 int found_real_path;
309 char *p;
310
311 /* If the new directory is absolute, repeat is a no-op; if relative,
312 repeat might be useful but is more likely to be a mistake. */
313 dont_repeat ();
314
315 if (dir == 0)
316 error_no_arg ("new working directory");
317
318 dir = tilde_expand (dir);
b8c9b27d 319 make_cleanup (xfree, dir);
d318976c
FN
320
321 if (chdir (dir) < 0)
322 perror_with_name (dir);
323
c3690141 324#ifdef HAVE_DOS_BASED_FILE_SYSTEM
d318976c
FN
325 /* There's too much mess with DOSish names like "d:", "d:.",
326 "d:./foo" etc. Instead of having lots of special #ifdef'ed code,
327 simply get the canonicalized name of the current directory. */
328 dir = getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
329#endif
330
331 len = strlen (dir);
fe4e3eb8 332 if (IS_DIR_SEPARATOR (dir[len - 1]))
d318976c
FN
333 {
334 /* Remove the trailing slash unless this is a root directory
335 (including a drive letter on non-Unix systems). */
336 if (!(len == 1) /* "/" */
c3690141 337#ifdef HAVE_DOS_BASED_FILE_SYSTEM
fe4e3eb8 338 && !(len == 3 && dir[1] == ':') /* "d:/" */
d318976c
FN
339#endif
340 )
341 len--;
342 }
343
344 dir = savestring (dir, len);
fe4e3eb8 345 if (IS_ABSOLUTE_PATH (dir))
d318976c
FN
346 current_directory = dir;
347 else
348 {
fe4e3eb8 349 if (IS_DIR_SEPARATOR (current_directory[strlen (current_directory) - 1]))
d318976c
FN
350 current_directory = concat (current_directory, dir, NULL);
351 else
352 current_directory = concat (current_directory, SLASH_STRING, dir, NULL);
b8c9b27d 353 xfree (dir);
d318976c
FN
354 }
355
356 /* Now simplify any occurrences of `.' and `..' in the pathname. */
357
358 found_real_path = 0;
359 for (p = current_directory; *p;)
360 {
fe4e3eb8
EZ
361 if (IS_DIR_SEPARATOR (p[0]) && p[1] == '.'
362 && (p[2] == 0 || IS_DIR_SEPARATOR (p[2])))
d318976c 363 strcpy (p, p + 2);
fe4e3eb8
EZ
364 else if (IS_DIR_SEPARATOR (p[0]) && p[1] == '.' && p[2] == '.'
365 && (p[3] == 0 || IS_DIR_SEPARATOR (p[3])))
d318976c
FN
366 {
367 if (found_real_path)
368 {
369 /* Search backwards for the directory just before the "/.."
370 and obliterate it and the "/..". */
371 char *q = p;
fe4e3eb8 372 while (q != current_directory && !IS_DIR_SEPARATOR (q[-1]))
d318976c
FN
373 --q;
374
375 if (q == current_directory)
376 /* current_directory is
377 a relative pathname ("can't happen"--leave it alone). */
378 ++p;
379 else
380 {
381 strcpy (q - 1, p + 3);
382 p = q - 1;
383 }
384 }
385 else
386 /* We are dealing with leading repetitions of "/..", for example
387 "/../..", which is the Mach super-root. */
388 p += 3;
389 }
390 else
391 {
392 found_real_path = 1;
393 ++p;
394 }
395 }
396
397 forget_cached_source_info ();
398
399 if (from_tty)
400 pwd_command ((char *) 0, 1);
401}
402\f
403void
404source_command (char *args, int from_tty)
405{
406 FILE *stream;
407 struct cleanup *old_cleanups;
408 char *file = args;
409
410 if (file == NULL)
411 {
412 error ("source command requires pathname of file to source.");
413 }
414
415 file = tilde_expand (file);
b8c9b27d 416 old_cleanups = make_cleanup (xfree, file);
d318976c
FN
417
418 stream = fopen (file, FOPEN_RT);
419 if (!stream)
420 {
421 if (from_tty)
422 perror_with_name (file);
423 else
424 return;
425 }
426
427 script_from_file (stream, file);
428
429 do_cleanups (old_cleanups);
430}
431
432/* ARGSUSED */
433static void
434echo_command (char *text, int from_tty)
435{
436 char *p = text;
437 register int c;
438
439 if (text)
440 while ((c = *p++) != '\0')
441 {
442 if (c == '\\')
443 {
444 /* \ at end of argument is used after spaces
445 so they won't be lost. */
446 if (*p == 0)
447 return;
448
449 c = parse_escape (&p);
450 if (c >= 0)
451 printf_filtered ("%c", c);
452 }
453 else
454 printf_filtered ("%c", c);
455 }
456
457 /* Force this output to appear now. */
458 wrap_here ("");
459 gdb_flush (gdb_stdout);
460}
461
462/* ARGSUSED */
463static void
464shell_escape (char *arg, int from_tty)
465{
466#ifdef CANT_FORK
467 /* If ARG is NULL, they want an inferior shell, but `system' just
468 reports if the shell is available when passed a NULL arg. */
469 int rc = system (arg ? arg : "");
470
471 if (!arg)
472 arg = "inferior shell";
473
474 if (rc == -1)
475 {
476 fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", arg,
477 safe_strerror (errno));
478 gdb_flush (gdb_stderr);
479 }
480 else if (rc)
481 {
482 fprintf_unfiltered (gdb_stderr, "%s exited with status %d\n", arg, rc);
483 gdb_flush (gdb_stderr);
484 }
2584159e 485#ifdef GLOBAL_CURDIR
d318976c
FN
486 /* Make sure to return to the directory GDB thinks it is, in case the
487 shell command we just ran changed it. */
488 chdir (current_directory);
489#endif
490#else /* Can fork. */
491 int rc, status, pid;
492 char *p, *user_shell;
493
494 if ((user_shell = (char *) getenv ("SHELL")) == NULL)
495 user_shell = "/bin/sh";
496
497 /* Get the name of the shell for arg0 */
498 if ((p = strrchr (user_shell, '/')) == NULL)
499 p = user_shell;
500 else
501 p++; /* Get past '/' */
502
503 if ((pid = fork ()) == 0)
504 {
505 if (!arg)
506 execl (user_shell, p, 0);
507 else
508 execl (user_shell, p, "-c", arg, 0);
509
510 fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", user_shell,
511 safe_strerror (errno));
512 gdb_flush (gdb_stderr);
513 _exit (0177);
514 }
515
516 if (pid != -1)
517 while ((rc = wait (&status)) != pid && rc != -1)
518 ;
519 else
520 error ("Fork failed");
521#endif /* Can fork. */
522}
523
524static void
525make_command (char *arg, int from_tty)
526{
527 char *p;
528
529 if (arg == 0)
530 p = "make";
531 else
532 {
533 p = xmalloc (sizeof ("make ") + strlen (arg));
534 strcpy (p, "make ");
535 strcpy (p + sizeof ("make ") - 1, arg);
536 }
537
538 shell_escape (p, from_tty);
539}
540
541/* ARGSUSED */
542static void
543show_user (char *args, int from_tty)
544{
545 struct cmd_list_element *c;
546 extern struct cmd_list_element *cmdlist;
547
548 if (args)
549 {
550 c = lookup_cmd (&args, cmdlist, "", 0, 1);
551 if (c->class != class_user)
552 error ("Not a user command.");
553 show_user_1 (c, gdb_stdout);
554 }
555 else
556 {
557 for (c = cmdlist; c; c = c->next)
558 {
559 if (c->class == class_user)
560 show_user_1 (c, gdb_stdout);
561 }
562 }
563}
564
565/* Search through names of commands and documentations for a certain
566 regular expression.
567*/
568void
569apropos_command (char *searchstr, int from_tty)
570{
571 extern struct cmd_list_element *cmdlist; /*This is the main command list*/
572 regex_t pattern;
573 char *pattern_fastmap;
574 char errorbuffer[512];
2e94c453 575 pattern_fastmap = xcalloc (256, sizeof (char));
d318976c
FN
576 if (searchstr == NULL)
577 error("REGEXP string is empty");
578
579 if (regcomp(&pattern,searchstr,REG_ICASE) == 0)
580 {
581 pattern.fastmap=pattern_fastmap;
582 re_compile_fastmap(&pattern);
583 apropos_cmd (gdb_stdout,cmdlist,&pattern,"");
584 }
585 else
586 {
587 regerror(regcomp(&pattern,searchstr,REG_ICASE),NULL,errorbuffer,512);
588 error("Error in regular expression:%s",errorbuffer);
589 }
2b5436af 590 xfree (pattern_fastmap);
d318976c
FN
591}
592\f
593static void
594set_debug (char *arg, int from_tty)
595{
596 printf_unfiltered ("\"set debug\" must be followed by the name of a print subcommand.\n");
597 help_list (setdebuglist, "set debug ", -1, gdb_stdout);
598}
599
600static void
601show_debug (char *args, int from_tty)
602{
603 cmd_show_list (showdebuglist, from_tty, "");
604}
605
606void
607init_cmd_lists (void)
608{
609 cmdlist = NULL;
610 infolist = NULL;
611 enablelist = NULL;
612 disablelist = NULL;
613 togglelist = NULL;
614 stoplist = NULL;
615 deletelist = NULL;
616 enablebreaklist = NULL;
617 setlist = NULL;
618 unsetlist = NULL;
619 showlist = NULL;
620 sethistlist = NULL;
621 showhistlist = NULL;
622 unsethistlist = NULL;
623 maintenancelist = NULL;
624 maintenanceinfolist = NULL;
625 maintenanceprintlist = NULL;
626 setprintlist = NULL;
627 showprintlist = NULL;
628 setchecklist = NULL;
629 showchecklist = NULL;
630}
631
632\f
633void
634init_cli_cmds (void)
635{
636 struct cmd_list_element *c;
637
638 /* Define the classes of commands.
639 They will appear in the help list in the reverse of this order. */
640
e00d1dc8 641 add_cmd ("internals", class_maintenance, NULL,
d318976c
FN
642 "Maintenance commands.\n\
643Some gdb commands are provided just for use by gdb maintainers.\n\
644These commands are subject to frequent change, and may not be as\n\
645well documented as user commands.",
646 &cmdlist);
e00d1dc8
AC
647 add_cmd ("obscure", class_obscure, NULL, "Obscure features.", &cmdlist);
648 add_cmd ("aliases", class_alias, NULL, "Aliases of other commands.", &cmdlist);
649 add_cmd ("user-defined", class_user, NULL, "User-defined commands.\n\
d318976c
FN
650The commands in this class are those defined by the user.\n\
651Use the \"define\" command to define a command.", &cmdlist);
e00d1dc8 652 add_cmd ("support", class_support, NULL, "Support facilities.", &cmdlist);
d318976c 653 if (!dbx_commands)
e00d1dc8
AC
654 add_cmd ("status", class_info, NULL, "Status inquiries.", &cmdlist);
655 add_cmd ("files", class_files, NULL, "Specifying and examining files.", &cmdlist);
656 add_cmd ("breakpoints", class_breakpoint, NULL, "Making program stop at certain points.", &cmdlist);
657 add_cmd ("data", class_vars, NULL, "Examining data.", &cmdlist);
658 add_cmd ("stack", class_stack, NULL, "Examining the stack.\n\
d318976c
FN
659The stack is made up of stack frames. Gdb assigns numbers to stack frames\n\
660counting from zero for the innermost (currently executing) frame.\n\n\
661At any time gdb identifies one frame as the \"selected\" frame.\n\
662Variable lookups are done with respect to the selected frame.\n\
663When the program being debugged stops, gdb selects the innermost frame.\n\
664The commands below can be used to select other frames by number or address.",
665 &cmdlist);
e00d1dc8 666 add_cmd ("running", class_run, NULL, "Running the program.", &cmdlist);
d318976c
FN
667
668 /* Define general commands. */
669
670 add_com ("pwd", class_files, pwd_command,
671 "Print working directory. This is used for your program as well.");
672 c = add_cmd ("cd", class_files, cd_command,
673 "Set working directory to DIR for debugger and program being debugged.\n\
674The change does not take effect for the program being debugged\n\
675until the next time it is started.", &cmdlist);
5ba2abeb 676 set_cmd_completer (c, filename_completer);
d318976c
FN
677
678 add_com ("echo", class_support, echo_command,
679 "Print a constant string. Give string as argument.\n\
680C escape sequences may be used in the argument.\n\
681No newline is added at the end of the argument;\n\
682use \"\\n\" if you want a newline to be printed.\n\
683Since leading and trailing whitespace are ignored in command arguments,\n\
684if you want to print some you must use \"\\\" before leading whitespace\n\
685to be printed or after trailing whitespace.");
686 add_com ("document", class_support, document_command,
687 "Document a user-defined command.\n\
688Give command name as argument. Give documentation on following lines.\n\
689End with a line of just \"end\".");
690 add_com ("define", class_support, define_command,
691 "Define a new command name. Command name is argument.\n\
692Definition appears on following lines, one command per line.\n\
693End with a line of just \"end\".\n\
694Use the \"document\" command to give documentation for the new command.\n\
695Commands defined in this way may have up to ten arguments.");
696
d318976c
FN
697 c = add_cmd ("source", class_support, source_command,
698 "Read commands from a file named FILE.\n\
699Note that the file \"" GDBINIT_FILENAME "\" is read automatically in this way\n\
700when gdb is started.", &cmdlist);
5ba2abeb 701 set_cmd_completer (c, filename_completer);
d318976c
FN
702
703 add_com ("quit", class_support, quit_command, "Exit gdb.");
db60ec62 704 c = add_com ("help", class_support, help_command, "Print list of commands.");
5ba2abeb 705 set_cmd_completer (c, command_completer);
d318976c
FN
706 add_com_alias ("q", "quit", class_support, 1);
707 add_com_alias ("h", "help", class_support, 1);
708
709 c = add_set_cmd ("verbose", class_support, var_boolean, (char *) &info_verbose,
710 "Set ",
711 &setlist),
712 add_show_from_set (c, &showlist);
9f60d481 713 set_cmd_sfunc (c, set_verbose);
d318976c
FN
714 set_verbose (NULL, 0, c);
715
716 add_prefix_cmd ("history", class_support, set_history,
717 "Generic command for setting command history parameters.",
718 &sethistlist, "set history ", 0, &setlist);
719 add_prefix_cmd ("history", class_support, show_history,
720 "Generic command for showing command history parameters.",
721 &showhistlist, "show history ", 0, &showlist);
722
723 add_show_from_set
724 (add_set_cmd ("expansion", no_class, var_boolean, (char *) &history_expansion_p,
725 "Set history expansion on command input.\n\
726Without an argument, history expansion is enabled.", &sethistlist),
727 &showhistlist);
728
729 add_prefix_cmd ("info", class_info, info_command,
730 "Generic command for showing things about the program being debugged.",
731 &infolist, "info ", 0, &cmdlist);
732 add_com_alias ("i", "info", class_info, 1);
733
734 add_com ("complete", class_obscure, complete_command,
735 "List the completions for the rest of the line as a command.");
736
737 add_prefix_cmd ("show", class_info, show_command,
738 "Generic command for showing things about the debugger.",
739 &showlist, "show ", 0, &cmdlist);
740 /* Another way to get at the same thing. */
741 add_info ("set", show_command, "Show all GDB settings.");
742
743 add_cmd ("commands", no_class, show_commands,
744 "Show the history of commands you typed.\n\
745You can supply a command number to start with, or a `+' to start after\n\
746the previous command number shown.",
747 &showlist);
748
749 add_cmd ("version", no_class, show_version,
750 "Show what version of GDB this is.", &showlist);
751
752 add_com ("while", class_support, while_command,
753 "Execute nested commands WHILE the conditional expression is non zero.\n\
754The conditional expression must follow the word `while' and must in turn be\n\
755followed by a new line. The nested commands must be entered one per line,\n\
756and should be terminated by the word `end'.");
757
758 add_com ("if", class_support, if_command,
759 "Execute nested commands once IF the conditional expression is non zero.\n\
760The conditional expression must follow the word `if' and must in turn be\n\
761followed by a new line. The nested commands must be entered one per line,\n\
762and should be terminated by the word 'else' or `end'. If an else clause\n\
763is used, the same rules apply to its nested commands as to the first ones.");
764
765 /* If target is open when baud changes, it doesn't take effect until the
766 next open (I think, not sure). */
767 add_show_from_set (add_set_cmd ("remotebaud", no_class,
768 var_zinteger, (char *) &baud_rate,
769 "Set baud rate for remote serial I/O.\n\
770This value is used to set the speed of the serial port when debugging\n\
771using remote targets.", &setlist),
772 &showlist);
773
774 c = add_set_cmd ("remotedebug", no_class, var_zinteger,
775 (char *) &remote_debug,
776 "Set debugging of remote protocol.\n\
777When enabled, each packet sent or received with the remote target\n\
778is displayed.", &setlist);
779 deprecate_cmd (c, "set debug remote");
780 deprecate_cmd (add_show_from_set (c, &showlist), "show debug remote");
781
782 add_show_from_set (add_set_cmd ("remote", no_class, var_zinteger,
783 (char *) &remote_debug,
784 "Set debugging of remote protocol.\n\
785When enabled, each packet sent or received with the remote target\n\
786is displayed.", &setdebuglist),
787 &showdebuglist);
788
789 add_show_from_set (
790 add_set_cmd ("remotetimeout", no_class, var_integer, (char *) &remote_timeout,
791 "Set timeout limit to wait for target to respond.\n\
792This value is used to set the time limit for gdb to wait for a response\n\
793from the target.", &setlist),
794 &showlist);
795
796 add_prefix_cmd ("debug", no_class, set_debug,
797 "Generic command for setting gdb debugging flags",
798 &setdebuglist, "set debug ", 0, &setlist);
799
800 add_prefix_cmd ("debug", no_class, show_debug,
801 "Generic command for showing gdb debugging flags",
802 &showdebuglist, "show debug ", 0, &showlist);
803
fa58ee11
EZ
804 c = add_com ("shell", class_support, shell_escape,
805 "Execute the rest of the line as a shell command. \n\
d318976c 806With no arguments, run an inferior shell.");
5ba2abeb 807 set_cmd_completer (c, filename_completer);
d318976c
FN
808
809 /* NOTE: cagney/2000-03-20: Being able to enter ``(gdb) !ls'' would
810 be a really useful feature. Unfortunately, the below wont do
811 this. Instead it adds support for the form ``(gdb) ! ls''
812 (i.e. the space is required). If the ``!'' command below is
813 added the complains about no ``!'' command would be replaced by
814 complains about how the ``!'' command is broken :-) */
815 if (xdb_commands)
816 add_com_alias ("!", "shell", class_support, 0);
817
fa58ee11
EZ
818 c = add_com ("make", class_support, make_command,
819 "Run the ``make'' program using the rest of the line as arguments.");
5ba2abeb 820 set_cmd_completer (c, filename_completer);
d318976c
FN
821 add_cmd ("user", no_class, show_user,
822 "Show definitions of user defined commands.\n\
823Argument is the name of the user defined command.\n\
824With no argument, show definitions of all user defined commands.", &showlist);
825 add_com ("apropos", class_support, apropos_command, "Search for commands matching a REGEXP");
826}
This page took 0.124678 seconds and 4 git commands to generate.