* Rename remote-es1800.c to remote-es.c
[deliverable/binutils-gdb.git] / gdb / maint.c
... / ...
CommitLineData
1/* Support for GDB maintenance commands.
2 Copyright (C) 1992 Free Software Foundation, Inc.
3 Written by Fred Fish at Cygnus Support.
4
5This file is part of GDB.
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program; if not, write to the Free Software
19Foundation, 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#include "demangle.h"
32
33static void
34maintenance_command PARAMS ((char *, int));
35
36static void
37maintenance_dump_me PARAMS ((char *, int));
38
39static void
40maintenance_demangle PARAMS ((char *, int));
41
42/*
43
44LOCAL FUNCTION
45
46 maintenance_command -- access the maintenance subcommands
47
48SYNOPSIS
49
50 void maintenance_command (char *args, int from_tty)
51
52DESCRIPTION
53
54*/
55
56static void
57maintenance_command (args, from_tty)
58 char *args;
59 int from_tty;
60{
61 printf ("\"maintenance\" must be followed by the name of a maintenance command.\n");
62 help_list (maintenancelist, "maintenance ", -1, stdout);
63}
64
65
66/* ARGSUSED */
67static void
68maintenance_dump_me (args, from_tty)
69 char *args;
70 int from_tty;
71{
72 if (query ("Should GDB dump core? "))
73 {
74 signal (SIGQUIT, SIG_DFL);
75 kill (getpid (), SIGQUIT);
76 }
77}
78
79/* Someday we should allow demangling for things other than just
80 explicit strings. For example, we might want to be able to
81 specify the address of a string in either GDB's process space
82 or the debuggee's process space, and have gdb fetch and demangle
83 that string. If we have a char* pointer "ptr" that points to
84 a string, we might want to be able to given just the name and
85 have GDB demangle and print what it points to, etc. (FIXME) */
86
87static void
88maintenance_demangle (args, from_tty)
89 char *args;
90 int from_tty;
91{
92 char *demangled;
93
94 if (args == NULL || *args == '\0')
95 {
96 printf ("\"maintenance demangle\" takes an argument to demangle.\n");
97 }
98 else
99 {
100 demangled = cplus_demangle (args, DMGL_ANSI | DMGL_PARAMS);
101 if (demangled != NULL)
102 {
103 printf ("%s\n", demangled);
104 free (demangled);
105 }
106 else
107 {
108 printf ("Can't demangle \"%s\"\n", args);
109 }
110 }
111}
112
113/* The "maintenance info" command is defined as a prefix, with allow_unknown 0.
114 Therefore, its own definition is called only for "maintenance info" with
115 no args. */
116
117/* ARGSUSED */
118static void
119maintenance_info_command (arg, from_tty)
120 char *arg;
121 int from_tty;
122{
123 printf ("\"maintenance info\" must be followed by the name of an info command.\n");
124 help_list (maintenanceinfolist, "maintenance info ", -1, stdout);
125}
126
127/* The "maintenance print" command is defined as a prefix, with allow_unknown
128 0. Therefore, its own definition is called only for "maintenance print"
129 with no args. */
130
131/* ARGSUSED */
132static void
133maintenance_print_command (arg, from_tty)
134 char *arg;
135 int from_tty;
136{
137 printf ("\"maintenance print\" must be followed by the name of a print command.\n");
138 help_list (maintenanceprintlist, "maintenance print ", -1, stdout);
139}
140
141/*
142
143GLOBAL FUNCTION
144
145 _initialize_maint_cmds -- initialize the process file system stuff
146
147SYNOPSIS
148
149 void _initialize_maint_cmds (void)
150
151DESCRIPTION
152
153 Do required initializations during gdb startup for using the
154 /proc file system interface.
155
156*/
157
158
159void
160_initialize_maint_cmds ()
161{
162 add_prefix_cmd ("maintenance", class_maintenance, maintenance_command,
163 "Commands for use by GDB maintainers.\n\
164Includes commands to dump specific internal GDB structures in\n\
165a human readable form, to cause GDB to deliberately dump core,\n\
166to test internal functions such as the C++ demangler, etc.",
167 &maintenancelist, "maintenance ", 0,
168 &cmdlist);
169
170 add_com_alias ("mt", "maintenance", class_maintenance, 1);
171
172 add_prefix_cmd ("info", class_maintenance, maintenance_info_command,
173 "Commands for showing internal info about the program being debugged.",
174 &maintenanceinfolist, "maintenance info ", 0,
175 &maintenancelist);
176
177 add_prefix_cmd ("print", class_maintenance, maintenance_print_command,
178 "Maintenance command for printing GDB internal state.",
179 &maintenanceprintlist, "maintenance print ", 0,
180 &maintenancelist);
181
182 add_cmd ("dump-me", class_maintenance, maintenance_dump_me,
183 "Get fatal error; make debugger dump its core.\n\
184GDB sets it's handling of SIGQUIT back to SIG_DFL and then sends\n\
185itself a SIGQUIT signal.",
186 &maintenancelist);
187
188 add_cmd ("demangle", class_maintenance, maintenance_demangle,
189 "Demangle a C++ mangled name.\n\
190Call internal GDB demangler routine to demangle a C++ link name\n\
191and prints the result.",
192 &maintenancelist);
193
194 add_cmd ("type", class_maintenance, maintenance_print_type,
195 "Print a type chain for a given symbol.\n\
196For each node in a type chain, print the raw data for each member of\n\
197the type structure, and the interpretation of the data.",
198 &maintenanceprintlist);
199
200 add_cmd ("symbols", class_maintenance, maintenance_print_symbols,
201 "Print dump of current symbol definitions.\n\
202Entries in the full symbol table are dumped to file OUTFILE.\n\
203If a SOURCE file is specified, dump only that file's symbols.",
204 &maintenanceprintlist);
205
206 add_cmd ("msymbols", class_maintenance, maintenance_print_msymbols,
207 "Print dump of current minimal symbol definitions.\n\
208Entries in the minimal symbol table are dumped to file OUTFILE.\n\
209If a SOURCE file is specified, dump only that file's minimal symbols.",
210 &maintenanceprintlist);
211
212 add_cmd ("psymbols", class_maintenance, maintenance_print_psymbols,
213 "Print dump of current partial symbol definitions.\n\
214Entries in the partial symbol table are dumped to file OUTFILE.\n\
215If a SOURCE file is specified, dump only that file's partial symbols.",
216 &maintenanceprintlist);
217
218 add_cmd ("objfiles", class_maintenance, maintenance_print_objfiles,
219 "Print dump of current object file definitions.",
220 &maintenanceprintlist);
221
222}
223
224#endif /* MAINTENANCE_CMDS */
This page took 0.023285 seconds and 4 git commands to generate.