Commit | Line | Data |
---|---|---|
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 */ |
5f8a3188 | 27 | #include "gdb_string.h" |
0378c332 FN |
28 | #include "linespec.h" |
29 | #include "expression.h" | |
30 | #include "language.h" | |
fe4e3eb8 | 31 | #include "filenames.h" /* for DOSish file names */ |
0378c332 FN |
32 | #include "objfiles.h" |
33 | #include "source.h" | |
d318976c | 34 | |
d318976c | 35 | #include "ui-out.h" |
d318976c FN |
36 | |
37 | #include "top.h" | |
38 | #include "cli/cli-decode.h" | |
39 | #include "cli/cli-script.h" | |
40 | #include "cli/cli-setshow.h" | |
41 | #include "cli/cli-cmds.h" | |
42 | ||
43 | #ifndef GDBINIT_FILENAME | |
44 | #define GDBINIT_FILENAME ".gdbinit" | |
45 | #endif | |
46 | ||
d318976c FN |
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 | ||
0378c332 | 59 | /* Prototypes for local command functions */ |
d318976c FN |
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 | ||
0378c332 FN |
87 | static void edit_command (char *, int); |
88 | ||
89 | static void list_command (char *, int); | |
90 | ||
d318976c | 91 | void apropos_command (char *, int); |
0378c332 FN |
92 | |
93 | /* Prototypes for local utility functions */ | |
94 | ||
95 | static void ambiguous_line_spec (struct symtabs_and_lines *); | |
d318976c | 96 | \f |
20f01a46 DH |
97 | /* Limit the call depth of user-defined commands */ |
98 | int max_user_call_depth; | |
99 | ||
d318976c FN |
100 | /* Define all cmd_list_elements. */ |
101 | ||
102 | /* Chain containing all defined commands. */ | |
103 | ||
104 | struct cmd_list_element *cmdlist; | |
105 | ||
106 | /* Chain containing all defined info subcommands. */ | |
107 | ||
108 | struct cmd_list_element *infolist; | |
109 | ||
110 | /* Chain containing all defined enable subcommands. */ | |
111 | ||
112 | struct cmd_list_element *enablelist; | |
113 | ||
114 | /* Chain containing all defined disable subcommands. */ | |
115 | ||
116 | struct cmd_list_element *disablelist; | |
117 | ||
118 | /* Chain containing all defined toggle subcommands. */ | |
119 | ||
120 | struct cmd_list_element *togglelist; | |
121 | ||
122 | /* Chain containing all defined stop subcommands. */ | |
123 | ||
124 | struct cmd_list_element *stoplist; | |
125 | ||
126 | /* Chain containing all defined delete subcommands. */ | |
127 | ||
128 | struct cmd_list_element *deletelist; | |
129 | ||
130 | /* Chain containing all defined "enable breakpoint" subcommands. */ | |
131 | ||
132 | struct cmd_list_element *enablebreaklist; | |
133 | ||
134 | /* Chain containing all defined set subcommands */ | |
135 | ||
136 | struct cmd_list_element *setlist; | |
137 | ||
138 | /* Chain containing all defined unset subcommands */ | |
139 | ||
140 | struct cmd_list_element *unsetlist; | |
141 | ||
142 | /* Chain containing all defined show subcommands. */ | |
143 | ||
144 | struct cmd_list_element *showlist; | |
145 | ||
146 | /* Chain containing all defined \"set history\". */ | |
147 | ||
148 | struct cmd_list_element *sethistlist; | |
149 | ||
150 | /* Chain containing all defined \"show history\". */ | |
151 | ||
152 | struct cmd_list_element *showhistlist; | |
153 | ||
154 | /* Chain containing all defined \"unset history\". */ | |
155 | ||
156 | struct cmd_list_element *unsethistlist; | |
157 | ||
158 | /* Chain containing all defined maintenance subcommands. */ | |
159 | ||
160 | struct cmd_list_element *maintenancelist; | |
161 | ||
162 | /* Chain containing all defined "maintenance info" subcommands. */ | |
163 | ||
164 | struct cmd_list_element *maintenanceinfolist; | |
165 | ||
166 | /* Chain containing all defined "maintenance print" subcommands. */ | |
167 | ||
168 | struct cmd_list_element *maintenanceprintlist; | |
169 | ||
170 | struct cmd_list_element *setprintlist; | |
171 | ||
172 | struct cmd_list_element *showprintlist; | |
173 | ||
174 | struct cmd_list_element *setdebuglist; | |
175 | ||
176 | struct cmd_list_element *showdebuglist; | |
177 | ||
178 | struct cmd_list_element *setchecklist; | |
179 | ||
180 | struct cmd_list_element *showchecklist; | |
181 | \f | |
182 | /* Utility used everywhere when at least one argument is needed and | |
183 | none is supplied. */ | |
184 | ||
185 | void | |
186 | error_no_arg (char *why) | |
187 | { | |
188 | error ("Argument required (%s).", why); | |
189 | } | |
190 | ||
191 | /* The "info" command is defined as a prefix, with allow_unknown = 0. | |
192 | Therefore, its own definition is called only for "info" with no args. */ | |
193 | ||
194 | /* ARGSUSED */ | |
195 | static void | |
196 | info_command (char *arg, int from_tty) | |
197 | { | |
198 | printf_unfiltered ("\"info\" must be followed by the name of an info command.\n"); | |
199 | help_list (infolist, "info ", -1, gdb_stdout); | |
200 | } | |
201 | ||
202 | /* The "show" command with no arguments shows all the settings. */ | |
203 | ||
204 | /* ARGSUSED */ | |
205 | static void | |
206 | show_command (char *arg, int from_tty) | |
207 | { | |
208 | cmd_show_list (showlist, from_tty, ""); | |
209 | } | |
210 | \f | |
211 | /* Provide documentation on command or list given by COMMAND. FROM_TTY | |
212 | is ignored. */ | |
213 | ||
214 | /* ARGSUSED */ | |
215 | static void | |
216 | help_command (char *command, int from_tty) | |
217 | { | |
218 | help_cmd (command, gdb_stdout); | |
219 | } | |
220 | \f | |
83d31a92 TT |
221 | /* String compare function for qsort. */ |
222 | static int | |
223 | compare_strings (const void *arg1, const void *arg2) | |
224 | { | |
225 | const char **s1 = (const char **) arg1; | |
226 | const char **s2 = (const char **) arg2; | |
227 | return strcmp (*s1, *s2); | |
228 | } | |
229 | ||
d318976c FN |
230 | /* The "complete" command is used by Emacs to implement completion. */ |
231 | ||
232 | /* ARGSUSED */ | |
233 | static void | |
234 | complete_command (char *arg, int from_tty) | |
235 | { | |
236 | int i; | |
237 | int argpoint; | |
83d31a92 | 238 | char **completions; |
d318976c FN |
239 | |
240 | dont_repeat (); | |
241 | ||
242 | if (arg == NULL) | |
243 | arg = ""; | |
244 | argpoint = strlen (arg); | |
245 | ||
83d31a92 TT |
246 | completions = complete_line (arg, arg, argpoint); |
247 | ||
248 | if (completions) | |
d318976c | 249 | { |
83d31a92 TT |
250 | int item, size; |
251 | ||
252 | for (size = 0; completions[size]; ++size) | |
253 | ; | |
254 | qsort (completions, size, sizeof (char *), compare_strings); | |
255 | ||
256 | /* We do extra processing here since we only want to print each | |
257 | unique item once. */ | |
258 | item = 0; | |
259 | while (item < size) | |
260 | { | |
261 | int next_item; | |
262 | printf_unfiltered ("%s\n", completions[item]); | |
263 | next_item = item + 1; | |
264 | while (next_item < size | |
265 | && ! strcmp (completions[item], completions[next_item])) | |
266 | { | |
267 | xfree (completions[next_item]); | |
268 | ++next_item; | |
269 | } | |
270 | ||
271 | xfree (completions[item]); | |
272 | item = next_item; | |
273 | } | |
274 | ||
275 | xfree (completions); | |
d318976c FN |
276 | } |
277 | } | |
278 | ||
bbaca940 AC |
279 | int |
280 | is_complete_command (struct cmd_list_element *c) | |
d318976c | 281 | { |
bbaca940 | 282 | return cmd_cfunc_eq (c, complete_command); |
d318976c FN |
283 | } |
284 | ||
285 | /* ARGSUSED */ | |
286 | static void | |
287 | show_version (char *args, int from_tty) | |
288 | { | |
289 | immediate_quit++; | |
290 | print_gdb_version (gdb_stdout); | |
291 | printf_filtered ("\n"); | |
292 | immediate_quit--; | |
293 | } | |
294 | ||
295 | /* Handle the quit command. */ | |
296 | ||
297 | void | |
298 | quit_command (char *args, int from_tty) | |
299 | { | |
300 | if (!quit_confirm ()) | |
301 | error ("Not confirmed."); | |
302 | quit_force (args, from_tty); | |
303 | } | |
304 | ||
305 | /* ARGSUSED */ | |
306 | static void | |
307 | pwd_command (char *args, int from_tty) | |
308 | { | |
309 | if (args) | |
310 | error ("The \"pwd\" command does not take an argument: %s", args); | |
311 | getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)); | |
312 | ||
313 | if (!STREQ (gdb_dirbuf, current_directory)) | |
314 | printf_unfiltered ("Working directory %s\n (canonically %s).\n", | |
315 | current_directory, gdb_dirbuf); | |
316 | else | |
317 | printf_unfiltered ("Working directory %s.\n", current_directory); | |
318 | } | |
319 | ||
320 | void | |
321 | cd_command (char *dir, int from_tty) | |
322 | { | |
323 | int len; | |
324 | /* Found something other than leading repetitions of "/..". */ | |
325 | int found_real_path; | |
326 | char *p; | |
327 | ||
328 | /* If the new directory is absolute, repeat is a no-op; if relative, | |
329 | repeat might be useful but is more likely to be a mistake. */ | |
330 | dont_repeat (); | |
331 | ||
332 | if (dir == 0) | |
333 | error_no_arg ("new working directory"); | |
334 | ||
335 | dir = tilde_expand (dir); | |
b8c9b27d | 336 | make_cleanup (xfree, dir); |
d318976c FN |
337 | |
338 | if (chdir (dir) < 0) | |
339 | perror_with_name (dir); | |
340 | ||
c3690141 | 341 | #ifdef HAVE_DOS_BASED_FILE_SYSTEM |
d318976c FN |
342 | /* There's too much mess with DOSish names like "d:", "d:.", |
343 | "d:./foo" etc. Instead of having lots of special #ifdef'ed code, | |
344 | simply get the canonicalized name of the current directory. */ | |
345 | dir = getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)); | |
346 | #endif | |
347 | ||
348 | len = strlen (dir); | |
fe4e3eb8 | 349 | if (IS_DIR_SEPARATOR (dir[len - 1])) |
d318976c FN |
350 | { |
351 | /* Remove the trailing slash unless this is a root directory | |
352 | (including a drive letter on non-Unix systems). */ | |
353 | if (!(len == 1) /* "/" */ | |
c3690141 | 354 | #ifdef HAVE_DOS_BASED_FILE_SYSTEM |
fe4e3eb8 | 355 | && !(len == 3 && dir[1] == ':') /* "d:/" */ |
d318976c FN |
356 | #endif |
357 | ) | |
358 | len--; | |
359 | } | |
360 | ||
361 | dir = savestring (dir, len); | |
fe4e3eb8 | 362 | if (IS_ABSOLUTE_PATH (dir)) |
d318976c FN |
363 | current_directory = dir; |
364 | else | |
365 | { | |
fe4e3eb8 | 366 | if (IS_DIR_SEPARATOR (current_directory[strlen (current_directory) - 1])) |
d318976c FN |
367 | current_directory = concat (current_directory, dir, NULL); |
368 | else | |
369 | current_directory = concat (current_directory, SLASH_STRING, dir, NULL); | |
b8c9b27d | 370 | xfree (dir); |
d318976c FN |
371 | } |
372 | ||
373 | /* Now simplify any occurrences of `.' and `..' in the pathname. */ | |
374 | ||
375 | found_real_path = 0; | |
376 | for (p = current_directory; *p;) | |
377 | { | |
fe4e3eb8 EZ |
378 | if (IS_DIR_SEPARATOR (p[0]) && p[1] == '.' |
379 | && (p[2] == 0 || IS_DIR_SEPARATOR (p[2]))) | |
d318976c | 380 | strcpy (p, p + 2); |
fe4e3eb8 EZ |
381 | else if (IS_DIR_SEPARATOR (p[0]) && p[1] == '.' && p[2] == '.' |
382 | && (p[3] == 0 || IS_DIR_SEPARATOR (p[3]))) | |
d318976c FN |
383 | { |
384 | if (found_real_path) | |
385 | { | |
386 | /* Search backwards for the directory just before the "/.." | |
387 | and obliterate it and the "/..". */ | |
388 | char *q = p; | |
fe4e3eb8 | 389 | while (q != current_directory && !IS_DIR_SEPARATOR (q[-1])) |
d318976c FN |
390 | --q; |
391 | ||
392 | if (q == current_directory) | |
393 | /* current_directory is | |
394 | a relative pathname ("can't happen"--leave it alone). */ | |
395 | ++p; | |
396 | else | |
397 | { | |
398 | strcpy (q - 1, p + 3); | |
399 | p = q - 1; | |
400 | } | |
401 | } | |
402 | else | |
403 | /* We are dealing with leading repetitions of "/..", for example | |
404 | "/../..", which is the Mach super-root. */ | |
405 | p += 3; | |
406 | } | |
407 | else | |
408 | { | |
409 | found_real_path = 1; | |
410 | ++p; | |
411 | } | |
412 | } | |
413 | ||
414 | forget_cached_source_info (); | |
415 | ||
416 | if (from_tty) | |
417 | pwd_command ((char *) 0, 1); | |
418 | } | |
419 | \f | |
420 | void | |
421 | source_command (char *args, int from_tty) | |
422 | { | |
423 | FILE *stream; | |
424 | struct cleanup *old_cleanups; | |
425 | char *file = args; | |
426 | ||
427 | if (file == NULL) | |
428 | { | |
429 | error ("source command requires pathname of file to source."); | |
430 | } | |
431 | ||
432 | file = tilde_expand (file); | |
b8c9b27d | 433 | old_cleanups = make_cleanup (xfree, file); |
d318976c FN |
434 | |
435 | stream = fopen (file, FOPEN_RT); | |
436 | if (!stream) | |
437 | { | |
438 | if (from_tty) | |
439 | perror_with_name (file); | |
440 | else | |
441 | return; | |
442 | } | |
443 | ||
444 | script_from_file (stream, file); | |
445 | ||
446 | do_cleanups (old_cleanups); | |
447 | } | |
448 | ||
449 | /* ARGSUSED */ | |
450 | static void | |
451 | echo_command (char *text, int from_tty) | |
452 | { | |
453 | char *p = text; | |
454 | register int c; | |
455 | ||
456 | if (text) | |
457 | while ((c = *p++) != '\0') | |
458 | { | |
459 | if (c == '\\') | |
460 | { | |
461 | /* \ at end of argument is used after spaces | |
462 | so they won't be lost. */ | |
463 | if (*p == 0) | |
464 | return; | |
465 | ||
466 | c = parse_escape (&p); | |
467 | if (c >= 0) | |
468 | printf_filtered ("%c", c); | |
469 | } | |
470 | else | |
471 | printf_filtered ("%c", c); | |
472 | } | |
473 | ||
474 | /* Force this output to appear now. */ | |
475 | wrap_here (""); | |
476 | gdb_flush (gdb_stdout); | |
477 | } | |
478 | ||
479 | /* ARGSUSED */ | |
480 | static void | |
481 | shell_escape (char *arg, int from_tty) | |
482 | { | |
483 | #ifdef CANT_FORK | |
484 | /* If ARG is NULL, they want an inferior shell, but `system' just | |
485 | reports if the shell is available when passed a NULL arg. */ | |
486 | int rc = system (arg ? arg : ""); | |
487 | ||
488 | if (!arg) | |
489 | arg = "inferior shell"; | |
490 | ||
491 | if (rc == -1) | |
492 | { | |
493 | fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", arg, | |
494 | safe_strerror (errno)); | |
495 | gdb_flush (gdb_stderr); | |
496 | } | |
497 | else if (rc) | |
498 | { | |
499 | fprintf_unfiltered (gdb_stderr, "%s exited with status %d\n", arg, rc); | |
500 | gdb_flush (gdb_stderr); | |
501 | } | |
2584159e | 502 | #ifdef GLOBAL_CURDIR |
d318976c FN |
503 | /* Make sure to return to the directory GDB thinks it is, in case the |
504 | shell command we just ran changed it. */ | |
505 | chdir (current_directory); | |
506 | #endif | |
507 | #else /* Can fork. */ | |
508 | int rc, status, pid; | |
509 | char *p, *user_shell; | |
510 | ||
511 | if ((user_shell = (char *) getenv ("SHELL")) == NULL) | |
512 | user_shell = "/bin/sh"; | |
513 | ||
514 | /* Get the name of the shell for arg0 */ | |
515 | if ((p = strrchr (user_shell, '/')) == NULL) | |
516 | p = user_shell; | |
517 | else | |
518 | p++; /* Get past '/' */ | |
519 | ||
520 | if ((pid = fork ()) == 0) | |
521 | { | |
522 | if (!arg) | |
523 | execl (user_shell, p, 0); | |
524 | else | |
525 | execl (user_shell, p, "-c", arg, 0); | |
526 | ||
527 | fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", user_shell, | |
528 | safe_strerror (errno)); | |
529 | gdb_flush (gdb_stderr); | |
530 | _exit (0177); | |
531 | } | |
532 | ||
533 | if (pid != -1) | |
534 | while ((rc = wait (&status)) != pid && rc != -1) | |
535 | ; | |
536 | else | |
537 | error ("Fork failed"); | |
538 | #endif /* Can fork. */ | |
539 | } | |
540 | ||
0378c332 FN |
541 | static void |
542 | edit_command (char *arg, int from_tty) | |
543 | { | |
544 | struct symtabs_and_lines sals; | |
545 | struct symtab_and_line sal; | |
546 | struct symbol *sym; | |
547 | char *arg1; | |
548 | int cmdlen, log10; | |
549 | unsigned m; | |
550 | char *editor; | |
551 | char *p; | |
552 | ||
553 | /* Pull in the current default source line if necessary */ | |
554 | if (arg == 0) | |
53cb0458 FN |
555 | { |
556 | set_default_source_symtab_and_line (); | |
557 | sal = get_current_source_symtab_and_line (); | |
558 | } | |
0378c332 FN |
559 | |
560 | /* bare "edit" edits file with present line. */ | |
561 | ||
562 | if (arg == 0) | |
563 | { | |
564 | if (sal.symtab == 0) | |
565 | error ("No default source file yet."); | |
566 | sal.line += get_lines_to_list () / 2; | |
567 | } | |
568 | else | |
569 | { | |
570 | ||
571 | /* Now should only be one argument -- decode it in SAL */ | |
572 | ||
573 | arg1 = arg; | |
574 | sals = decode_line_1 (&arg1, 0, 0, 0, 0); | |
575 | ||
576 | if (! sals.nelts) return; /* C++ */ | |
577 | if (sals.nelts > 1) { | |
578 | ambiguous_line_spec (&sals); | |
579 | xfree (sals.sals); | |
580 | return; | |
581 | } | |
582 | ||
583 | sal = sals.sals[0]; | |
584 | xfree (sals.sals); | |
585 | ||
586 | if (*arg1) | |
587 | error ("Junk at end of line specification."); | |
588 | ||
589 | /* if line was specified by address, | |
590 | first print exactly which line, and which file. | |
591 | In this case, sal.symtab == 0 means address is outside | |
592 | of all known source files, not that user failed to give a filename. */ | |
593 | if (*arg == '*') | |
594 | { | |
595 | if (sal.symtab == 0) | |
596 | /* FIXME-32x64--assumes sal.pc fits in long. */ | |
597 | error ("No source file for address %s.", | |
598 | local_hex_string((unsigned long) sal.pc)); | |
599 | sym = find_pc_function (sal.pc); | |
600 | if (sym) | |
601 | { | |
602 | print_address_numeric (sal.pc, 1, gdb_stdout); | |
603 | printf_filtered (" is in "); | |
604 | fputs_filtered (SYMBOL_SOURCE_NAME (sym), gdb_stdout); | |
605 | printf_filtered (" (%s:%d).\n", sal.symtab->filename, sal.line); | |
606 | } | |
607 | else | |
608 | { | |
609 | print_address_numeric (sal.pc, 1, gdb_stdout); | |
610 | printf_filtered (" is at %s:%d.\n", | |
611 | sal.symtab->filename, sal.line); | |
612 | } | |
613 | } | |
614 | ||
615 | /* If what was given does not imply a symtab, it must be an undebuggable | |
616 | symbol which means no source code. */ | |
617 | ||
618 | if (sal.symtab == 0) | |
619 | error ("No line number known for %s.", arg); | |
620 | } | |
621 | ||
622 | if ((editor = (char *) getenv ("EDITOR")) == NULL) | |
623 | editor = "/bin/ex"; | |
624 | ||
625 | /* Approximate base-10 log of line to 1 unit for digit count */ | |
626 | for(log10=32, m=0x80000000; !(sal.line & m) && log10>0; log10--, m=m>>1); | |
627 | log10 = 1 + (int)((log10 + (0 == ((m-1) & sal.line)))/3.32192809); | |
628 | ||
629 | cmdlen = strlen(editor) + 1 | |
630 | + (NULL == sal.symtab->dirname ? 0 : strlen(sal.symtab->dirname) + 1) | |
631 | + (NULL == sal.symtab->filename? 0 : strlen(sal.symtab->filename)+ 1) | |
632 | + log10 + 2; | |
633 | ||
634 | p = xmalloc(cmdlen); | |
635 | sprintf(p,"%s +%d %s%s",editor,sal.line, | |
636 | (NULL == sal.symtab->dirname ? "./" : | |
637 | (NULL != sal.symtab->filename && *(sal.symtab->filename) != '/') ? | |
638 | sal.symtab->dirname : ""), | |
639 | (NULL == sal.symtab->filename ? "unknown" : sal.symtab->filename) | |
640 | ); | |
641 | shell_escape(p, from_tty); | |
642 | ||
643 | xfree(p); | |
644 | } | |
645 | ||
646 | static void | |
647 | list_command (char *arg, int from_tty) | |
648 | { | |
649 | struct symtabs_and_lines sals, sals_end; | |
650 | struct symtab_and_line sal, sal_end, cursal; | |
651 | struct symbol *sym; | |
652 | char *arg1; | |
653 | int no_end = 1; | |
654 | int dummy_end = 0; | |
655 | int dummy_beg = 0; | |
656 | int linenum_beg = 0; | |
657 | char *p; | |
658 | ||
659 | /* Pull in the current default source line if necessary */ | |
660 | if (arg == 0 || arg[0] == '+' || arg[0] == '-') | |
53cb0458 FN |
661 | { |
662 | set_default_source_symtab_and_line (); | |
663 | cursal = get_current_source_symtab_and_line (); | |
664 | } | |
0378c332 FN |
665 | |
666 | /* "l" or "l +" lists next ten lines. */ | |
667 | ||
668 | if (arg == 0 || STREQ (arg, "+")) | |
669 | { | |
670 | print_source_lines (cursal.symtab, cursal.line, | |
671 | cursal.line + get_lines_to_list (), 0); | |
672 | return; | |
673 | } | |
674 | ||
675 | /* "l -" lists previous ten lines, the ones before the ten just listed. */ | |
676 | if (STREQ (arg, "-")) | |
677 | { | |
678 | print_source_lines (cursal.symtab, | |
679 | max (get_first_line_listed () - get_lines_to_list (), 1), | |
680 | get_first_line_listed (), 0); | |
681 | return; | |
682 | } | |
683 | ||
684 | /* Now if there is only one argument, decode it in SAL | |
685 | and set NO_END. | |
686 | If there are two arguments, decode them in SAL and SAL_END | |
687 | and clear NO_END; however, if one of the arguments is blank, | |
688 | set DUMMY_BEG or DUMMY_END to record that fact. */ | |
689 | ||
690 | if (!have_full_symbols () && !have_partial_symbols ()) | |
691 | error ("No symbol table is loaded. Use the \"file\" command."); | |
692 | ||
693 | arg1 = arg; | |
694 | if (*arg1 == ',') | |
695 | dummy_beg = 1; | |
696 | else | |
697 | { | |
698 | sals = decode_line_1 (&arg1, 0, 0, 0, 0); | |
699 | ||
700 | if (!sals.nelts) | |
701 | return; /* C++ */ | |
702 | if (sals.nelts > 1) | |
703 | { | |
704 | ambiguous_line_spec (&sals); | |
705 | xfree (sals.sals); | |
706 | return; | |
707 | } | |
708 | ||
709 | sal = sals.sals[0]; | |
710 | xfree (sals.sals); | |
711 | } | |
712 | ||
713 | /* Record whether the BEG arg is all digits. */ | |
714 | ||
715 | for (p = arg; p != arg1 && *p >= '0' && *p <= '9'; p++); | |
716 | linenum_beg = (p == arg1); | |
717 | ||
718 | while (*arg1 == ' ' || *arg1 == '\t') | |
719 | arg1++; | |
720 | if (*arg1 == ',') | |
721 | { | |
722 | no_end = 0; | |
723 | arg1++; | |
724 | while (*arg1 == ' ' || *arg1 == '\t') | |
725 | arg1++; | |
726 | if (*arg1 == 0) | |
727 | dummy_end = 1; | |
728 | else | |
729 | { | |
730 | if (dummy_beg) | |
731 | sals_end = decode_line_1 (&arg1, 0, 0, 0, 0); | |
732 | else | |
733 | sals_end = decode_line_1 (&arg1, 0, sal.symtab, sal.line, 0); | |
734 | if (sals_end.nelts == 0) | |
735 | return; | |
736 | if (sals_end.nelts > 1) | |
737 | { | |
738 | ambiguous_line_spec (&sals_end); | |
739 | xfree (sals_end.sals); | |
740 | return; | |
741 | } | |
742 | sal_end = sals_end.sals[0]; | |
743 | xfree (sals_end.sals); | |
744 | } | |
745 | } | |
746 | ||
747 | if (*arg1) | |
748 | error ("Junk at end of line specification."); | |
749 | ||
750 | if (!no_end && !dummy_beg && !dummy_end | |
751 | && sal.symtab != sal_end.symtab) | |
752 | error ("Specified start and end are in different files."); | |
753 | if (dummy_beg && dummy_end) | |
754 | error ("Two empty args do not say what lines to list."); | |
755 | ||
756 | /* if line was specified by address, | |
757 | first print exactly which line, and which file. | |
758 | In this case, sal.symtab == 0 means address is outside | |
759 | of all known source files, not that user failed to give a filename. */ | |
760 | if (*arg == '*') | |
761 | { | |
762 | if (sal.symtab == 0) | |
763 | /* FIXME-32x64--assumes sal.pc fits in long. */ | |
764 | error ("No source file for address %s.", | |
765 | local_hex_string ((unsigned long) sal.pc)); | |
766 | sym = find_pc_function (sal.pc); | |
767 | if (sym) | |
768 | { | |
769 | print_address_numeric (sal.pc, 1, gdb_stdout); | |
770 | printf_filtered (" is in "); | |
771 | fputs_filtered (SYMBOL_SOURCE_NAME (sym), gdb_stdout); | |
772 | printf_filtered (" (%s:%d).\n", sal.symtab->filename, sal.line); | |
773 | } | |
774 | else | |
775 | { | |
776 | print_address_numeric (sal.pc, 1, gdb_stdout); | |
777 | printf_filtered (" is at %s:%d.\n", | |
778 | sal.symtab->filename, sal.line); | |
779 | } | |
780 | } | |
781 | ||
782 | /* If line was not specified by just a line number, | |
783 | and it does not imply a symtab, it must be an undebuggable symbol | |
784 | which means no source code. */ | |
785 | ||
786 | if (!linenum_beg && sal.symtab == 0) | |
787 | error ("No line number known for %s.", arg); | |
788 | ||
789 | /* If this command is repeated with RET, | |
790 | turn it into the no-arg variant. */ | |
791 | ||
792 | if (from_tty) | |
793 | *arg = 0; | |
794 | ||
795 | if (dummy_beg && sal_end.symtab == 0) | |
796 | error ("No default source file yet. Do \"help list\"."); | |
797 | if (dummy_beg) | |
798 | print_source_lines (sal_end.symtab, | |
799 | max (sal_end.line - (get_lines_to_list () - 1), 1), | |
800 | sal_end.line + 1, 0); | |
801 | else if (sal.symtab == 0) | |
802 | error ("No default source file yet. Do \"help list\"."); | |
803 | else if (no_end) | |
804 | { | |
805 | int first_line = sal.line - get_lines_to_list () / 2; | |
806 | ||
807 | if (first_line < 1) first_line = 1; | |
808 | ||
809 | print_source_lines (sal.symtab, | |
810 | first_line, | |
811 | first_line + get_lines_to_list (), | |
812 | 0); | |
813 | } | |
814 | else | |
815 | print_source_lines (sal.symtab, sal.line, | |
816 | (dummy_end | |
817 | ? sal.line + get_lines_to_list () | |
818 | : sal_end.line + 1), | |
819 | 0); | |
820 | } | |
821 | ||
d318976c FN |
822 | static void |
823 | make_command (char *arg, int from_tty) | |
824 | { | |
825 | char *p; | |
826 | ||
827 | if (arg == 0) | |
828 | p = "make"; | |
829 | else | |
830 | { | |
831 | p = xmalloc (sizeof ("make ") + strlen (arg)); | |
832 | strcpy (p, "make "); | |
833 | strcpy (p + sizeof ("make ") - 1, arg); | |
834 | } | |
835 | ||
836 | shell_escape (p, from_tty); | |
837 | } | |
838 | ||
839 | /* ARGSUSED */ | |
840 | static void | |
841 | show_user (char *args, int from_tty) | |
842 | { | |
843 | struct cmd_list_element *c; | |
844 | extern struct cmd_list_element *cmdlist; | |
845 | ||
846 | if (args) | |
847 | { | |
848 | c = lookup_cmd (&args, cmdlist, "", 0, 1); | |
849 | if (c->class != class_user) | |
850 | error ("Not a user command."); | |
851 | show_user_1 (c, gdb_stdout); | |
852 | } | |
853 | else | |
854 | { | |
855 | for (c = cmdlist; c; c = c->next) | |
856 | { | |
857 | if (c->class == class_user) | |
858 | show_user_1 (c, gdb_stdout); | |
859 | } | |
860 | } | |
861 | } | |
862 | ||
863 | /* Search through names of commands and documentations for a certain | |
864 | regular expression. | |
865 | */ | |
866 | void | |
867 | apropos_command (char *searchstr, int from_tty) | |
868 | { | |
869 | extern struct cmd_list_element *cmdlist; /*This is the main command list*/ | |
870 | regex_t pattern; | |
871 | char *pattern_fastmap; | |
872 | char errorbuffer[512]; | |
2e94c453 | 873 | pattern_fastmap = xcalloc (256, sizeof (char)); |
d318976c FN |
874 | if (searchstr == NULL) |
875 | error("REGEXP string is empty"); | |
876 | ||
877 | if (regcomp(&pattern,searchstr,REG_ICASE) == 0) | |
878 | { | |
879 | pattern.fastmap=pattern_fastmap; | |
880 | re_compile_fastmap(&pattern); | |
881 | apropos_cmd (gdb_stdout,cmdlist,&pattern,""); | |
882 | } | |
883 | else | |
884 | { | |
885 | regerror(regcomp(&pattern,searchstr,REG_ICASE),NULL,errorbuffer,512); | |
886 | error("Error in regular expression:%s",errorbuffer); | |
887 | } | |
2b5436af | 888 | xfree (pattern_fastmap); |
d318976c FN |
889 | } |
890 | \f | |
0378c332 FN |
891 | /* Print a list of files and line numbers which a user may choose from |
892 | in order to list a function which was specified ambiguously (as with | |
893 | `list classname::overloadedfuncname', for example). The vector in | |
894 | SALS provides the filenames and line numbers. */ | |
895 | ||
896 | static void | |
897 | ambiguous_line_spec (struct symtabs_and_lines *sals) | |
898 | { | |
899 | int i; | |
900 | ||
901 | for (i = 0; i < sals->nelts; ++i) | |
902 | printf_filtered ("file: \"%s\", line number: %d\n", | |
903 | sals->sals[i].symtab->filename, sals->sals[i].line); | |
904 | } | |
905 | ||
d318976c FN |
906 | static void |
907 | set_debug (char *arg, int from_tty) | |
908 | { | |
909 | printf_unfiltered ("\"set debug\" must be followed by the name of a print subcommand.\n"); | |
910 | help_list (setdebuglist, "set debug ", -1, gdb_stdout); | |
911 | } | |
912 | ||
913 | static void | |
914 | show_debug (char *args, int from_tty) | |
915 | { | |
916 | cmd_show_list (showdebuglist, from_tty, ""); | |
917 | } | |
918 | ||
919 | void | |
920 | init_cmd_lists (void) | |
921 | { | |
20f01a46 DH |
922 | max_user_call_depth = 1024; |
923 | ||
d318976c FN |
924 | cmdlist = NULL; |
925 | infolist = NULL; | |
926 | enablelist = NULL; | |
927 | disablelist = NULL; | |
928 | togglelist = NULL; | |
929 | stoplist = NULL; | |
930 | deletelist = NULL; | |
931 | enablebreaklist = NULL; | |
932 | setlist = NULL; | |
933 | unsetlist = NULL; | |
934 | showlist = NULL; | |
935 | sethistlist = NULL; | |
936 | showhistlist = NULL; | |
937 | unsethistlist = NULL; | |
938 | maintenancelist = NULL; | |
939 | maintenanceinfolist = NULL; | |
940 | maintenanceprintlist = NULL; | |
941 | setprintlist = NULL; | |
942 | showprintlist = NULL; | |
943 | setchecklist = NULL; | |
944 | showchecklist = NULL; | |
945 | } | |
946 | ||
947 | \f | |
948 | void | |
949 | init_cli_cmds (void) | |
950 | { | |
951 | struct cmd_list_element *c; | |
952 | ||
953 | /* Define the classes of commands. | |
954 | They will appear in the help list in the reverse of this order. */ | |
955 | ||
e00d1dc8 | 956 | add_cmd ("internals", class_maintenance, NULL, |
d318976c FN |
957 | "Maintenance commands.\n\ |
958 | Some gdb commands are provided just for use by gdb maintainers.\n\ | |
959 | These commands are subject to frequent change, and may not be as\n\ | |
960 | well documented as user commands.", | |
961 | &cmdlist); | |
e00d1dc8 AC |
962 | add_cmd ("obscure", class_obscure, NULL, "Obscure features.", &cmdlist); |
963 | add_cmd ("aliases", class_alias, NULL, "Aliases of other commands.", &cmdlist); | |
964 | add_cmd ("user-defined", class_user, NULL, "User-defined commands.\n\ | |
d318976c FN |
965 | The commands in this class are those defined by the user.\n\ |
966 | Use the \"define\" command to define a command.", &cmdlist); | |
e00d1dc8 | 967 | add_cmd ("support", class_support, NULL, "Support facilities.", &cmdlist); |
d318976c | 968 | if (!dbx_commands) |
e00d1dc8 AC |
969 | add_cmd ("status", class_info, NULL, "Status inquiries.", &cmdlist); |
970 | add_cmd ("files", class_files, NULL, "Specifying and examining files.", &cmdlist); | |
971 | add_cmd ("breakpoints", class_breakpoint, NULL, "Making program stop at certain points.", &cmdlist); | |
972 | add_cmd ("data", class_vars, NULL, "Examining data.", &cmdlist); | |
973 | add_cmd ("stack", class_stack, NULL, "Examining the stack.\n\ | |
d318976c FN |
974 | The stack is made up of stack frames. Gdb assigns numbers to stack frames\n\ |
975 | counting from zero for the innermost (currently executing) frame.\n\n\ | |
976 | At any time gdb identifies one frame as the \"selected\" frame.\n\ | |
977 | Variable lookups are done with respect to the selected frame.\n\ | |
978 | When the program being debugged stops, gdb selects the innermost frame.\n\ | |
979 | The commands below can be used to select other frames by number or address.", | |
980 | &cmdlist); | |
e00d1dc8 | 981 | add_cmd ("running", class_run, NULL, "Running the program.", &cmdlist); |
d318976c FN |
982 | |
983 | /* Define general commands. */ | |
984 | ||
985 | add_com ("pwd", class_files, pwd_command, | |
986 | "Print working directory. This is used for your program as well."); | |
987 | c = add_cmd ("cd", class_files, cd_command, | |
988 | "Set working directory to DIR for debugger and program being debugged.\n\ | |
989 | The change does not take effect for the program being debugged\n\ | |
990 | until the next time it is started.", &cmdlist); | |
5ba2abeb | 991 | set_cmd_completer (c, filename_completer); |
d318976c FN |
992 | |
993 | add_com ("echo", class_support, echo_command, | |
994 | "Print a constant string. Give string as argument.\n\ | |
995 | C escape sequences may be used in the argument.\n\ | |
996 | No newline is added at the end of the argument;\n\ | |
997 | use \"\\n\" if you want a newline to be printed.\n\ | |
998 | Since leading and trailing whitespace are ignored in command arguments,\n\ | |
999 | if you want to print some you must use \"\\\" before leading whitespace\n\ | |
1000 | to be printed or after trailing whitespace."); | |
1001 | add_com ("document", class_support, document_command, | |
1002 | "Document a user-defined command.\n\ | |
1003 | Give command name as argument. Give documentation on following lines.\n\ | |
1004 | End with a line of just \"end\"."); | |
1005 | add_com ("define", class_support, define_command, | |
1006 | "Define a new command name. Command name is argument.\n\ | |
1007 | Definition appears on following lines, one command per line.\n\ | |
1008 | End with a line of just \"end\".\n\ | |
1009 | Use the \"document\" command to give documentation for the new command.\n\ | |
1010 | Commands defined in this way may have up to ten arguments."); | |
1011 | ||
d318976c FN |
1012 | c = add_cmd ("source", class_support, source_command, |
1013 | "Read commands from a file named FILE.\n\ | |
1014 | Note that the file \"" GDBINIT_FILENAME "\" is read automatically in this way\n\ | |
1015 | when gdb is started.", &cmdlist); | |
5ba2abeb | 1016 | set_cmd_completer (c, filename_completer); |
d318976c FN |
1017 | |
1018 | add_com ("quit", class_support, quit_command, "Exit gdb."); | |
db60ec62 | 1019 | c = add_com ("help", class_support, help_command, "Print list of commands."); |
5ba2abeb | 1020 | set_cmd_completer (c, command_completer); |
d318976c FN |
1021 | add_com_alias ("q", "quit", class_support, 1); |
1022 | add_com_alias ("h", "help", class_support, 1); | |
1023 | ||
1024 | c = add_set_cmd ("verbose", class_support, var_boolean, (char *) &info_verbose, | |
1025 | "Set ", | |
1026 | &setlist), | |
1027 | add_show_from_set (c, &showlist); | |
9f60d481 | 1028 | set_cmd_sfunc (c, set_verbose); |
d318976c FN |
1029 | set_verbose (NULL, 0, c); |
1030 | ||
1031 | add_prefix_cmd ("history", class_support, set_history, | |
1032 | "Generic command for setting command history parameters.", | |
1033 | &sethistlist, "set history ", 0, &setlist); | |
1034 | add_prefix_cmd ("history", class_support, show_history, | |
1035 | "Generic command for showing command history parameters.", | |
1036 | &showhistlist, "show history ", 0, &showlist); | |
1037 | ||
1038 | add_show_from_set | |
1039 | (add_set_cmd ("expansion", no_class, var_boolean, (char *) &history_expansion_p, | |
1040 | "Set history expansion on command input.\n\ | |
1041 | Without an argument, history expansion is enabled.", &sethistlist), | |
1042 | &showhistlist); | |
1043 | ||
1044 | add_prefix_cmd ("info", class_info, info_command, | |
1045 | "Generic command for showing things about the program being debugged.", | |
1046 | &infolist, "info ", 0, &cmdlist); | |
1047 | add_com_alias ("i", "info", class_info, 1); | |
1048 | ||
1049 | add_com ("complete", class_obscure, complete_command, | |
1050 | "List the completions for the rest of the line as a command."); | |
1051 | ||
1052 | add_prefix_cmd ("show", class_info, show_command, | |
1053 | "Generic command for showing things about the debugger.", | |
1054 | &showlist, "show ", 0, &cmdlist); | |
1055 | /* Another way to get at the same thing. */ | |
1056 | add_info ("set", show_command, "Show all GDB settings."); | |
1057 | ||
1058 | add_cmd ("commands", no_class, show_commands, | |
1059 | "Show the history of commands you typed.\n\ | |
1060 | You can supply a command number to start with, or a `+' to start after\n\ | |
1061 | the previous command number shown.", | |
1062 | &showlist); | |
1063 | ||
1064 | add_cmd ("version", no_class, show_version, | |
1065 | "Show what version of GDB this is.", &showlist); | |
1066 | ||
1067 | add_com ("while", class_support, while_command, | |
1068 | "Execute nested commands WHILE the conditional expression is non zero.\n\ | |
1069 | The conditional expression must follow the word `while' and must in turn be\n\ | |
1070 | followed by a new line. The nested commands must be entered one per line,\n\ | |
1071 | and should be terminated by the word `end'."); | |
1072 | ||
1073 | add_com ("if", class_support, if_command, | |
1074 | "Execute nested commands once IF the conditional expression is non zero.\n\ | |
1075 | The conditional expression must follow the word `if' and must in turn be\n\ | |
1076 | followed by a new line. The nested commands must be entered one per line,\n\ | |
1077 | and should be terminated by the word 'else' or `end'. If an else clause\n\ | |
1078 | is used, the same rules apply to its nested commands as to the first ones."); | |
1079 | ||
1080 | /* If target is open when baud changes, it doesn't take effect until the | |
1081 | next open (I think, not sure). */ | |
1082 | add_show_from_set (add_set_cmd ("remotebaud", no_class, | |
1083 | var_zinteger, (char *) &baud_rate, | |
1084 | "Set baud rate for remote serial I/O.\n\ | |
1085 | This value is used to set the speed of the serial port when debugging\n\ | |
1086 | using remote targets.", &setlist), | |
1087 | &showlist); | |
1088 | ||
1089 | c = add_set_cmd ("remotedebug", no_class, var_zinteger, | |
1090 | (char *) &remote_debug, | |
1091 | "Set debugging of remote protocol.\n\ | |
1092 | When enabled, each packet sent or received with the remote target\n\ | |
1093 | is displayed.", &setlist); | |
1094 | deprecate_cmd (c, "set debug remote"); | |
1095 | deprecate_cmd (add_show_from_set (c, &showlist), "show debug remote"); | |
1096 | ||
1097 | add_show_from_set (add_set_cmd ("remote", no_class, var_zinteger, | |
1098 | (char *) &remote_debug, | |
1099 | "Set debugging of remote protocol.\n\ | |
1100 | When enabled, each packet sent or received with the remote target\n\ | |
1101 | is displayed.", &setdebuglist), | |
1102 | &showdebuglist); | |
1103 | ||
1104 | add_show_from_set ( | |
1105 | add_set_cmd ("remotetimeout", no_class, var_integer, (char *) &remote_timeout, | |
1106 | "Set timeout limit to wait for target to respond.\n\ | |
1107 | This value is used to set the time limit for gdb to wait for a response\n\ | |
1108 | from the target.", &setlist), | |
1109 | &showlist); | |
1110 | ||
1111 | add_prefix_cmd ("debug", no_class, set_debug, | |
1112 | "Generic command for setting gdb debugging flags", | |
1113 | &setdebuglist, "set debug ", 0, &setlist); | |
1114 | ||
1115 | add_prefix_cmd ("debug", no_class, show_debug, | |
1116 | "Generic command for showing gdb debugging flags", | |
1117 | &showdebuglist, "show debug ", 0, &showlist); | |
1118 | ||
fa58ee11 | 1119 | c = add_com ("shell", class_support, shell_escape, |
d4654627 | 1120 | "Execute the rest of the line as a shell command.\n\ |
d318976c | 1121 | With no arguments, run an inferior shell."); |
5ba2abeb | 1122 | set_cmd_completer (c, filename_completer); |
d318976c | 1123 | |
0378c332 FN |
1124 | c = add_com ("edit", class_files, edit_command, |
1125 | concat ("Edit specified file or function.\n\ | |
1126 | With no argument, edits file containing most recent line listed.\n\ | |
1127 | ", "\ | |
1128 | Editing targets can be specified in these ways:\n\ | |
1129 | FILE:LINENUM, to edit at that line in that file,\n\ | |
1130 | FUNCTION, to edit at the beginning of that function,\n\ | |
1131 | FILE:FUNCTION, to distinguish among like-named static functions.\n\ | |
1132 | *ADDRESS, to edit at the line containing that address.\n\ | |
1133 | Uses EDITOR environment variable contents as editor (or ex as default).",NULL)); | |
1134 | ||
1135 | c->completer = location_completer; | |
1136 | ||
1137 | add_com ("list", class_files, list_command, | |
1138 | concat ("List specified function or line.\n\ | |
1139 | With no argument, lists ten more lines after or around previous listing.\n\ | |
1140 | \"list -\" lists the ten lines before a previous ten-line listing.\n\ | |
1141 | One argument specifies a line, and ten lines are listed around that line.\n\ | |
1142 | Two arguments with comma between specify starting and ending lines to list.\n\ | |
1143 | ", "\ | |
1144 | Lines can be specified in these ways:\n\ | |
1145 | LINENUM, to list around that line in current file,\n\ | |
1146 | FILE:LINENUM, to list around that line in that file,\n\ | |
1147 | FUNCTION, to list around beginning of that function,\n\ | |
1148 | FILE:FUNCTION, to distinguish among like-named static functions.\n\ | |
1149 | *ADDRESS, to list around the line containing that address.\n\ | |
1150 | With two args if one is empty it stands for ten lines away from the other arg.", NULL)); | |
1151 | ||
1152 | if (!xdb_commands) | |
1153 | add_com_alias ("l", "list", class_files, 1); | |
1154 | else | |
1155 | add_com_alias ("v", "list", class_files, 1); | |
1156 | ||
1157 | if (dbx_commands) | |
1158 | add_com_alias ("file", "list", class_files, 1); | |
1159 | ||
1160 | ||
d318976c FN |
1161 | /* NOTE: cagney/2000-03-20: Being able to enter ``(gdb) !ls'' would |
1162 | be a really useful feature. Unfortunately, the below wont do | |
1163 | this. Instead it adds support for the form ``(gdb) ! ls'' | |
1164 | (i.e. the space is required). If the ``!'' command below is | |
1165 | added the complains about no ``!'' command would be replaced by | |
1166 | complains about how the ``!'' command is broken :-) */ | |
1167 | if (xdb_commands) | |
1168 | add_com_alias ("!", "shell", class_support, 0); | |
1169 | ||
fa58ee11 EZ |
1170 | c = add_com ("make", class_support, make_command, |
1171 | "Run the ``make'' program using the rest of the line as arguments."); | |
5ba2abeb | 1172 | set_cmd_completer (c, filename_completer); |
d318976c FN |
1173 | add_cmd ("user", no_class, show_user, |
1174 | "Show definitions of user defined commands.\n\ | |
1175 | Argument is the name of the user defined command.\n\ | |
1176 | With no argument, show definitions of all user defined commands.", &showlist); | |
1177 | add_com ("apropos", class_support, apropos_command, "Search for commands matching a REGEXP"); | |
20f01a46 DH |
1178 | |
1179 | add_show_from_set ( | |
1180 | add_set_cmd ("max-user-call-depth", no_class, var_integer, | |
1181 | (char *) &max_user_call_depth, | |
1182 | "Set the max call depth for user-defined commands.\n", | |
1183 | &setlist), | |
1184 | &showlist); | |
d318976c | 1185 | } |