arm: Support pac_key_* register operand for MRS/MSR in Armv8.1-M Mainline
[binutils-gdb.git] / gprofng / src / Settings.h
blob6f2983eb2c71de097000e8d705d32e3d3bf0ad19
1 /* Copyright (C) 2021-2024 Free Software Foundation, Inc.
2 Contributed by Oracle.
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)
9 any later version.
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. */
21 #ifndef _SETTINGS_H
22 #define _SETTINGS_H
24 #include <stdio.h>
25 #include <regex.h>
27 #include "gp-defs.h"
28 #include "Histable.h"
29 #include "MemorySpace.h"
30 #include "Metric.h"
31 #include "dbe_types.h"
32 #include "dbe_structs.h"
33 #include "enums.h"
34 #include "vec.h"
36 class Emsgqueue;
37 class Application;
39 struct DispTab;
41 // Settings object
43 class Settings
45 public:
46 friend class DbeView;
47 friend class DbeSession;
49 Settings (Application *_app);
50 Settings (Settings *_settings);
51 virtual ~Settings ();
52 void read_rc (bool ipc_or_rdt_mode); // read all rc files
53 char *read_rc (char *path); // read rc file
54 void buildMasterTabList (); // build list of Tabs that can be invoked
55 void updateTabAvailability (); // update for datamode, leaklist
56 Cmd_status set_name_format (char *str); // from a string
58 Vector<DispTab*> *
59 get_TabList () // Get the list of tabs for this view
61 return tab_list;
64 Vector<bool> *
65 get_MemTabState () // Get the list and order of memory tabs for this view
67 return mem_tab_state;
70 Vector<int> *
71 get_MemTabOrder ()
73 return mem_tab_order;
76 // Set the list of memory tabs for this view
77 void set_MemTabState (Vector<bool>*sel);
79 // add a newly-defined memory object tab
80 void mobj_define (MemObjType_t *, bool state);
82 // add a newly-defined index object tab
83 void indxobj_define (int type, bool state);
85 Vector<bool> *
86 get_IndxTabState () // Get the list and order of index tabs for this view
88 return indx_tab_state;
91 Vector<int> *
92 get_IndxTabOrder ()
94 return indx_tab_order;
97 // Set the list of index tabs for this view
98 void set_IndxTabState (Vector<bool>*sel);
100 void
101 set_name_format (int fname_fmt, bool soname_fmt)
103 name_format = Histable::make_fmt (fname_fmt, soname_fmt);
106 Histable::NameFormat
107 get_name_format ()
109 return name_format;
112 // public methods for setting and accessing the settings
113 Cmd_status set_view_mode (char *str, bool rc); // from a string
115 void
116 set_view_mode (VMode mode)
118 view_mode = mode;
121 VMode
122 get_view_mode ()
124 return view_mode;
127 // set the en_desc expression/on/off
128 Cmd_status set_en_desc (char *str, bool rc); // from a string
129 // check if the lineage or the target name matches the en_desc expression
130 bool check_en_desc (const char *lineage, const char *targname);
132 char *set_limit (char *str, bool rc); // from a string
134 char *
135 set_limit (int _limit)
137 limit = _limit;
138 return NULL;
142 get_limit ()
144 return limit;
147 char *set_printmode (char *_pmode);
149 // processing compiler commentary visibility bits
150 Cmd_status proc_compcom (const char *cmd, bool isSrc, bool rc);
152 // return any error string from processing visibility settings
153 char *get_compcom_errstr (Cmd_status status, const char *cmd);
155 // methods for setting and getting strings, and individual settings
157 char *
158 get_str_scompcom ()
160 return str_scompcom;
163 char *
164 get_str_dcompcom ()
166 return str_dcompcom;
170 get_src_compcom ()
172 return src_compcom;
176 get_dis_compcom ()
178 return dis_compcom;
181 void
182 set_cmpline_visible (bool v)
184 cmpline_visible = v;
187 void
188 set_funcline_visible (bool v)
190 funcline_visible = v;
193 void
194 set_src_visible (int v)
196 src_visible = v;
200 get_src_visible ()
202 return src_visible;
205 void
206 set_srcmetric_visible (bool v)
208 srcmetric_visible = v;
211 bool
212 get_srcmetric_visible ()
214 return srcmetric_visible;
217 void
218 set_hex_visible (bool v)
220 hex_visible = v;
223 bool
224 get_hex_visible ()
226 return hex_visible;
229 // processing and accessing the threshold settings
230 Cmd_status proc_thresh (char *cmd, bool isSrc, bool rc);
233 get_thresh_src ()
235 return threshold_src;
239 get_thresh_dis ()
241 return threshold_dis;
244 // process a tlmode setting
245 Cmd_status proc_tlmode (char *cmd, bool rc);
247 void
248 set_tlmode (int _tlmode)
250 tlmode = _tlmode;
254 get_tlmode ()
256 return tlmode;
259 void
260 set_stack_align (int _stack_align)
262 stack_align = _stack_align;
266 get_stack_align ()
268 return stack_align;
271 void
272 set_stack_depth (int _stack_depth)
274 stack_depth = _stack_depth;
278 get_stack_depth ()
280 return stack_depth;
283 // process a tabs setting: called when the tab list is requested
284 Cmd_status proc_tabs (bool _rdtMode);
286 Cmd_status proc_tldata (const char *cmd, bool rc); // process a tldata setting
287 void set_tldata (const char* tldata_string);
288 char *get_tldata ();
290 char *
291 get_default_metrics ()
293 return str_dmetrics;
296 char *
297 get_default_sort ()
299 return str_dsort;
302 void
303 set_ignore_no_xhwcprof (bool v) // ignore no xhwcprof errors for dataspace
305 ignore_no_xhwcprof = v;
308 bool
309 get_ignore_no_xhwcprof ()
311 return ignore_no_xhwcprof;
314 void
315 set_ignore_fs_warn (bool v) // ignore filesystem warnings in experiments
317 ignore_fs_warn = v;
320 bool
321 get_ignore_fs_warn ()
323 return ignore_fs_warn;
326 // add a pathmap
327 static char *add_pathmap (Vector<pathmap_t*> *v, const char *from, const char *to);
328 void set_pathmaps (Vector<pathmap_t*> *newPathMap);
330 // add a LoadObject expansion setting
331 bool set_libexpand (char *, enum LibExpand, bool);
332 enum LibExpand get_lo_setting (char *);
334 // set LoadObject expansion defaults back to .rc specifications
335 bool set_libdefaults ();
337 void
338 set_compare_mode (int mode)
340 compare_mode = mode;
344 get_compare_mode ()
346 return compare_mode;
349 char *
350 get_machinemodel ()
352 return dbe_strdup (machinemodel);
355 char *preload_libdirs;
357 protected: // data
358 Application *app;
360 // default strings from .rc file
361 char *str_vmode;
362 char *str_en_desc;
363 char *str_datamode;
364 char *str_scompcom;
365 char *str_sthresh;
366 char *str_dcompcom;
367 char *str_dthresh;
368 char *str_dmetrics;
369 char *str_dsort;
370 char *str_tlmode;
371 char *str_tldata;
372 char *str_tabs;
373 char *str_rtabs;
374 char *str_search_path;
375 char *str_name_format;
376 char *str_limit;
377 char *str_printmode;
378 char *str_compare;
380 bool tabs_processed;
382 // Processed settings
383 bool en_desc; // controls for reading descendant processes
384 char * en_desc_usr; // selective descendants: user specificaton
385 regex_t * en_desc_cmp; // selective descendants: compiled specification
386 Histable::NameFormat name_format; // long/short/mangled naming for C++/Java
387 VMode view_mode; // Java mode
388 int src_compcom; // compiler commentary visibility for anno-src
389 int dis_compcom; // compiler commentary visibility for anno-dis
390 int threshold_src; // threshold for anno-src
391 int threshold_dis; // threshold for anno-dis
392 int cmpline_visible; // show compile-line flags
393 int funcline_visible; // show compile-line flags
394 int src_visible; // show source in disasm
395 bool srcmetric_visible; // show metrics for source in disasm
396 bool hex_visible; // show hex code in disasm
397 char* tldata; // timeline data type string
398 int tlmode; // timeline mode for bars
399 int stack_align; // timeline stack alignment
400 int stack_depth; // timeline stack depth
401 int limit; // print limit
402 enum PrintMode print_mode;// print mode
403 char print_delim; // the delimiter, if print mode = PM_DELIM_SEP_LIST
404 int compare_mode; // compare mode
406 char *machinemodel; // machine model for Memory Objects
408 bool ignore_no_xhwcprof; // ignore no -xhwcprof data in dataspace
409 bool ignore_fs_warn; // ignore file-system recording warning
411 void set_rc (const char *path, bool msg, Emsgqueue *commentq,
412 bool override, bool ipc_or_rdt_mode = false);
414 Vector<DispTab*> *tab_list;
415 Vector<pathmap_t*> *pathmaps;
416 Vector<lo_expand_t*> *lo_expands;
417 enum LibExpand lo_expand_default;
418 bool is_loexpand_default;
419 Vector<bool> *mem_tab_state;
420 Vector<int> *mem_tab_order;
421 Vector<bool> *indx_tab_state;
422 Vector<int> *indx_tab_order;
425 #endif /* ! _SETTINGS_H */