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