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 | { | |
2e9309df FF |
57 | printf ("\"maintenance\" must be followed by the name of a maintenance command.\n"); |
58 | help_list (maintenancelist, "maintenance ", -1, stdout); | |
0239d9b3 FF |
59 | } |
60 | ||
61 | ||
62 | /* ARGSUSED */ | |
63 | static void | |
64 | maintenance_dump_me (args, from_tty) | |
65 | char *args; | |
66 | int from_tty; | |
67 | { | |
68 | if (query ("Should GDB dump core? ")) | |
69 | { | |
70 | signal (SIGQUIT, SIG_DFL); | |
71 | kill (getpid (), SIGQUIT); | |
72 | } | |
73 | } | |
74 | ||
75 | /* The "maintenance info" command is defined as a prefix, with allow_unknown 0. | |
76 | Therefore, its own definition is called only for "maintenance info" with | |
77 | no args. */ | |
78 | ||
79 | /* ARGSUSED */ | |
80 | static void | |
81 | maintenance_info_command (arg, from_tty) | |
82 | char *arg; | |
83 | int from_tty; | |
84 | { | |
85 | printf ("\"maintenance info\" must be followed by the name of an info command.\n"); | |
86 | help_list (maintenanceinfolist, "maintenance info ", -1, stdout); | |
87 | } | |
88 | ||
89 | /* | |
90 | ||
91 | GLOBAL FUNCTION | |
92 | ||
93 | _initialize_maint_cmds -- initialize the process file system stuff | |
94 | ||
95 | SYNOPSIS | |
96 | ||
97 | void _initialize_maint_cmds (void) | |
98 | ||
99 | DESCRIPTION | |
100 | ||
101 | Do required initializations during gdb startup for using the | |
102 | /proc file system interface. | |
103 | ||
104 | */ | |
105 | ||
106 | ||
107 | void | |
108 | _initialize_maint_cmds () | |
109 | { | |
110 | add_prefix_cmd ("maintenance", class_maintenance, maintenance_command, | |
111 | "Commands for use by GDB maintainers.\n\ | |
112 | Includes commands to dump specific internal GDB structures in\n\ | |
113 | a human readable form, including dumping of symbol tables, type\n\ | |
114 | chains, etc.", | |
2e9309df | 115 | &maintenancelist, "maintenance ", 0, |
0239d9b3 FF |
116 | &cmdlist); |
117 | ||
118 | add_prefix_cmd ("info", class_info, maintenance_info_command, | |
119 | "Maintenance command for showing things about the program being debugged.", | |
2e9309df | 120 | &maintenanceinfolist, "maintenance info ", 0, |
0239d9b3 FF |
121 | &maintenancelist); |
122 | ||
123 | add_cmd ("dump-me", class_maintenance, maintenance_dump_me, | |
124 | "Get fatal error; make debugger dump its core.\n\ | |
125 | GDB sets it's handling of SIGQUIT back to SIG_DFL and then sends\n\ | |
126 | itself a SIGQUIT signal.", | |
127 | &maintenancelist); | |
128 | ||
129 | add_cmd ("print-type", class_maintenance, maintenance_print_type, | |
130 | "Print a type chain for a given symbol.\n\ | |
131 | For each node in a type chain, print the raw data for each member of\n\ | |
132 | the type structure, and the interpretation of the data.", | |
133 | &maintenancelist); | |
134 | ||
135 | add_cmd ("print-symbols", class_maintenance, maintenance_print_symbols, | |
136 | "Print dump of current symbol definitions.\n\ | |
137 | Entries in the full symbol table are dumped to file OUTFILE.\n\ | |
138 | If a SOURCE file is specified, dump only that file's symbols.", | |
139 | &maintenancelist); | |
140 | ||
141 | add_cmd ("print-msymbols", class_maintenance, maintenance_print_msymbols, | |
142 | "Print dump of current minimal symbol definitions.\n\ | |
143 | Entries in the minimal symbol table are dumped to file OUTFILE.\n\ | |
144 | If a SOURCE file is specified, dump only that file's minimal symbols.", | |
145 | &maintenancelist); | |
146 | ||
147 | add_cmd ("print-psymbols", class_maintenance, maintenance_print_psymbols, | |
148 | "Print dump of current partial symbol definitions.\n\ | |
149 | Entries in the partial symbol table are dumped to file OUTFILE.\n\ | |
150 | If a SOURCE file is specified, dump only that file's partial symbols.", | |
151 | &maintenancelist); | |
152 | ||
153 | add_cmd ("print-objfiles", class_maintenance, maintenance_print_objfiles, | |
154 | "Print dump of current object file definitions.", | |
155 | &maintenancelist); | |
156 | ||
157 | } | |
158 | ||
159 | #endif /* MAINTENANCE_CMDS */ |