| 1 |
#ifndef DWARF_STR_OFFSETS_H |
| 2 |
#define DWARF_STR_OFFSETS_H |
| 3 |
/* |
| 4 |
Copyright (C) 2023 David Anderson |
| 5 |
|
| 6 |
This program is free software; you can redistribute it |
| 7 |
and/or modify it under the terms of version 2.1 of |
| 8 |
the GNU Lesser General Public License |
| 9 |
as published by the Free Software Foundation. |
| 10 |
|
| 11 |
This program is distributed in the hope that it would be useful, |
| 12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 14 |
|
| 15 |
Further, this software is distributed without any warranty |
| 16 |
that it is free of the rightful claim of any third person |
| 17 |
regarding infringement or the like. |
| 18 |
Any license provided herein, whether implied or |
| 19 |
otherwise, applies only to this software file. |
| 20 |
Patent licenses, if any, provided herein do not |
| 21 |
apply to combinations of this program with |
| 22 |
other software, or any other product whatsoever. |
| 23 |
|
| 24 |
You should have received a copy of the GNU Lesser General Public |
| 25 |
License along with this program; if not, write the Free Software |
| 26 |
Foundation, Inc., 51 Franklin Street - Fifth Floor, |
| 27 |
Boston MA 02110-1301, |
| 28 |
USA. |
| 29 |
|
| 30 |
*/ |
| 31 |
|
| 32 |
struct Dwarf_Str_Offsets_Table_s { |
| 33 |
/* pointers are to dwarf-memory valid till Dwarf_Debug |
| 34 |
is closed.. None are to be deallocated. */ |
| 35 |
Dwarf_Unsigned so_magic_value; |
| 36 |
Dwarf_Debug so_dbg; |
| 37 |
|
| 38 |
/* Section data. */ |
| 39 |
Dwarf_Small *so_section_start_ptr; |
| 40 |
Dwarf_Small *so_section_end_ptr; |
| 41 |
Dwarf_Unsigned so_section_size; |
| 42 |
/* Overall data about wasted space in the section. */ |
| 43 |
Dwarf_Unsigned so_wasted_section_bytes; |
| 44 |
/* The number of tables processed in the section. */ |
| 45 |
Dwarf_Unsigned so_table_count; |
| 46 |
|
| 47 |
/* Used to iterate through the section getting |
| 48 |
to each table */ |
| 49 |
Dwarf_Unsigned so_next_table_offset; |
| 50 |
|
| 51 |
/* Per table (ie, a table is a |
| 52 |
header and array of offsets) inside the section. |
| 53 |
Offset to first byte of a table |
| 54 |
Offset one past last byte of a table. |
| 55 |
Offset from first byte of table to its array. |
| 56 |
Count of entries in the array |
| 57 |
Size of each enntry in the array. */ |
| 58 |
Dwarf_Unsigned so_table_start_offset; |
| 59 |
Dwarf_Unsigned so_table_end_offset; |
| 60 |
Dwarf_Unsigned so_lcl_offset_to_array; |
| 61 |
Dwarf_Unsigned so_array_entry_count; |
| 62 |
Dwarf_Half so_array_entry_size; |
| 63 |
|
| 64 |
}; |
| 65 |
int _dwarf_extract_string_offset_via_str_offsets(Dwarf_Debug dbg, |
| 66 |
Dwarf_Small *data_ptr, |
| 67 |
Dwarf_Small *end_data_ptr, |
| 68 |
Dwarf_Half attrform, |
| 69 |
Dwarf_CU_Context cu_context, |
| 70 |
Dwarf_Unsigned *str_sect_offset_out, |
| 71 |
Dwarf_Error *error); |
| 72 |
|
| 73 |
int |
| 74 |
_dwarf_read_str_offsets_header(Dwarf_Str_Offsets_Table sot, |
| 75 |
Dwarf_CU_Context cucontext, |
| 76 |
/* Followed by return values/error */ |
| 77 |
Dwarf_Unsigned *length, |
| 78 |
Dwarf_Half *offset_size_out, |
| 79 |
Dwarf_Half *extension_size_out, |
| 80 |
Dwarf_Half *version_out, |
| 81 |
Dwarf_Half *padding_out, |
| 82 |
Dwarf_Unsigned *local_offset_to_array_out, |
| 83 |
Dwarf_Unsigned *total_table_length_out, |
| 84 |
Dwarf_Error *error); |
| 85 |
|
| 86 |
int _dwarf_trial_read_dwarf_five_hdr(Dwarf_Debug dbg, |
| 87 |
Dwarf_Unsigned table_start_offset, |
| 88 |
Dwarf_Unsigned secsize, |
| 89 |
Dwarf_Unsigned *table_local_offset_of_array, |
| 90 |
Dwarf_Unsigned *total_table_length, |
| 91 |
/* length_out is the initial DWARF length value |
| 92 |
from the table header. */ |
| 93 |
Dwarf_Unsigned *length_out, |
| 94 |
Dwarf_Half *local_offset_size_out, |
| 95 |
Dwarf_Half *local_extension_size_out, |
| 96 |
Dwarf_Half *version_out, |
| 97 |
Dwarf_Half *padding_out, |
| 98 |
Dwarf_Error *error); |
| 99 |
int |
| 100 |
_dwarf_find_all_offsets_via_fission(Dwarf_Debug dbg, |
| 101 |
Dwarf_CU_Context cu_context, |
| 102 |
Dwarf_Error *error); |
| 103 |
|
| 104 |
#endif /* DWARF_STR_OFFSETS_H */ |