xref: /netbsd-src/external/gpl3/binutils/dist/gprofng/src/Command.cc (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
1 /* Copyright (C) 2021-2024 Free Software Foundation, Inc.
2    Contributed by Oracle.
3 
4    This file is part of GNU Binutils.
5 
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)
9    any later version.
10 
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.
15 
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.  */
20 
21 #include "config.h"
22 #include <string.h>
23 #include <stdlib.h>
24 #include <sys/param.h>
25 
26 #include "gp-defs.h"
27 #include "Command.h"
28 #include "DbeSession.h"
29 #include "MemorySpace.h"
30 #include "i18n.h"
31 #include "StringBuilder.h"
32 
33 const char *Command::DEFAULT_CMD = "default";   // token for default
34 const char *Command::ALL_CMD     = "all";       // token for all
35 const char *Command::ANY_CMD     = "any";       // token for any
36 const char *Command::NONE_CMD    = "none";      // token for none
37 const char *Command::HWC_CMD     = "hwc";       // token for all HWC
38 const char *Command::BIT_CMD     = "bit";  // token for any bit-generated metric
39 const char *Command::DEFAULT_METRICS = "ei.user:name";  // if no .rc files read
40 const char *Command::DEFAULT_SORT    = "e.user:name";   // if no .rc files read
41 
42 static char *fhdr, *cchdr, *lahdr, *iohdr, *sdhdr, *lsthdr, *lohdr;
43 static char *methdr, *othdr, *mischdr, *deflthdr, *andeflthdr;
44 static char *selhdr, *filthdr, *outhdr, *exphdr, *obj_allhdr;
45 static char *unsuphdr, *indxobjhdr;
46 static char *helphdr, *rahdr, *ddhdr, *typehdr, *typehdr2;
47 
48 //  This is the list of commands, which governs the parser scan, as
49 //	well as the help command.
50 //  A line with the tag NO_CMD is skipped in parsing, but is used
51 //	to provide subheadings for the help
52 //  The HELP line must be the last one in the list of commands
53 //	to be shown by "-help"; The HHELP line must be the
54 //	last one to be shown by "-xhelp"
55 //  The LAST_CMD line must be the last one recognized by the parser
56 //
57 //  The ordering of this list should match the ordering in the man
58 //	page, and the subheader lines should match the subheadings in
59 //	the man page.
60 
61 static char *desc[LAST_CMD];
62 
63 static Cmdtable cmd_lst[] = {   // list of commands
64   // User Commands
65   { NO_CMD, "", NULL, NULL, 0, &fhdr},
66   { FUNCS, "functions", NULL, NULL, 0, &desc[FUNCS]},
67   { METRICS, "metrics", NULL, "metric_spec", 1, &desc[METRICS]},
68   { SORT, "sort", NULL, "metric_spec", 1, &desc[SORT]},
69   { FDETAIL, "fsummary", NULL, NULL, 0, &desc[FDETAIL]},
70   { FSINGLE, "fsingle", NULL, "function_name #", 2, &desc[FSINGLE]},
71 
72   { NO_CMD, "", NULL, NULL, 0, &cchdr},
73   { GPROF, "callers-callees", "gprof", NULL, 0, &desc[GPROF]},
74   { CSINGLE, "csingle", NULL, "function_name #", 2, &desc[CSINGLE]},
75   { CPREPEND, "cprepend", NULL, "function_name #", 2, &desc[CPREPEND]},
76   { CAPPEND, "cappend", NULL, "function_name #", 2, &desc[CAPPEND]},
77   { CRMFIRST, "crmfirst", NULL, NULL, 0, &desc[CRMFIRST]},
78   { CRMLAST, "crmlast", NULL, NULL, 0, &desc[CRMLAST]},
79   { CALLTREE, "calltree", "ctree", NULL, 0, &desc[CALLTREE]},
80 
81   { NO_CMD, "", NULL, NULL, 0, &lahdr},
82   { LEAKS, "leaks", NULL, NULL, 0, &desc[LEAKS]},
83   { ALLOCS, "allocs", NULL, NULL, 0, &desc[ALLOCS]},
84   { HEAP, "heap", NULL, NULL, 0, &desc[HEAP]},
85   { HEAPSTAT, "heapstat", NULL, NULL, 0, &desc[HEAPSTAT]},
86 
87   { NO_CMD, "", NULL, NULL, 0, &iohdr},
88   { IOACTIVITY, "ioactivity", NULL, NULL, 0, &desc[IOACTIVITY]},
89   { IOVFD, "iodetail", NULL, NULL, 0, &desc[IOVFD]},
90   { IOCALLSTACK, "iocallstack", NULL, NULL, 0, &desc[IOCALLSTACK]},
91   { IOSTAT, "iostat", NULL, NULL, 0, &desc[IOSTAT]},
92 
93   // PC, line, source and dissassembly commands
94   { NO_CMD, "", NULL, NULL, 0, &sdhdr},
95   { HOTPCS, "pcs", NULL, NULL, 0, &desc[HOTPCS]},
96   { PDETAIL, "psummary", NULL, NULL, 0, &desc[PDETAIL]},
97   { HOTLINES, "lines", NULL, NULL, 0, &desc[HOTLINES]},
98   { LDETAIL, "lsummary", NULL, NULL, 0, &desc[LDETAIL]},
99   { SOURCE, "source", NULL, "func/file #", 2, &desc[SOURCE]},
100   { DISASM, "disasm", NULL, "func/file #", 2, &desc[DISASM]},
101   { SCOMPCOM, "scc", NULL, "com_spec", 1, &desc[SCOMPCOM]},
102   { STHRESH, "sthresh", NULL, "value", 1, &desc[STHRESH]},
103   { DCOMPCOM, "dcc", NULL, "com_spec", 1, &desc[DCOMPCOM]},
104   { COMPCOM, "cc", NULL, "com_spec", 1, &desc[COMPCOM]},
105   { DTHRESH, "dthresh", NULL, "value", 1, &desc[DTHRESH]},
106   { SETPATH, "setpath", NULL, "path_list", 1, &desc[SETPATH]},
107   { ADDPATH, "addpath", NULL, "path_list", 1, &desc[ADDPATH]},
108   { PATHMAP, "pathmap", NULL, "old_prefix new_prefix", 2, &desc[PATHMAP]},
109   { LIBDIRS, "preload_libdirs", NULL, NULL, 1, &desc[PATHMAP]},
110 
111   // Index Object commands
112   { NO_CMD, "", NULL, NULL, 0, &indxobjhdr},
113   { INDXOBJ, "indxobj", NULL, "type", 1, &desc[INDXOBJ]},
114   { INDXOBJLIST, "indxobj_list", NULL, NULL, 0, &desc[INDXOBJLIST]},
115   { INDXOBJDEF, "indxobj_define", NULL, "type \"index-expr\"", 2, &desc[INDXOBJDEF]},
116 
117   // Deadlock detection commands
118   { NO_CMD, "", NULL, NULL, 0, &ddhdr},
119   { DEADLOCK_EVNTS, "deadlocks", NULL, NULL, 0, &desc[DEADLOCK_EVNTS]},
120   { DEADLOCK_SUM, "dsummary", NULL, "{deadlock_id|all}", 1, &desc[DEADLOCK_SUM]},
121 
122   { NO_CMD, "", NULL, NULL, 0, &lsthdr},
123   { EXP_LIST, "experiment_list", "exp_list", NULL, 0, &desc[EXP_LIST]},
124   { SAMPLE_LIST, "sample_list", NULL, NULL, 0, &desc[SAMPLE_LIST]},
125   { LWP_LIST, "lwp_list", NULL, NULL, 0, &desc[LWP_LIST]},
126   { THREAD_LIST, "thread_list", NULL, NULL, 0, &desc[THREAD_LIST]},
127   { CPU_LIST, "cpu_list", NULL, NULL, 0, &desc[CPU_LIST]},
128 
129   { NO_CMD, "", NULL, NULL, 0, &filthdr},
130   { FILTERS, "filters", NULL, "filter-specification", 1, &desc[FILTERS]},
131   { DESCRIBE, "describe", NULL, NULL, 0, &desc[DESCRIBE]},
132 
133   { NO_CMD, "", NULL, NULL, 0, &selhdr},
134   { SAMPLE_SELECT, "sample_select", NULL, "sample_spec", 1, &desc[SAMPLE_SELECT]},
135   { LWP_SELECT, "lwp_select", NULL, "lwp_spec", 1, &desc[LWP_SELECT]},
136   { THREAD_SELECT, "thread_select", NULL, "thread_spec", 1, &desc[THREAD_SELECT]},
137   { CPU_SELECT, "cpu_select", NULL, "cpu_spec", 1, &desc[CPU_SELECT]},
138 
139   { NO_CMD, "", NULL, NULL, 0, &lohdr},
140   { OBJECT_LIST, "object_list", NULL, NULL, 0, &desc[OBJECT_LIST]},
141   { OBJECT_SHOW, "object_show", NULL, "obj1,...", 1, &desc[OBJECT_SHOW]},
142   { OBJECT_HIDE, "object_hide", NULL, "obj1,...", 1, &desc[OBJECT_HIDE]},
143   { OBJECT_API, "object_api", NULL, "obj1,...", 1, &desc[OBJECT_API]},
144   { DUMMY_CMD, " ", NULL, NULL, 0, &obj_allhdr},
145   { OBJECTS_DEFAULT, "objects_default", NULL, NULL, 1, &desc[OBJECTS_DEFAULT]},
146 
147   { OBJECT_SELECT, "object_select", NULL, "obj1,...", 1, &desc[OBJECT_SELECT]},
148 
149   { NO_CMD, "", NULL, NULL, 0, &methdr},
150   { METRIC_LIST, "metric_list", NULL, NULL, 0, &desc[METRIC_LIST]},
151   { GMETRIC_LIST, "cmetric_list", "gmetric_list", NULL, 0, &desc[GMETRIC_LIST]},
152   { INDX_METRIC_LIST, "indx_metric_list", NULL, NULL, 1, &desc[INDX_METRIC_LIST]},
153 
154   { NO_CMD, "", NULL, NULL, 0, &outhdr},
155   { OUTFILE, "outfile", NULL, "filename", 1, &desc[OUTFILE]},
156   { APPENDFILE, "appendfile", NULL, "filename", 1, &desc[APPENDFILE]},
157   { LIMIT, "limit", NULL, "n", 1, &desc[LIMIT]},
158   { NAMEFMT, "name", NULL, "{long|short|mangled}[:{soname|nosoname}]", 1, &desc[NAMEFMT]},
159   { VIEWMODE, "viewmode", NULL, "{user|expert|machine}", 1, &desc[VIEWMODE]},
160   { COMPARE, "compare", NULL, "{on|off|delta|ratio}", 1, &desc[COMPARE]},
161   { PRINTMODE, "printmode", NULL, "string", 1, &desc[PRINTMODE]},
162 
163   { NO_CMD, "", NULL, NULL, 0, &othdr},
164   { HEADER, "header", NULL, "exp_id", 1, &desc[HEADER]},
165   { OBJECTS, "objects", NULL, NULL, 0, &desc[OBJECTS]},
166   { OVERVIEW_NEW, "overview", NULL, NULL, 0, &desc[OVERVIEW_NEW]},
167   { SAMPLE_DETAIL, "sample_detail", NULL, "exp_id", 1, &desc[SAMPLE_DETAIL]},
168   { STATISTICS, "statistics", NULL, "exp_id", 1, &desc[STATISTICS]},
169 
170   { NO_CMD, "", NULL, NULL, 0, &exphdr},
171   { OPEN_EXP, "open_exp", NULL, "experiment", 1, &desc[OPEN_EXP]},
172   { ADD_EXP, "add_exp", NULL, "experiment", 1, &desc[ADD_EXP]},
173   { DROP_EXP, "drop_exp", NULL, "experiment", 1, &desc[DROP_EXP]},
174 
175   { NO_CMD, "", NULL, NULL, 0, &deflthdr},
176   { DMETRICS, "dmetrics", NULL, "metric_spec", 1, &desc[DMETRICS]},
177   { DSORT, "dsort", NULL, "metric_spec", 1, &desc[DSORT]},
178   { EN_DESC, "en_desc", NULL, "{on|off|=<regex>}", 1, &desc[EN_DESC]},
179 
180   { NO_CMD, "", NULL, NULL, 0, &andeflthdr},
181   { TLMODE, "tlmode", NULL, "tl_mode", 1, &desc[TLMODE]},
182   { TLDATA, "tldata", NULL, "tl_data", 1, &desc[TLDATA]},
183   { TABS, "tabs", NULL, "tablist", 1, &desc[TABS]},
184   { CALLFLAME, "callflame", NULL, NULL, 0, &desc[CALLFLAME]},
185   { TIMELINE, "timeline", NULL, NULL, 0, &desc[TIMELINE]},
186   { DUALSOURCE, "dsrc", NULL, NULL, 0, &desc[DUALSOURCE]},
187   { SOURCEDISAM, "srcdis", NULL, NULL, 0, &desc[SOURCEDISAM]},
188 
189   { NO_CMD, "", NULL, NULL, 0, &mischdr},
190   { DUMMY_CMD, "<type>", NULL, NULL, 0, &typehdr},
191   { DUMMY_CMD, " ", NULL, NULL, 0, &typehdr2},
192 
193   { IFREQ, "ifreq", NULL, NULL, 0, &desc[IFREQ]},
194   { PROCSTATS, "procstats", NULL, NULL, 0, &desc[PROCSTATS]},
195   { SCRIPT, "script", NULL, "file", 1, &desc[SCRIPT]},
196   { VERSION_cmd, "version", NULL, NULL, 0, &desc[VERSION_cmd]},
197   { QUIT, "quit", "exit", NULL, 0, &desc[QUIT]},
198 
199   { NO_CMD, "", NULL, NULL, 0, &helphdr},
200   { HELP, "help", NULL, NULL, 0, &desc[HELP]},
201 
202   { NO_CMD, "", NULL, NULL, 0, &unsuphdr},
203   { HELP, "-help", NULL, NULL, 0, &desc[HELP]},
204   { DUMPFUNC, "dfuncs", NULL, "string", 1, &desc[DUMPFUNC]},
205   { DUMPDOBJS, "ddobjs", NULL, "string", 1, &desc[DUMPDOBJS]},
206   { DUMPNODES, "dnodes", NULL, NULL, 0, &desc[DUMPNODES]},
207   { DUMPSTACKS, "dstacks", NULL, NULL, 0, &desc[DUMPSTACKS]},
208   { DUMPUNK, "dunkpc", NULL, NULL, 0, &desc[DUMPUNK]},
209   { DUMPMAP, "dmap", NULL, NULL, 0, &desc[DUMPMAP]},
210   { DUMPENTITIES, "dentities", NULL, NULL, 0, &desc[DUMPENTITIES]},
211   { IGNORE_NO_XHWCPROF, "ignore_no_xhwcprof", NULL, NULL, 0, &desc[IGNORE_NO_XHWCPROF]},
212   { IGNORE_FS_WARN, "ignore_fs_warn", NULL, NULL, 0, &desc[IGNORE_FS_WARN]},
213 
214   { DUMP_PROFILE, "dprofile", NULL, NULL, 0, &desc[DUMP_PROFILE]},
215   { DUMP_SYNC, "dsync", NULL, NULL, 0, &desc[DUMP_SYNC]},
216   { DUMP_IOTRACE, "diotrace", NULL, NULL, 0, &desc[DUMP_IOTRACE]},
217   { DUMP_HWC, "dhwc", NULL, NULL, 0, &desc[DUMP_HWC]},
218   { DUMP_HEAP, "dheap", NULL, NULL, 0, &desc[DUMP_HEAP]},
219   { RACE_ACCS, "r_accs", NULL, NULL, 0, &desc[RACE_ACCS]},
220 
221   { DMPI_FUNCS, "dmpi_funcs", NULL, NULL, 0, &desc[DMPI_FUNCS]},
222   { DMPI_MSGS, "dmpi_msgs", NULL, NULL, 0, &desc[DMPI_MSGS]},
223   { DMPI_EVENTS, "dmpi_events", NULL, NULL, 0, &desc[DMPI_EVENTS]},
224 
225   { DMEM, "dmem", NULL, NULL, 1, &desc[DMEM]},
226   { DUMP_GC, "dumpgc", NULL, NULL, 0, &desc[DUMP_GC]},
227   { DKILL, "dkill", NULL, NULL, 2, &desc[DKILL]},
228 
229   { QQUIT, "xquit", NULL, NULL, 0, &desc[QQUIT]},
230   // use xquit for memory leak detection in dbe; it's
231   // like quit, but deletes all data loaded
232 
233   { HHELP, "xhelp", NULL, NULL, 0, &desc[HHELP]},
234   { WHOAMI, "whoami", NULL, NULL, 0, NULL},
235 
236   // these are not recognized at this point
237   { LOADOBJECT, "segments", "pmap", NULL, 0, &desc[LOADOBJECT]},
238   { LOADOBJECT_LIST, "segment_list", NULL, NULL, 0, &desc[LOADOBJECT_LIST]},
239   { LOADOBJECT_SELECT, "segment_select", NULL, "seg1,...", 1, &desc[LOADOBJECT_SELECT]},
240 
241   { LAST_CMD, "xxxx", NULL, NULL, 0, NULL}
242 };
243 
244 CmdType
get_command(char * cmd,int & arg_count,int & cparam)245 Command::get_command (char *cmd, int &arg_count, int &cparam)
246 {
247   int i;
248   int len = (int) strlen (cmd);
249   bool got = false;
250   CmdType token = UNKNOWN_CMD;
251   arg_count = 0;
252   cparam = -1;
253   if (*cmd == '\0') // - command
254     return STDIN;
255   if (*cmd == '#') // comment
256     return COMMENT;
257   if (strcmp (cmd, "V") == 0 || strcmp (cmd, "-version") == 0)
258     return VERSION_cmd;
259   if (strcmp (cmd, "-help") == 0)
260     return HELP;
261   if (strncmp (cmd, NTXT ("-whoami="), 8) == 0)
262     {
263       cparam = 8;
264       return WHOAMI;
265     }
266 
267   if (*cmd == '-')
268     cmd++;
269   for (i = 0;; i++)
270     {
271       if (cmd_lst[i].token == LAST_CMD)
272 	break;
273       if (!strncasecmp (cmd, cmd_lst[i].str, len) ||
274 	  (cmd_lst[i].alt && !strncasecmp (cmd, cmd_lst[i].alt, len)))
275 	{
276 	  // Is it unambiguous?
277 	  if (!strcasecmp (cmd, cmd_lst[i].str)
278 	      || (cmd_lst[i].alt && !strcasecmp (cmd, cmd_lst[i].alt)))
279 	    {
280 	      // exact, full-length match
281 	      token = cmd_lst[i].token;
282 	      arg_count = cmd_lst[i].arg_count;
283 	      return token;
284 	    }
285 	  if (got)
286 	    return AMBIGUOUS_CMD;
287 	  got = true;
288 	  token = cmd_lst[i].token;
289 	  arg_count = cmd_lst[i].arg_count;
290 	}
291     }
292 
293   // Did we find it?
294   if (token != UNKNOWN_CMD)
295     return token;
296 
297   // See if it's the name of a index object
298   if (dbeSession)
299     {
300       int indxtype = dbeSession->findIndexSpaceByName (cmd);
301       if (indxtype >= 0)
302 	{
303 	  // found it
304 	  cparam = indxtype;
305 	  return INDXOBJ;
306 	}
307     }
308   return token;
309 }
310 
311 const char *
get_cmd_str(CmdType type)312 Command::get_cmd_str (CmdType type)
313 {
314   for (int i = 0;; i++)
315     {
316       if (cmd_lst[i].token == LAST_CMD)
317 	break;
318       if (type == cmd_lst[i].token)
319 	return cmd_lst[i].str;
320     }
321   return "xxxx";
322 }
323 
324 char *
get_err_string(Cmd_status err)325 Command::get_err_string (Cmd_status err)
326 {
327   switch (err)
328     {
329     case CMD_OK:
330       return NULL;
331     case CMD_BAD:
332       return GTXT ("command bad");
333     case CMD_AMBIGUOUS:
334       return GTXT ("command ambiguous");
335     case CMD_BAD_ARG:
336       return GTXT ("Invalid argument to command");
337     case CMD_OUTRANGE:
338       return GTXT ("argument to command is out-of-range");
339     case CMD_INVALID:
340       return GTXT ("invalid command");
341     }
342   return NULL;
343 }
344 
345 void
print_help(char * prog_name,bool cmd_line,bool usermode,FILE * outf)346 Command::print_help (char *prog_name, bool cmd_line, bool usermode, FILE *outf)
347 {
348   char *fmt, *msg;
349   int i;
350   StringBuilder sb;
351   enum CmdType nc;
352   init_desc ();
353   if (usermode)  // show the hidden ones, too
354     nc = HELP;
355   else
356     nc = HHELP;
357 
358   if (cmd_line)
359     fprintf (outf, GTXT ("Usage: %s [ -script script | -command | - ] exper_1 ... exper_n\n"),
360 	     prog_name);
361   fprintf (outf, GTXT ("An alternate spelling for a command is shown in [], where applicable.\n\n"
362 	  "Those commands followed by a * may appear in .rc files.\n\n"
363 	  "Those commands followed by a $ can only appear in .rc files.\n\n"));
364   fmt = fmt_help (nc, ' ');
365   for (i = 0;; i++)
366     {
367       // check for end of list
368       if (cmd_lst[i].token == LAST_CMD)
369 	break;
370       if (cmd_lst[i].token == NO_CMD)   // this is a header line
371 	fprintf (outf, NTXT (" %s\n"), *cmd_lst[i].desc);
372       else
373 	{
374 	  if (strlen (cmd_lst[i].str) == 0)
375 	    continue;
376 	  // this is a real command line
377 	  sb.setLength (0);
378 	  sb.append (cmd_lst[i].str);
379 	  if (cmd_lst[i].alt)
380 	    {
381 	      sb.append ('[');
382 	      sb.append (cmd_lst[i].alt);
383 	      sb.append (']');
384 	    }
385 	  if (cmd_lst[i].arg)
386 	    {
387 	      sb.append (' ');
388 	      sb.append (cmd_lst[i].arg);
389 	    }
390 	  msg = sb.toString ();
391 	  fprintf (outf, fmt, msg, *cmd_lst[i].desc);
392 	  free (msg);
393 	}
394       // check for end of list
395       if (cmd_lst[i].token == nc)
396 	break;
397     }
398 }
399 
400 //  construct format for printing help
401 char *
fmt_help(int nc,char head)402 Command::fmt_help (int nc, char head)
403 {
404   int len, max_len, i;
405   static char fmt[BUFSIZ];
406 
407   max_len = 0;
408   for (i = 0; i < nc; i++)
409     {
410       len = (int) strlen (cmd_lst[i].str);
411       if (cmd_lst[i].alt)
412 	len += (int) strlen (cmd_lst[i].alt) + 2;
413       if (cmd_lst[i].arg)
414 	len += (int) strlen (cmd_lst[i].arg) + 2;
415       if (max_len < len)
416 	max_len = len;
417     }
418   snprintf (fmt, sizeof (fmt), NTXT ("    %c%%-%ds %%s\n"), head, max_len + 1);
419   return fmt;
420 }
421 
422 void
init_desc()423 Command::init_desc ()
424 {
425   if (desc[0] != NULL)
426     return;
427   desc[FUNCS] = GTXT ("display functions with current metrics");
428   desc[HOTPCS] = GTXT ("display hot PC's with current metrics");
429   desc[HOTLINES] = GTXT ("display hot lines with current metrics");
430   desc[FDETAIL] = GTXT ("display summary metrics for each function");
431   desc[OBJECTS] = GTXT ("display object list with errors or warnings");
432   desc[COMPARE] = GTXT ("enable comparison mode for experiments *");
433   desc[PRINTMODE] = GTXT ("set the mode for printing tables *");
434   desc[LDETAIL] = GTXT ("display summary metrics for each hot line");
435   desc[PDETAIL] = GTXT ("display summary metrics for each hot PC");
436   desc[SOURCE] = GTXT ("display annotated source for function/file");
437   desc[DISASM] = GTXT ("display annotated disassembly for function/file");
438   desc[SCOMPCOM] = GTXT ("set compiler commentary classes for source *");
439   desc[STHRESH] = GTXT ("set highlight threshold for source *");
440   desc[DCOMPCOM] = GTXT ("set compiler commentary classes for disasm *");
441   desc[COMPCOM] = GTXT ("set compiler commentary classes for both source and disasm *");
442   desc[DTHRESH] = GTXT ("set highlight threshold for disasm *");
443   desc[METRIC_LIST] = GTXT ("display the available metrics and dmetrics keywords");
444   desc[METRICS] = GTXT ("set a new list of metrics");
445   desc[SORT] = GTXT ("sort tables by the specified metric");
446   desc[GPROF] = GTXT ("display the callers-callees for each function");
447   desc[CALLTREE] = GTXT ("display the tree of function calls");
448   desc[CALLFLAME] = GTXT ("request calltree flame chart -- not a command, but used in the tabs command");
449   desc[GMETRIC_LIST] = GTXT ("display the available callers-callees metrics");
450   desc[FSINGLE] = GTXT ("display the summary metrics for specified function");
451   desc[CSINGLE] = GTXT ("display the callers-callees for the specified function");
452   desc[CPREPEND] = GTXT ("add specified function to the head of the callstack fragment");
453   desc[CAPPEND] = GTXT ("add specified function to the end of the callstack fragment");
454   desc[CRMFIRST] = GTXT ("remove the first function from the callstack fragment");
455   desc[CRMLAST] = GTXT ("remove the last function from the callstack fragment");
456   desc[LEAKS] = GTXT ("display memory leaks, aggregated by callstack");
457   desc[ALLOCS] = GTXT ("display allocations, aggregated by callstack");
458   desc[HEAP] = GTXT ("display memory allocations and leaks, aggregated by callstack");
459   desc[HEAPSTAT] = GTXT ("display heap statistics report");
460   desc[IOACTIVITY] = GTXT ("display I/O activity report, aggregated by file name");
461   desc[IOVFD] = GTXT ("display I/O activity report, aggregated by file descriptor");
462   desc[IOCALLSTACK] = GTXT ("display I/O activity report, aggregated by callstack");
463   desc[IOSTAT] = GTXT ("display I/O statistics report");
464   desc[RACE_ACCS] = GTXT ("dump race access events");
465   desc[DMPI_MSGS] = GTXT ("dump mpi messages");
466   desc[DMPI_FUNCS] = GTXT ("dump mpi function calls");
467   desc[DMPI_EVENTS] = GTXT ("dump mpi trace events");
468   desc[DMEM] = GTXT ("debug command for internal use");
469   desc[DUMP_GC] = GTXT ("dump Java garbage collector events");
470   desc[DKILL] = GTXT ("send process p signal s");
471   desc[DEADLOCK_EVNTS] = GTXT ("display deadlock events");
472   desc[DEADLOCK_SUM] = GTXT ("display summary for the deadlock event");
473   desc[HEADER] = GTXT ("display information about the experiment");
474   desc[OVERVIEW_NEW] = GTXT ("display the overview of all loaded experiments");
475   desc[SAMPLE_DETAIL] = GTXT ("display the current sample list with data");
476   desc[STATISTICS] = GTXT ("display the execution statistics data");
477   desc[EXP_LIST] = GTXT ("display the existing experiments");
478   desc[DESCRIBE] = GTXT ("describe recorded data and tokens available for filtering data");
479   desc[OBJECT_SHOW] = GTXT ("set load objects to show all functions *");
480   desc[OBJECT_HIDE] = GTXT ("set load objects to hide functions *");
481   desc[OBJECT_API] = GTXT ("set load objects to show API (entry point) only *");
482   desc[OBJECTS_DEFAULT] = GTXT ("reset load objects show to defaults");
483   desc[OBJECT_LIST] = GTXT ("display load objects, functions-shown flag");
484   desc[OBJECT_SELECT] = GTXT ("set list of load objects whose functions are shown");
485   desc[SAMPLE_LIST] = GTXT ("display the list of existing samples");
486   desc[SAMPLE_SELECT] = GTXT ("set a new list of samples");
487   desc[THREAD_LIST] = GTXT ("display the list of existing threads");
488   desc[THREAD_SELECT] = GTXT ("set a new list of threads");
489   desc[LWP_LIST] = GTXT ("display the list of existing LWPs");
490   desc[LWP_SELECT] = GTXT ("set a new list of LWPs");
491   desc[CPU_LIST] = GTXT ("display the list of CPUs");
492   desc[CPU_SELECT] = GTXT ("set a new list of CPUs");
493   desc[OUTFILE] = GTXT ("open filename for subsequent output");
494   desc[APPENDFILE] = GTXT ("open filename for subsequent appended output");
495   desc[LIMIT] = GTXT ("limit output to the first n entries (n=0 for no limit)");
496   desc[NAMEFMT] = GTXT ("set long/short/mangled names for functions *");
497   desc[VIEWMODE] = GTXT ("set viewmode user|expert|machine *");
498   desc[EN_DESC] = GTXT ("enable descendant processes on|off|regex matches lineage or program name $");
499   desc[SETPATH] = GTXT ("set search path for annotated src/dis");
500   desc[ADDPATH] = GTXT ("add search path for annotated src/dis *");
501   desc[PATHMAP] = GTXT ("remap path prefix for annotated src/dis *");
502   desc[LIBDIRS] = GTXT ("set path where the gprofng libraries are installed");
503   desc[SCRIPT] = GTXT ("read er_print commands from script file");
504   desc[PROCSTATS] = GTXT ("display processing statistics");
505   desc[ADD_EXP] = GTXT ("add experiment or group");
506   desc[DROP_EXP] = GTXT ("drop experiment");
507   desc[OPEN_EXP] = GTXT ("open experiment or group (drops all loaded experiments first)");
508   desc[VERSION_cmd] = GTXT ("display the current release version");
509   desc[HELP] = GTXT ("display the list of available commands");
510   desc[QUIT] = GTXT ("terminate processing and exit");
511   desc[DMETRICS] = GTXT ("set default function list metrics $");
512   desc[DSORT] = GTXT ("set default function list sort metric $");
513   desc[TLMODE] = GTXT ("set default timeline mode, align, depth $");
514   desc[TLDATA] = GTXT ("set default timeline visible data $");
515   desc[TABS] = GTXT ("set default visible tabs $");
516   desc[RTABS] = GTXT ("set default visible tabs for Thread Analyzer Experiment $");
517   desc[INDXOBJ] = GTXT ("display index objects of a specified type with current metrics");
518   desc[INDXOBJLIST] = GTXT ("display list of index objects");
519   desc[INDXOBJDEF] = GTXT ("define a new index object type *");
520   desc[INDX_METRIC_LIST] = GTXT ("display the available index object metrics");
521   desc[IFREQ] = GTXT ("display instruction-frequency report");
522   desc[TIMELINE] = GTXT ("request timeline -- not a command, but used in the tabs command");
523   desc[MPI_TIMELINE] = GTXT ("request mpi-timeline -- not a command, but used in the tabs command");
524   desc[MPI_CHART] = GTXT ("request mpi chart -- not a command, but used in the tabs command");
525   desc[DUALSOURCE] = GTXT ("request dualsource tab -- not a command, but used in the tabs command");
526   desc[SOURCEDISAM] = GTXT ("request source/disassembly tab -- not a command, but used in the tabs command");
527   desc[DUMPNODES] = GTXT ("dump pathtree node table");
528   desc[DUMPSTACKS] = GTXT ("dump Experiment callstack tables");
529   desc[DUMPUNK] = GTXT ("dump <Unknown> PCs");
530   desc[DUMPFUNC] = GTXT ("dump functions whose name matches string");
531   desc[DUMPDOBJS] = GTXT ("dump dataobjects whose name matches string");
532   desc[DUMPMAP] = GTXT ("dump load-object map");
533   desc[DUMPENTITIES] = GTXT ("dump threads, lwps, cpus");
534   desc[DUMP_PROFILE] = GTXT ("dump clock profile events");
535   desc[DUMP_SYNC] = GTXT ("dump synchronization trace events");
536   desc[DUMP_IOTRACE] = GTXT ("dump IO trace events");
537   desc[DUMP_HWC] = GTXT ("dump HWC profile events");
538   desc[DUMP_HEAP] = GTXT ("dump heap trace events");
539   desc[IGNORE_NO_XHWCPROF] = GTXT ("ignore absence of -xhwcprof info in dataspace profiling $");
540   desc[IGNORE_FS_WARN] = GTXT ("ignore filesystem (nfs, ...) warning $");
541   desc[HHELP] = GTXT ("display help including unsupported commands");
542   desc[QQUIT] = GTXT ("terminate processing and exit");
543   desc[LOADOBJECT] = GTXT ("display the address map with current metrics");
544   desc[LOADOBJECT_LIST] = GTXT ("display segments, indicating which are selected");
545   desc[LOADOBJECT_SELECT] = GTXT ("set a new list of segments");
546   desc[FILTERS] = GTXT ("define a filter");
547 
548   fhdr = GTXT ("\nCommands controlling the function list:");
549   cchdr = GTXT ("\nCommands controlling the callers-callees and calltree lists:");
550   lahdr = GTXT ("\nCommands controlling the leak and allocation lists:");
551   iohdr = GTXT ("\nCommand controlling the I/O activity report:");
552   rahdr = GTXT ("\nCommands controlling the race events lists:");
553   ddhdr = GTXT ("\nCommands controlling the deadlock events lists:");
554   typehdr = GTXT ("equivalent to \"memobj type\", or \"indxobj type\"");
555   typehdr2 = GTXT ("  where type is a memory object or index object type");
556   sdhdr = GTXT ("\nCommands controlling the source and disassembly listings:");
557   lsthdr = GTXT ("\nCommands listing experiments, samples and threads:");
558   lohdr = GTXT ("\nCommands controlling load object selection:");
559   obj_allhdr = GTXT ("  the special object name `all' refers to all load objects");
560   methdr = GTXT ("\nCommands that list metrics:");
561   othdr = GTXT ("\nCommands that print other displays:");
562   outhdr = GTXT ("\nCommands that control output:");
563   mischdr = GTXT ("\nMiscellaneous commands:");
564   exphdr = GTXT ("\nCommands for experiments (scripts and interactive mode only):");
565   deflthdr = GTXT ("\nDefault-setting commands:");
566   andeflthdr = GTXT ("\nDefault-setting commands that only affect gprofng GUI");
567   selhdr = GTXT ("\nCommands controlling old-style filters/selection:");
568   filthdr = GTXT ("\nCommands controlling filters:");
569   indxobjhdr = GTXT ("\nCommands controlling the index objects:");
570   unsuphdr = GTXT ("\nUnsupported commands:");
571   helphdr = GTXT ("\nHelp command:");
572 }
573