1 /* Copyright (C) 2021 Free Software Foundation, Inc.
4 This file is part of GNU Binutils.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, 51 Franklin Street - Fifth Floor, Boston,
19 MA 02110-1301, USA. */
26 #include <sys/types.h>
29 #include "Hist_data.h"
30 #include "dbe_types.h"
34 // This enum lists all the commands parsed by er_print
35 // The ordering here is not important, but LAST_CMD must
36 // be defined as the last command for which a help line will exist
37 // Command.cc has a matching list, and the ordering in
38 // that list determines what shows up under the help and xhelp commands.
39 // In particular, the entry for HELP is the last one printed
40 // for the help command, and the entry for HHELP is the last
41 // one printed for xhelp.
45 // Pathtree-related commands
69 // Source/disassembly control commands
76 // Heap trace-related commands
82 // I/O trace-related commands
88 // Race detection related commands
92 // Deadlock detection commands
102 // MemorySpace commands
109 // Custom tab commands
115 // Old-style filtering commands
127 // Shared Object display commands
133 // the new filtering commands
136 // Miscellaneous commands
160 // Experiments handling commands
174 TIMELINE_CLASSIC_TBR,
181 HELP, // this is the last of the commands listed with "help"
205 HHELP, // this is the last command listed with "xhelp"
206 NO_CMD, // Dummy command, used for headers in help
207 DUMMY_CMD, // Dummy command, used for help
214 // Internal-only Commands
215 LAST_CMD, // No more commands for which a help line is possible
220 // Error return "commands"
227 const CmdType token; // command key
228 const char *str; // command string
229 const char *alt; // alternate command string
230 const char *arg; // argument string for help
231 const int arg_count; // no. of arguments
232 char **desc; // description for help
235 // Command class: never instantiated, completely static
240 // look up a string in the command table, return type, set number of args
241 static CmdType get_command (char *cmd, int &arg_count, int ¶m);
242 static const char *get_cmd_str (CmdType type);
243 static void print_help (char *prog_name, bool cmd_line, bool usermode, FILE *outf);
244 static char *get_err_string (Cmd_status err);
246 static const char *DEFAULT_METRICS; // default if no .rc files read
247 static const char *DEFAULT_SORT; // default if no .rc files read
248 static const char *DEFAULT_CMD; // token for default
249 static const char *ALL_CMD; // token for all
250 static const char *ANY_CMD; // token for any
251 static const char *NONE_CMD; // token for none
252 static const char *HWC_CMD; // token for all HWC
253 static const char *BIT_CMD; // token for any bit-derived metric
256 static const int user_no; // the last user command
257 static const int hidden_no; // the last hidden command
258 static const int command_no; // the last parsable command
260 static void init_desc ();
261 static char *fmt_help (int nc, char head);
264 // Analyzer display tabs
267 DispTab (int ntype, int num, bool vis, CmdType token)
276 void setAvailability (bool val) { available = val; }
278 int type; // Display type
279 int order; // Order in which tabs should appear in GUI
280 bool visible; // Is Tab visible
281 bool available; // Is tab available for this experiment
282 CmdType cmdtoken; // command token
283 int param; // command parameter (used for memory space)
286 #endif /* ! _COMMAND_H */