xref: /netbsd-src/external/gpl3/binutils/dist/gprofng/src/gp-print.h (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 #ifndef _GP_PRINT_H
22 #define _ER_PRINT_H
23 
24 #include "Command.h"
25 #include "DbeApplication.h"
26 #include "Histable.h"
27 #include "Print.h"
28 
29 void ipc_mainLoop (int argc, char *argv[]);
30 
31 class DbeView;
32 template <class ITEM> class Vector;
33 
34 // er_print object
35 class er_print : public DbeApplication
36 {
37 public:
38 
39   er_print (int argc, char *argv[]);
40   virtual ~er_print ();
41   void start (int argc, char *argv[]);
42   bool free_memory_before_exit ();
43 
44 private:
45 
46   char *error_msg;
47   DbeView *dbev;
48   char *out_fname;
49   FILE *inp_file;
50   FILE *dis_file;
51   FILE *out_file;
52   int dbevindex;
53   char *cov_string;
54   int limit;
55   Vector<Histable*> *cstack;
56   bool was_QQUIT;
57 
58   // override methods in base class
59   int check_args (int argc, char *argv[]);
60   void usage ();
61 
62   int is_valid_seg_name (char *seg_name, int prev);
63   int cmp_seg_name (char *full_name, char *seg_name);
64   int process_object_select (char *cov);
65   int set_libexpand (char *cov, enum LibExpand expand);
66   int set_libdefaults ();
67 
68   bool end_command (char *cmd);
69   void run (int argc, char *argv[]);
70   void proc_script ();
71   void proc_cmd (CmdType cmd_type, int cparam, char *arg1, char *arg2,
72 		 char *arg3 = NULL, char *arg4 = NULL, bool xdefault = true);
73   void disp_list (int no_header, int size, int align[],
74 		  char *header[], char **lists[]);
75   void exp_list ();
76   void describe ();
77   void obj_list ();
78   void seg_list ();
79   void print_objects ();
80   void print_overview ();
81   void print_overview_nodes (Vector<void*> *data, int level,
82 			     Vector<char *> *metric_cmds, Vector<char *> *non_metric_cmds);
83   void print_overview_tree (Vector<void*> *data, int level, Vector<void*> *values,
84 			    Vector<char *> *metric_cmds, Vector<char *> *non_metric_cmds);
85   void print_segments ();
86   void filter_list (CmdType cmd_type);
87   int check_exp_id (int exp_id, char *sel);
88   int get_exp_id (char *sel, int &bgn_index, int &end_index);
89   void print_func (Histable::Type type, Print_mode mode,
90 		   MetricList *mlist1, MetricList *mlist2,
91 		   char *func_name = NULL, char *sel = NULL);
92   void print_gprof (CmdType cmd_type, char *func_name, char *sel);
93   void print_ctree (CmdType cmd_type);
94   void print_dobj (Print_mode type, MetricList *mlist1,
95 		   char *dobj_name = NULL, char *sel = NULL);
96   void memobj (char *, int);
97   void mo_list (bool showtab, FILE *outf);
98   void mo_define (char *, char *, char *, char *, char *);
99   void indxobj (char *, int);
100   void indxo_list (bool showtab, FILE *outf);
101   void indxo_define (char *, char *, char *, char *);
102   void ifreq ();
103   void dump_nodes ();
104   void dump_stacks ();
105   void dump_unk_pcs ();
106   void dump_funcs (char *);
107   void dump_dataobjects (char *);
108   void dump_map ();
109   void dump_entities ();
110   void dump_stats ();
111   void dump_proc_warnings ();
112   void send_signal ();
113   void print_cmd (er_print_common_display *);
114   FILE *set_outfile (char *cmd, FILE *&set_file, bool append);
115   void gen_mapfile (char *seg_name, char *cmd);
116 };
117 
118 #endif /* _ER_PRINT_H */
119