Commit | Line | Data |
---|---|---|
0239d9b3 FF |
1 | /* Support for GDB maintenance commands. |
2 | Copyright (C) 1992 Free Software Foundation, Inc. | |
3 | Written by Fred Fish at Cygnus Support. | |
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., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
20 | ||
21 | ||
22 | #include "defs.h" | |
23 | ||
24 | #if MAINTENANCE_CMDS /* Entire file goes away if not including maint cmds */ | |
25 | ||
26 | #include <signal.h> | |
27 | #include "command.h" | |
28 | #include "gdbcmd.h" | |
29 | #include "symtab.h" | |
30 | #include "gdbtypes.h" | |
31 | ||
32 | static void | |
33 | maintenance_command PARAMS ((char *, int)); | |
34 | ||
35 | static void | |
36 | maintenance_dump_me PARAMS ((char *, int)); | |
37 | ||
38 | /* | |
39 | ||
40 | LOCAL FUNCTION | |
41 | ||
42 | maintenance_command -- access the maintenance subcommands | |
43 | ||
44 | SYNOPSIS | |
45 | ||
46 | void maintenance_command (char *args, int from_tty) | |
47 | ||
48 | DESCRIPTION | |
49 | ||
50 | */ | |
51 | ||
52 | static void | |
53 | maintenance_command (args, from_tty) | |
54 | char *args; | |
55 | int from_tty; | |
56 | { | |
57 | error ("Unimplemented maintenance command '%s'", args); | |
58 | } | |
59 | ||
60 | ||
61 | /* ARGSUSED */ | |
62 | static void | |
63 | maintenance_dump_me (args, from_tty) | |
64 | char *args; | |
65 | int from_tty; | |
66 | { | |
67 | if (query ("Should GDB dump core? ")) | |
68 | { | |
69 | signal (SIGQUIT, SIG_DFL); | |
70 | kill (getpid (), SIGQUIT); | |
71 | } | |
72 | } | |
73 | ||
74 | /* The "maintenance info" command is defined as a prefix, with allow_unknown 0. | |
75 | Therefore, its own definition is called only for "maintenance info" with | |
76 | no args. */ | |
77 | ||
78 | /* ARGSUSED */ | |
79 | static void | |
80 | maintenance_info_command (arg, from_tty) | |
81 | char *arg; | |
82 | int from_tty; | |
83 | { | |
84 | printf ("\"maintenance info\" must be followed by the name of an info command.\n"); | |
85 | help_list (maintenanceinfolist, "maintenance info ", -1, stdout); | |
86 | } | |
87 | ||
88 | /* | |
89 | ||
90 | GLOBAL FUNCTION | |
91 | ||
92 | _initialize_maint_cmds -- initialize the process file system stuff | |
93 | ||
94 | SYNOPSIS | |
95 | ||
96 | void _initialize_maint_cmds (void) | |
97 | ||
98 | DESCRIPTION | |
99 | ||
100 | Do required initializations during gdb startup for using the | |
101 | /proc file system interface. | |
102 | ||
103 | */ | |
104 | ||
105 | ||
106 | void | |
107 | _initialize_maint_cmds () | |
108 | { | |
109 | add_prefix_cmd ("maintenance", class_maintenance, maintenance_command, | |
110 | "Commands for use by GDB maintainers.\n\ | |
111 | Includes commands to dump specific internal GDB structures in\n\ | |
112 | a human readable form, including dumping of symbol tables, type\n\ | |
113 | chains, etc.", | |
114 | &maintenancelist, "maintenance ", 1, | |
115 | &cmdlist); | |
116 | ||
117 | add_prefix_cmd ("info", class_info, maintenance_info_command, | |
118 | "Maintenance command for showing things about the program being debugged.", | |
119 | &maintenanceinfolist, "maintenance info ", 1, | |
120 | &maintenancelist); | |
121 | ||
122 | add_cmd ("dump-me", class_maintenance, maintenance_dump_me, | |
123 | "Get fatal error; make debugger dump its core.\n\ | |
124 | GDB sets it's handling of SIGQUIT back to SIG_DFL and then sends\n\ | |
125 | itself a SIGQUIT signal.", | |
126 | &maintenancelist); | |
127 | ||
128 | add_cmd ("print-type", class_maintenance, maintenance_print_type, | |
129 | "Print a type chain for a given symbol.\n\ | |
130 | For each node in a type chain, print the raw data for each member of\n\ | |
131 | the type structure, and the interpretation of the data.", | |
132 | &maintenancelist); | |
133 | ||
134 | add_cmd ("print-symbols", class_maintenance, maintenance_print_symbols, | |
135 | "Print dump of current symbol definitions.\n\ | |
136 | Entries in the full symbol table are dumped to file OUTFILE.\n\ | |
137 | If a SOURCE file is specified, dump only that file's symbols.", | |
138 | &maintenancelist); | |
139 | ||
140 | add_cmd ("print-msymbols", class_maintenance, maintenance_print_msymbols, | |
141 | "Print dump of current minimal symbol definitions.\n\ | |
142 | Entries in the minimal symbol table are dumped to file OUTFILE.\n\ | |
143 | If a SOURCE file is specified, dump only that file's minimal symbols.", | |
144 | &maintenancelist); | |
145 | ||
146 | add_cmd ("print-psymbols", class_maintenance, maintenance_print_psymbols, | |
147 | "Print dump of current partial symbol definitions.\n\ | |
148 | Entries in the partial symbol table are dumped to file OUTFILE.\n\ | |
149 | If a SOURCE file is specified, dump only that file's partial symbols.", | |
150 | &maintenancelist); | |
151 | ||
152 | add_cmd ("print-objfiles", class_maintenance, maintenance_print_objfiles, | |
153 | "Print dump of current object file definitions.", | |
154 | &maintenancelist); | |
155 | ||
156 | } | |
157 | ||
158 | #endif /* MAINTENANCE_CMDS */ |