| 1 |
/* |
| 2 |
Copyright (C) 2006 Silicon Graphics, Inc. All Rights Reserved. |
| 3 |
Portions Copyright 2011 David Anderson. All Rights Reserved. |
| 4 |
|
| 5 |
This program is free software; you can redistribute it and/or |
| 6 |
modify it under the terms of version 2 of the GNU General |
| 7 |
Public License as published by the Free Software Foundation. |
| 8 |
|
| 9 |
This program is distributed in the hope that it would be |
| 10 |
useful, but WITHOUT ANY WARRANTY; without even the implied |
| 11 |
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 12 |
PURPOSE. |
| 13 |
|
| 14 |
Further, this software is distributed without any warranty |
| 15 |
that it is free of the rightful claim of any third person |
| 16 |
regarding infringement or the like. Any license provided |
| 17 |
herein, whether implied or otherwise, applies only to this |
| 18 |
software file. Patent licenses, if any, provided herein |
| 19 |
do not apply to combinations of this program with other |
| 20 |
software, or any other product whatsoever. |
| 21 |
|
| 22 |
You should have received a copy of the GNU General Public |
| 23 |
License along with this program; if not, write the Free |
| 24 |
Software Foundation, Inc., 51 Franklin Street - Fifth Floor, |
| 25 |
Boston MA 02110-1301, USA. |
| 26 |
|
| 27 |
*/ |
| 28 |
|
| 29 |
#ifndef DWCONFIG_H |
| 30 |
#define DWCONFIG_H |
| 31 |
|
| 32 |
#ifdef __cplusplus |
| 33 |
extern "C" { |
| 34 |
#endif /* __cplusplus */ |
| 35 |
|
| 36 |
#define FOUND_ABI_START 1 |
| 37 |
#define FOUND_OPTION 2 |
| 38 |
#define FOUND_ERROR 3 |
| 39 |
#define FOUND_DONE 4 |
| 40 |
|
| 41 |
/* Declarations helping configure the frame reader. |
| 42 |
We are not allowing negative register numbers. |
| 43 |
Which could be allowed if necessary with a little work. */ |
| 44 |
struct dwconf_s { |
| 45 |
char *cf_config_file_path; |
| 46 |
char *cf_abi_name; |
| 47 |
|
| 48 |
/* The interface_number is now only 3, so never tested. |
| 49 |
It used to allow 2 to test old and now-deleted |
| 50 |
libdwarf API functions. */ |
| 51 |
int cf_interface_number; |
| 52 |
|
| 53 |
/* The number of table rules , aka columns. |
| 54 |
For MIPS/IRIX is 66. */ |
| 55 |
unsigned long cf_table_entry_count; |
| 56 |
|
| 57 |
/* Array of cf_table_entry_count reg names. Names not filled in |
| 58 |
from dwarfdump.conf have NULL (0) pointer value. |
| 59 |
cf_named_regs_table_size must match size of cf_regs array. |
| 60 |
Set cf_regs_malloced 1 if table was malloced. Set 0 |
| 61 |
if static. |
| 62 |
*/ |
| 63 |
char **cf_regs; |
| 64 |
unsigned long cf_named_regs_table_size; |
| 65 |
unsigned cf_regs_malloced; |
| 66 |
|
| 67 |
/* The 'default initial value' when intializing a table. for MIPS |
| 68 |
is DW_FRAME_SAME_VAL(1035). For other ISA/ABIs may be |
| 69 |
DW_FRAME_UNDEFINED_VAL(1034). */ |
| 70 |
unsigned cf_initial_rule_value; |
| 71 |
unsigned cf_same_val; |
| 72 |
unsigned cf_undefined_val; |
| 73 |
|
| 74 |
/* The number of the cfa 'register'. For cf_interface_number 2 of |
| 75 |
MIPS this is 0. For other architectures (and anytime using |
| 76 |
cf_interface_number 3) this should be outside the table, a |
| 77 |
special value such as 1436, not a table column at all). */ |
| 78 |
unsigned cf_cfa_reg; |
| 79 |
|
| 80 |
/* If non-zero it is the number of bytes in an address |
| 81 |
for the frame data. Normally it will be zero because |
| 82 |
there are usually other sources for the correct address size. |
| 83 |
However, with DWARF2 frame data there is no explicit address |
| 84 |
size in the frame data and the object file might not have |
| 85 |
other .debug_ sections to work with. |
| 86 |
If zero, no address size was supplied, and that is normal and |
| 87 |
the already-set (or defaulted) address size is to be used. |
| 88 |
Only an exceptional frame configure will specify address |
| 89 |
size here. This won't work at all if the object needing |
| 90 |
this setting has different address size in different CUs. */ |
| 91 |
unsigned cf_address_size; |
| 92 |
}; |
| 93 |
|
| 94 |
/* Returns DW_DLV_OK if works. |
| 95 |
Returns DW_DLV_ERROR if cannot do what is asked. */ |
| 96 |
int find_conf_file_and_read_config(const char *named_file, |
| 97 |
const char *named_abi, char **defaults, |
| 98 |
struct dwconf_s *conf_out); |
| 99 |
void init_conf_file_data(struct dwconf_s *config_file_data); |
| 100 |
|
| 101 |
void print_reg_from_config_data(Dwarf_Unsigned reg, |
| 102 |
struct dwconf_s *config_data); |
| 103 |
|
| 104 |
void free_all_dwconf(struct dwconf_s *config_data); |
| 105 |
|
| 106 |
void init_generic_config_1200_regs(struct dwconf_s *conf); |
| 107 |
|
| 108 |
#ifdef __cplusplus |
| 109 |
} |
| 110 |
#endif /* __cplusplus */ |
| 111 |
|
| 112 |
#endif /* DWCONFIG_H */ |