| 1 |
/* |
| 2 |
Copyright (C) 2017-2023 David Anderson. All Rights Reserved. |
| 3 |
|
| 4 |
This program is free software; you can redistribute it |
| 5 |
and/or modify it under the terms of version 2.1 of the |
| 6 |
GNU Lesser General Public License as published by the Free |
| 7 |
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 Lesser General |
| 23 |
Public License along with this program; if not, write the |
| 24 |
Free Software Foundation, Inc., 51 Franklin Street - Fifth |
| 25 |
Floor, Boston MA 02110-1301, USA. |
| 26 |
|
| 27 |
*/ |
| 28 |
|
| 29 |
/* Adjust this number to hope for best space and time efficiency. */ |
| 30 |
#define ABB_PAIRS_MAX 10 |
| 31 |
|
| 32 |
/* The unused attr/form entries are zero. */ |
| 33 |
struct Dwarf_D_Abbrev_s { |
| 34 |
struct Dwarf_D_Abbrev_s * da_next; |
| 35 |
Dwarf_Unsigned da_abbrev_offset; |
| 36 |
Dwarf_Unsigned da_abbrev_code; |
| 37 |
Dwarf_Unsigned da_tag; |
| 38 |
Dwarf_Unsigned da_pairs_count; |
| 39 |
Dwarf_Half da_idxattr[ABB_PAIRS_MAX]; |
| 40 |
Dwarf_Half da_form[ABB_PAIRS_MAX]; |
| 41 |
}; |
| 42 |
|
| 43 |
struct Dwarf_DN_Bucket_s { |
| 44 |
Dwarf_Unsigned db_nameindex; |
| 45 |
Dwarf_Unsigned db_collisioncount; |
| 46 |
}; |
| 47 |
|
| 48 |
#define DWARF_DNAMES_VERSION5 5 |
| 49 |
#define DWARF_DNAMES_MAGIC 0xabcd |
| 50 |
|
| 51 |
/* All offsets section global */ |
| 52 |
struct Dwarf_Dnames_Head_s { |
| 53 |
Dwarf_Unsigned dn_magic; |
| 54 |
Dwarf_Debug dn_dbg; |
| 55 |
/* For entire section */ |
| 56 |
Dwarf_Small * dn_section_data; |
| 57 |
Dwarf_Small * dn_section_end; |
| 58 |
Dwarf_Unsigned dn_section_size; |
| 59 |
|
| 60 |
/* For this names table set of data */ |
| 61 |
Dwarf_Unsigned dn_section_offset; /* unit length offset*/ |
| 62 |
Dwarf_Small * dn_indextable_data; /* unit length ptr */ |
| 63 |
Dwarf_Unsigned dn_unit_length; |
| 64 |
Dwarf_Small * dn_indextable_data_end; |
| 65 |
Dwarf_Unsigned dn_next_set_offset; |
| 66 |
Dwarf_Half dn_offset_size; |
| 67 |
Dwarf_Half dn_version; |
| 68 |
|
| 69 |
Dwarf_Unsigned dn_comp_unit_count; |
| 70 |
Dwarf_Unsigned dn_local_type_unit_count; |
| 71 |
Dwarf_Unsigned dn_foreign_type_unit_count; |
| 72 |
Dwarf_Unsigned dn_bucket_count; |
| 73 |
|
| 74 |
/* Once set, this is a single array of entries. */ |
| 75 |
struct Dwarf_DN_Bucket_s * dn_bucket_array; |
| 76 |
|
| 77 |
/* dn_name_count gives the size of |
| 78 |
the dn_string_offsets and dn_entry_offsets arrays, |
| 79 |
and if hashes present, the size of the |
| 80 |
dn_hash_table array. */ |
| 81 |
Dwarf_Unsigned dn_name_count; |
| 82 |
Dwarf_Unsigned dn_abbrev_table_size; /* bytes */ |
| 83 |
Dwarf_Unsigned dn_entry_pool_size; /* bytes */ |
| 84 |
Dwarf_Unsigned dn_augmentation_string_size; |
| 85 |
char * dn_augmentation_string; /* local copy */ |
| 86 |
/*Offsets are non-decreasing (even empty tables */ |
| 87 |
Dwarf_Unsigned dn_cu_list_offset; |
| 88 |
Dwarf_Unsigned dn_local_tu_list_offset; |
| 89 |
Dwarf_Unsigned dn_foreign_tu_list_offset; |
| 90 |
Dwarf_Unsigned dn_buckets_offset; |
| 91 |
Dwarf_Unsigned dn_hash_table_offset; |
| 92 |
Dwarf_Unsigned dn_string_offsets_offset; |
| 93 |
Dwarf_Unsigned dn_entry_offsets_offset; |
| 94 |
Dwarf_Unsigned dn_abbrevs_offset; |
| 95 |
Dwarf_Unsigned dn_entry_pool_offset; |
| 96 |
/* pointers non-decreasing (even empty tables) */ |
| 97 |
Dwarf_Small * dn_cu_list; |
| 98 |
Dwarf_Small * dn_local_tu_list; |
| 99 |
Dwarf_Small * dn_foreign_tu_list; |
| 100 |
Dwarf_Small * dn_buckets; |
| 101 |
Dwarf_Small * dn_hash_table; |
| 102 |
Dwarf_Small * dn_string_offsets; |
| 103 |
Dwarf_Small * dn_entry_offsets; |
| 104 |
Dwarf_Small * dn_abbrevs; |
| 105 |
Dwarf_Small * dn_entry_pool; |
| 106 |
|
| 107 |
/* Array of structs*/ |
| 108 |
struct Dwarf_D_Abbrev_s *dn_abbrev_instances; |
| 109 |
Dwarf_Unsigned dn_abbrev_instance_count; |
| 110 |
|
| 111 |
/* If this is a single-CU entry the next two are set |
| 112 |
for later return. */ |
| 113 |
Dwarf_Bool dn_single_cu; |
| 114 |
Dwarf_Unsigned dn_single_cu_offset; |
| 115 |
|
| 116 |
Dwarf_Unsigned b_value; |
| 117 |
Dwarf_Unsigned b_orig_bucket_index; |
| 118 |
Dwarf_Unsigned b_sorted_bucket_index; |
| 119 |
}; |
| 120 |
|
| 121 |
void _dwarf_dnames_destructor(void *m); |