1 /* Top level for GDB, the GNU debugger.
2 Copyright (C) 1986, 1987 Free Software Foundation, Inc.
4 GDB is distributed in the hope that it will be useful, but WITHOUT ANY
5 WARRANTY. No author or distributor accepts responsibility to anyone
6 for the consequences of using it or for whether it serves any
7 particular purpose or works at all, unless he says so in writing.
8 Refer to the GDB General Public License for full details.
10 Everyone is granted permission to copy, modify and redistribute GDB,
11 but only under the conditions described in the GDB General Public
12 License. A copy of this license is supposed to have been given to you
13 along with GDB so you can know your rights and responsibilities. It
14 should be in a file named COPYING. Among other things, the copyright
15 notice and this notice must be preserved on all copies.
17 In other words, go ahead and share GDB, but don't try to stop
18 anyone else from sharing it farther. Help stamp out software hoarding!
21 #include <sys/types.h>
26 #include <sys/param.h>
31 #ifdef SET_STACK_LIMIT_HUGE
33 #include <sys/resource.h>
36 /* Version number of GDB, as a string. */
40 /* Chain containing all defined commands. */
42 struct cmd_list_element
*cmdlist
;
44 /* Chain containing all defined info subcommands. */
46 struct cmd_list_element
*infolist
;
48 /* stdio stream that command input is being read from. */
52 /* Nonzero if we should refrain from using an X window. */
54 int inhibit_windows
= 0;
56 /* Function to call before reading a command, if nonzero.
57 The function receives two args: an input stream,
58 and a prompt string. */
60 void (*window_hook
) ();
62 void free_command_lines ();
64 static void initialize_main ();
66 static void source_command ();
67 void print_gdb_version ();
69 /* gdb prints this when reading a command interactively */
72 /* Buffer used for reading command lines, and the size
73 allocated for it so far. */
78 /* This is how `error' returns to command level. */
82 return_to_top_level ()
86 clear_breakpoint_commands ();
87 clear_momentary_breakpoints ();
89 longjmp (to_top_level
, 1);
92 main (argc
, argv
, envp
)
97 extern void request_quit ();
99 int inhibit_gdbinit
= 0;
106 line
= (char *) xmalloc (linesize
);
109 #ifdef SET_STACK_LIMIT_HUGE
113 /* Set the stack limit huge so that alloca (particularly stringtab
114 * in dbxread.c) does not fail. */
115 getrlimit (RLIMIT_STACK
, &rlim
);
116 rlim
.rlim_cur
= rlim
.rlim_max
;
117 setrlimit (RLIMIT_STACK
, &rlim
);
119 #endif /* SET_STACK_LIMIT_HUGE */
121 /* Look for flag arguments. */
123 for (i
= 1; i
< argc
; i
++)
125 if (!strcmp (argv
[i
], "-q") || !strcmp (argv
[i
], "-quiet"))
127 else if (!strcmp (argv
[i
], "-nx"))
129 else if (!strcmp (argv
[i
], "-nw"))
131 else if (!strcmp (argv
[i
], "-batch"))
132 batch
= 1, quiet
= 1;
133 else if (argv
[i
][0] == '-')
137 /* Run the init function of each source file */
139 initialize_all_files ();
140 initialize_main (); /* But that omits this file! Do it now */
142 signal (SIGINT
, request_quit
);
143 signal (SIGQUIT
, SIG_IGN
);
146 print_gdb_version ();
148 /* Process the command line arguments. */
151 for (i
= 1; i
< argc
; i
++)
153 register char *arg
= argv
[i
];
154 /* Args starting with - say what to do with the following arg
158 extern void exec_file_command (), symbol_file_command ();
159 extern void core_file_command (), directory_command ();
160 extern void tty_command ();
162 if (!strcmp (arg
, "-q") || !strcmp (arg
, "-nx")
163 || !strcmp (arg
, "quiet") || !strcmp (arg
, "-batch"))
164 /* Already processed above */
168 fprintf (stderr
, "No argument follows \"%s\".\n", arg
);
169 if (!setjmp (to_top_level
))
171 /* -s foo: get syms from foo. -e foo: execute foo.
172 -se foo: do both with foo. -c foo: use foo as core dump. */
173 if (!strcmp (arg
, "-se"))
175 exec_file_command (argv
[i
], !batch
);
176 symbol_file_command (argv
[i
], !batch
);
178 else if (!strcmp (arg
, "-s") || !strcmp (arg
, "-symbols"))
179 symbol_file_command (argv
[i
], !batch
);
180 else if (!strcmp (arg
, "-e") || !strcmp (arg
, "-exec"))
181 exec_file_command (argv
[i
], !batch
);
182 else if (!strcmp (arg
, "-c") || !strcmp (arg
, "-core"))
183 core_file_command (argv
[i
], !batch
);
184 /* -x foo: execute commands from foo. */
185 else if (!strcmp (arg
, "-x") || !strcmp (arg
, "-command")
186 || !strcmp (arg
, "-commands"))
187 source_command (argv
[i
]);
188 /* -d foo: add directory `foo' to source-file directory
190 else if (!strcmp (arg
, "-d") || !strcmp (arg
, "-dir")
191 || !strcmp (arg
, "-directory"))
192 directory_command (argv
[i
], 0);
193 /* -t /def/ttyp1: use /dev/ttyp1 for inferior I/O. */
194 else if (!strcmp (arg
, "-t") || !strcmp (arg
, "-tty"))
195 tty_command (argv
[i
], 0);
197 error ("Unknown command-line switch: \"%s\"\n", arg
);
202 /* Args not thus accounted for
203 are treated as, first, the symbol/executable file
204 and, second, the core dump file. */
206 if (!setjmp (to_top_level
))
210 exec_file_command (arg
, !batch
);
211 symbol_file_command (arg
, !batch
);
215 core_file_command (arg
, !batch
);
219 fprintf (stderr
, "Excess command line args ignored. (%s%s)\n",
220 arg
, (i
== argc
- 1) ? "" : " ...");
225 /* Read init file, if it exists in home directory */
229 s
= (char *) xmalloc (strlen (getenv ("HOME")) + 10);
230 strcpy (s
, getenv ("HOME"));
231 strcat (s
, "/.gdbinit");
232 if (!inhibit_gdbinit
&& access (s
, R_OK
) == 0)
233 if (!setjmp (to_top_level
))
237 /* Read init file, if it exists in current directory. */
238 if (!inhibit_gdbinit
&& access (".gdbinit", R_OK
) == 0)
239 if (!setjmp (to_top_level
))
240 source_command (".gdbinit");
243 fatal ("Attempt to read commands from stdin in batch mode.");
246 printf ("Type \"help\" for a list of commands.\n");
248 /* The command loop. */
252 if (!setjmp (to_top_level
))
254 clearerr (stdin
); /* Don't get hung if C-d is typed. */
258 /* Execute the line P as a command.
259 Pass FROM_TTY as second argument to the defining function. */
262 execute_command (p
, from_tty
)
266 register struct cmd_list_element
*c
;
267 register struct command_line
*cmdlines
;
270 while (*p
== ' ' || *p
== '\t') p
++;
273 c
= lookup_cmd (&p
, cmdlist
, "", 0);
274 if (c
->function
== 0)
275 error ("That is not a command, just a help topic.");
276 else if (c
->class == (int) class_user
)
279 error ("User-defined commands cannot take command-line arguments: \"%s\"",
281 cmdlines
= (struct command_line
*) c
->function
;
282 if (cmdlines
== (struct command_line
*) 0)
287 execute_command (cmdlines
->line
, 0);
288 cmdlines
= cmdlines
->next
;
292 /* Pass null arg rather than an empty one. */
293 (*c
->function
) (*p
? p
: 0, from_tty
);
302 /* Read commands from `instream' and execute them
303 until end of file. */
307 struct cleanup
*old_chain
;
308 while (!feof (instream
))
310 if (instream
== stdin
)
311 printf ("%s", prompt
);
314 if (window_hook
&& instream
== stdin
)
315 (*window_hook
) (instream
, prompt
);
318 old_chain
= make_cleanup (do_nothing
, 0);
319 execute_command (read_line (instream
== stdin
), instream
== stdin
);
320 /* Do any commands attached to breakpoint we stopped at. */
321 do_breakpoint_commands ();
322 do_cleanups (old_chain
);
329 signal (SIGTSTP
, SIG_DFL
);
331 kill (getpid (), SIGTSTP
);
332 signal (SIGTSTP
, stop_sig
);
333 printf ("%s", prompt
);
336 /* Forget about any previous command -- null line now will do nothing. */
340 /* Commands call this if they do not want to be repeated by null lines. */
348 /* Read one line from the command input stream `instream'
349 into the buffer `line' (whose current length is `linesize').
350 The buffer is made bigger as necessary.
351 Returns the address of the start of the line. */
357 register char *p
= line
;
362 /* Control-C quits instantly if typed while in this loop
363 since it should not wait until the user types a newline. */
365 signal (SIGTSTP
, stop_sig
);
369 c
= fgetc (instream
);
370 if (c
== -1 || c
== '\n')
372 if (p
- line
== linesize
- 1)
375 nline
= (char *) xrealloc (line
, linesize
);
382 signal (SIGTSTP
, SIG_DFL
);
385 /* If we just got an empty line, and that is supposed
386 to repeat the previous command, leave the last input unchanged. */
387 if (p
== line
&& repeat
)
390 /* If line is a comment, clear it out. */
392 while ((c
= *p1
) == ' ' || c
== '\t') p1
++;
401 /* Read lines from the input stream
402 and accumulate them in a chain of struct command_line's
403 which is then returned. */
405 struct command_line
*
406 read_command_lines ()
408 struct command_line
*first
= 0;
409 register struct command_line
*next
, *tail
= 0;
410 register char *p
, *p1
;
411 struct cleanup
*old_chain
= 0;
417 /* Remove leading and trailing blanks. */
418 while (*p
== ' ' || *p
== '\t') p
++;
420 while (p1
!= p
&& (p1
[-1] == ' ' || p1
[-1] == '\t')) p1
--;
423 if (p1
- p
== 3 && !strncmp (p
, "end", 3))
426 /* No => add this line to the chain of command lines. */
427 next
= (struct command_line
*) xmalloc (sizeof (struct command_line
));
428 next
->line
= savestring (p
, p1
- p
);
436 /* We just read the first line.
437 From now on, arrange to throw away the lines we have
438 if we quit or get an error while inside this function. */
440 old_chain
= make_cleanup (free_command_lines
, &first
);
447 /* Now we are about to return the chain to our caller,
448 so freeing it becomes his responsibility. */
450 discard_cleanups (old_chain
);
454 /* Free a chain of struct command_line's. */
457 free_command_lines (lptr
)
458 struct command_line
**lptr
;
460 register struct command_line
*l
= *lptr
;
461 register struct command_line
*next
;
472 /* Add an element to the list of info subcommands. */
475 add_info (name
, fun
, doc
)
480 add_cmd (name
, 0, fun
, doc
, &infolist
);
483 /* Add an alias to the list of info subcommands. */
486 add_info_alias (name
, oldname
, abbrev_flag
)
491 add_alias_cmd (name
, oldname
, 0, abbrev_flag
, &infolist
);
494 /* The "info" command is defined as a prefix, with allow_unknown = 0.
495 Therefore, its own definition is called only for "info" with no args. */
500 printf ("\"info\" must be followed by the name of an info command.\n");
501 help_cmd (0, infolist
, "info ", -1, stdout
);
504 /* Add an element to the list of commands. */
507 add_com (name
, class, fun
, doc
)
513 add_cmd (name
, class, fun
, doc
, &cmdlist
);
516 /* Add an alias or abbreviation command to the list of commands. */
519 add_com_alias (name
, oldname
, class, abbrev_flag
)
525 add_alias_cmd (name
, oldname
, class, abbrev_flag
, &cmdlist
);
532 error ("Argument required (%s).", why
);
536 help_command (command
, from_tty
)
538 int from_tty
; /* Ignored */
540 help_cmd (command
, cmdlist
, "", -2, stdout
);
544 validate_comname (comname
)
550 error_no_arg ("name of command to define");
555 if (!(*p
>= 'A' && *p
<= 'Z')
556 && !(*p
>= 'a' && *p
<= 'z')
557 && !(*p
>= '1' && *p
<= '9')
559 error ("Junk in argument list: \"%s\"", p
);
565 define_command (comname
, from_tty
)
569 register struct command_line
*cmds
;
570 register struct cmd_list_element
*c
;
573 validate_comname (comname
);
575 c
= lookup_cmd (&tem
, cmdlist
, "", -1);
578 if (c
->class == (int) class_user
|| c
->class == (int) class_alias
)
579 tem
= "Redefine command \"%s\"? ";
581 tem
= "Really redefine built-in command \"%s\"? ";
582 if (!query (tem
, comname
))
583 error ("Command \"%s\" not redefined.", comname
);
587 printf ("Type commands for definition of \"%s\".\n\
588 End with a line saying just \"end\".\n", comname
);
590 comname
= savestring (comname
, strlen (comname
));
592 cmds
= read_command_lines ();
594 if (c
&& c
->class == (int) class_user
)
595 free_command_lines (&c
->function
);
597 add_com (comname
, class_user
, cmds
,
598 (c
&& c
->class == (int) class_user
)
599 ? c
->doc
: savestring ("User-defined.", 13));
603 document_command (comname
, from_tty
)
607 struct command_line
*doclines
;
608 register struct cmd_list_element
*c
;
611 validate_comname (comname
);
613 c
= lookup_cmd (&tem
, cmdlist
, "", 0);
615 if (c
->class != (int) class_user
)
616 error ("Command \"%s\" is built-in.", comname
);
619 printf ("Type documentation for \"%s\".\n\
620 End with a line saying just \"end\".\n", comname
);
622 doclines
= read_command_lines ();
624 if (c
->doc
) free (c
->doc
);
627 register struct command_line
*cl1
;
628 register int len
= 0;
630 for (cl1
= doclines
; cl1
; cl1
= cl1
->next
)
631 len
+= strlen (cl1
->line
) + 1;
633 c
->doc
= (char *) xmalloc (len
+ 1);
636 for (cl1
= doclines
; cl1
; cl1
= cl1
->next
)
638 strcat (c
->doc
, cl1
->line
);
640 strcat (c
->doc
, "\n");
644 free_command_lines (&doclines
);
651 printf (" GDB GENERAL PUBLIC LICENSE\n\
653 Copyright (C) 1986 Richard M. Stallman\n\
654 Everyone is permitted to copy and distribute verbatim copies\n\
655 of this license, but changing it is not allowed.\n\
657 The license agreements of most software companies keep you at the\n\
658 mercy of those companies. By contrast, our general public license is\n\
659 intended to give everyone the right to share GDB. To make sure that\n\
660 you get the rights we want you to have, we need to make restrictions\n\
661 that forbid anyone to deny you these rights or to ask you to surrender\n\
662 the rights. Hence this license agreement.\n\
664 Specifically, we want to make sure that you have the right to give\n\
665 away copies of GDB, that you receive source code or else can get it\n\
666 if you want it, that you can change GDB or use pieces of it in new\n\
667 free programs, and that you know you can do these things.\n\
668 --Type Return to print more--");
673 To make sure that everyone has such rights, we have to forbid you to\n\
674 deprive anyone else of these rights. For example, if you distribute\n\
675 copies of GDB, you must give the recipients all the rights that you\n\
676 have. You must make sure that they, too, receive or can get the\n\
677 source code. And you must tell them their rights.\n\
679 Also, for our own protection, we must make certain that everyone\n\
680 finds out that there is no warranty for GDB. If GDB is modified by\n\
681 someone else and passed on, we want its recipients to know that what\n\
682 they have is not what we distributed, so that any problems introduced\n\
683 by others will not reflect on our reputation.\n\
685 Therefore we (Richard Stallman and the Free Software Foundation,\n\
686 Inc.) make the following terms which say what you must do to be\n\
687 allowed to distribute or change GDB.\n\
688 --Type Return to print more--");
695 1. You may copy and distribute verbatim copies of GDB source code as\n\
696 you receive it, in any medium, provided that you conspicuously and\n\
697 appropriately publish on each copy a valid copyright notice \"Copyright\n\
698 \(C) 1987 Free Software Foundation, Inc.\" (or with the year updated if\n\
699 that is appropriate); keep intact the notices on all files that refer\n\
700 to this License Agreement and to the absence of any warranty; and give\n\
701 any other recipients of the GDB program a copy of this License\n\
702 Agreement along with the program. You may charge a distribution fee\n\
703 for the physical act of transferring a copy.\n\
705 2. You may modify your copy or copies of GDB or any portion of it,\n\
706 and copy and distribute such modifications under the terms of\n\
707 Paragraph 1 above, provided that you also do the following:\n\
709 a) cause the modified files to carry prominent notices stating\n\
710 that you changed the files and the date of any change; and\n\
711 --Type Return to print more--");
716 b) cause the whole of any work that you distribute or publish,\n\
717 that in whole or in part contains or is a derivative of GDB\n\
718 or any part thereof, to be licensed to all third parties on terms\n\
719 identical to those contained in this License Agreement (except that\n\
720 you may choose to grant more extensive warranty protection to third\n\
721 parties, at your option).\n\
724 c) if the modified program serves as a debugger, cause it\n\
725 when started running in the simplest and usual way, to print\n\
726 an announcement including a valid copyright notice\n\
727 \"Copyright (C) 1987 Free Software Foundation, Inc.\" (or with\n\
728 the year updated if appropriate), saying that there\n\
729 is no warranty (or else, saying that you provide\n\
730 a warranty) and that users may redistribute the program under\n\
731 these conditions, and telling the user how to view a copy of\n\
732 this License Agreement.\n\
734 d) You may charge a distribution fee for the physical act of\n\
735 transferring a copy, and you may at your option offer warranty\n\
736 protection in exchange for a fee.\n\
737 --Type Return to print more--");
742 3. You may copy and distribute GDB or any portion of it in\n\
743 compiled, executable or object code form under the terms of Paragraphs\n\
744 1 and 2 above provided that you do the following:\n\
746 a) cause each such copy to be accompanied by the\n\
747 corresponding machine-readable source code, which must\n\
748 be distributed under the terms of Paragraphs 1 and 2 above; or,\n\
750 b) cause each such copy to be accompanied by a\n\
751 written offer, with no time limit, to give any third party\n\
752 free (except for a nominal shipping charge) a machine readable\n\
753 copy of the corresponding source code, to be distributed\n\
754 under the terms of Paragraphs 1 and 2 above; or,\n\n");
757 c) in the case of a recipient of GDB in compiled, executable\n\
758 or object code form (without the corresponding source code) you\n\
759 shall cause copies you distribute to be accompanied by a copy\n\
760 of the written offer of source code which you received along\n\
761 with the copy you received.\n\
762 --Type Return to print more--");
767 4. You may not copy, sublicense, distribute or transfer GDB\n\
768 except as expressly provided under this License Agreement. Any attempt\n\
769 otherwise to copy, sublicense, distribute or transfer GDB is void and\n\
770 your rights to use the program under this License agreement shall be\n\
771 automatically terminated. However, parties who have received computer\n\
772 software programs from you with this License Agreement will not have\n\
773 their licenses terminated so long as such parties remain in full compliance.\n\
775 5. If you wish to incorporate parts of GDB into other free\n\
776 programs whose distribution conditions are different, write to the Free\n\
777 Software Foundation at 675 Mass Ave, Cambridge, MA 02139. We have not yet\n\
778 worked out a simple rule that can be stated here, but we will often permit\n\
779 this. We will be guided by the two goals of preserving the free status of\n\
780 all derivatives of our free software and of promoting the sharing and reuse\n\
783 In other words, go ahead and share GDB, but don't try to stop\n\
784 anyone else from sharing it farther. Help stamp out software hoarding!\n\
793 printf (" NO WARRANTY\n\
795 BECAUSE GDB IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY NO\n\
796 WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW. EXCEPT\n\
797 WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC,\n\
798 RICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE GDB \"AS IS\" WITHOUT\n\
799 WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT\n\
800 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n\
801 A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND\n\
802 PERFORMANCE OF GDB IS WITH YOU. SHOULD GDB PROVE DEFECTIVE, YOU\n\
803 ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n");
806 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M.\n\
807 STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., AND/OR ANY OTHER PARTY\n\
808 WHO MAY MODIFY AND REDISTRIBUTE GDB, BE LIABLE TO\n\
809 YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR OTHER\n\
810 SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR\n\
811 INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA\n\
812 BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A\n\
813 FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) GDB, EVEN\n\
814 IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR\n\
815 ANY CLAIM BY ANY OTHER PARTY.\n");
822 printf ("GDB %s, Copyright (C) 1987 Free Software Foundation, Inc.\n\
823 There is ABSOLUTELY NO WARRANTY for GDB; type \"info warranty\" for details.\n\
824 GDB is free software and you are welcome to distribute copies of it\n\
825 under certain conditions; type \"info copying\" to see the conditions.\n",
833 print_gdb_version ();
838 set_prompt_command (text
)
846 error_no_arg ("string to which to set prompt");
848 new = (char *) xmalloc (strlen (text
) + 2);
854 /* \ at end of argument is used after spaces
855 so they won't be lost. */
858 c
= parse_escape (&p
);
867 if (*(p
- 1) != '\\')
870 new = (char *) xrealloc (new, q
- new);
878 if (have_inferior_p ())
880 if (query ("The program is running. Quit anyway? "))
882 /* Prevent any warning message from reopen_exec_file, in case
883 we have a core file that's inconsistent with the exec file. */
884 exec_file_command (0, 0);
888 error ("Not confirmed.");
894 input_from_terminal_p ()
896 return instream
== stdin
;
900 pwd_command (arg
, from_tty
)
904 char buf
[MAXPATHLEN
];
905 if (arg
) error ("The \"pwd\" command does not take an argument: %s", arg
);
906 printf ("Working directory %s.\n", getwd (buf
));
910 cd_command (dir
, from_tty
)
915 error_no_arg ("new working directory");
918 perror_with_name (dir
);
920 pwd_command ((char *) 0, 1);
924 /* Clean up on error during a "source" command.
925 Close the file opened by the command
926 and restore the previous input stream. */
929 source_cleanup (stream
)
937 source_command (file
)
941 struct cleanup
*cleanups
;
944 error_no_arg ("file to read commands from");
946 stream
= fopen (file
, "r");
948 perror_with_name (file
);
950 cleanups
= make_cleanup (source_cleanup
, instream
);
956 do_cleanups (cleanups
);
971 /* \ at end of argument is used after spaces
972 so they won't be lost. */
976 c
= parse_escape (&p
);
988 if (query ("Should GDB dump core? "))
990 signal (SIGQUIT
, SIG_DFL
);
991 kill (getpid (), SIGQUIT
);
999 prompt
= savestring ("(gdb) ", 6);
1001 /* Define the classes of commands.
1002 They will appear in the help list in the reverse of this order. */
1004 add_cmd ("obscure", class_obscure
, 0, "Obscure features.", &cmdlist
);
1005 add_cmd ("alias", class_alias
, 0, "Aliases of other commands.", &cmdlist
);
1006 add_cmd ("user", class_user
, 0, "User-defined commands.\n\
1007 The commands in this class are those defined by the user.\n\
1008 Use the \"define\" command to define a command.", &cmdlist
);
1009 add_cmd ("support", class_support
, 0, "Support facilities.", &cmdlist
);
1010 add_cmd ("status", class_info
, 0, "Status inquiries.", &cmdlist
);
1011 add_cmd ("files", class_files
, 0, "Specifying and examining files.", &cmdlist
);
1012 add_cmd ("breakpoints", class_breakpoint
, 0, "Making program stop at certain points.", &cmdlist
);
1013 add_cmd ("data", class_vars
, 0, "Examining data.", &cmdlist
);
1014 add_cmd ("stack", class_stack
, 0, "Examining the stack.\n\
1015 The stack is made up of stack frames. Gdb assigns numbers to stack frames\n\
1016 counting from zero for the innermost (currently executing) frame.\n\n\
1017 At any time gdb identifies one frame as the \"selected\" frame.\n\
1018 Variable lookups are done with respect to the selected frame.\n\
1019 When the program being debugged stops, gdb selects the innermost frame.\n\
1020 The commands below can be used to select other frames by number or address.",
1022 add_cmd ("running", class_run
, 0, "Running the program.", &cmdlist
);
1024 add_com ("pwd", class_files
, pwd_command
,
1025 "Print working directory. This is used for your program as well.");
1026 add_com ("cd", class_files
, cd_command
,
1027 "Set working directory to DIR for debugger and program being debugged.\n\
1028 The change does not take effect for the program being debugged\n\
1029 until the next time it is started.");
1031 add_com ("set-prompt", class_support
, set_prompt_command
,
1032 "Change gdb's prompt from the default of \"(gdb)\"");
1033 add_com ("echo", class_support
, echo_command
,
1034 "Print a constant string. Give string as argument.\n\
1035 C escape sequences may be used in the argument.\n\
1036 No newline is added at the end of the argument;\n\
1037 use \"\\n\" if you want a newline to be printed.\n\
1038 Since leading and trailing whitespace are ignored in command arguments,\n\
1039 if you want to print some you must use \"\\\" before leading whitespace\n\
1040 to be printed or after trailing whitespace.");
1041 add_com ("document", class_support
, document_command
,
1042 "Document a user-defined command.\n\
1043 Give command name as argument. Give documentation on following lines.\n\
1044 End with a line of just \"end\".");
1045 add_com ("define", class_support
, define_command
,
1046 "Define a new command name. Command name is argument.\n\
1047 Definition appears on following lines, one command per line.\n\
1048 End with a line of just \"end\".\n\
1049 Use the \"document\" command to give documentation for the new command.\n\
1050 Commands defined in this way do not take arguments.");
1052 add_com ("source", class_support
, source_command
,
1053 "Read commands from a file named FILE.\n\
1054 Note that the file \".gdbinit\" is read automatically in this way\n\
1055 when gdb is started.");
1056 add_com ("quit", class_support
, quit_command
, "Exit gdb.");
1057 add_com ("help", class_support
, help_command
, "Print list of commands.");
1058 add_com_alias ("q", "quit", class_support
, 1);
1059 add_com_alias ("h", "help", class_support
, 1);
1061 add_com ("dump-me", class_obscure
, dump_me_command
,
1062 "Get fatal error; make debugger dump its core.");
1064 add_prefix_cmd ("info", class_info
, info_command
,
1065 "Generic command for printing status.",
1066 &infolist
, "info ", 0, &cmdlist
);
1067 add_com_alias ("i", "info", class_info
, 1);
1069 add_info ("copying", copying_info
, "Conditions for redistributing copies of GDB.");
1070 add_info ("warranty", warranty_info
, "Various kinds of warranty you do not have.");
1071 add_info ("version", version_info
, "Report what version of GDB this is.");
This page took 0.051281 seconds and 4 git commands to generate.