* maint.c: New file.
[deliverable/binutils-gdb.git] / gdb / maint.c
CommitLineData
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
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
32static void
33maintenance_command PARAMS ((char *, int));
34
35static void
36maintenance_dump_me PARAMS ((char *, int));
37
38/*
39
40LOCAL FUNCTION
41
42 maintenance_command -- access the maintenance subcommands
43
44SYNOPSIS
45
46 void maintenance_command (char *args, int from_tty)
47
48DESCRIPTION
49
50*/
51
52static void
53maintenance_command (args, from_tty)
54 char *args;
55 int from_tty;
56{
57 error ("Unimplemented maintenance command '%s'", args);
58}
59
60
61/* ARGSUSED */
62static void
63maintenance_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 */
79static void
80maintenance_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
90GLOBAL FUNCTION
91
92 _initialize_maint_cmds -- initialize the process file system stuff
93
94SYNOPSIS
95
96 void _initialize_maint_cmds (void)
97
98DESCRIPTION
99
100 Do required initializations during gdb startup for using the
101 /proc file system interface.
102
103*/
104
105
106void
107_initialize_maint_cmds ()
108{
109 add_prefix_cmd ("maintenance", class_maintenance, maintenance_command,
110 "Commands for use by GDB maintainers.\n\
111Includes commands to dump specific internal GDB structures in\n\
112a human readable form, including dumping of symbol tables, type\n\
113chains, 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\
124GDB sets it's handling of SIGQUIT back to SIG_DFL and then sends\n\
125itself 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\
130For each node in a type chain, print the raw data for each member of\n\
131the 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\
136Entries in the full symbol table are dumped to file OUTFILE.\n\
137If 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\
142Entries in the minimal symbol table are dumped to file OUTFILE.\n\
143If 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\
148Entries in the partial symbol table are dumped to file OUTFILE.\n\
149If 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 */
This page took 0.027839 seconds and 4 git commands to generate.