| 1 |
/* |
| 2 |
Copyright (C) 2022-2023 David Anderson. All Rights Reserved. |
| 3 |
|
| 4 |
Redistribution and use in source and binary forms, with |
| 5 |
or without modification, are permitted provided that the |
| 6 |
following conditions are met: |
| 7 |
|
| 8 |
Redistributions of source code must retain the above |
| 9 |
copyright notice, this list of conditions and the following |
| 10 |
disclaimer. |
| 11 |
|
| 12 |
Redistributions in binary form must reproduce the above |
| 13 |
copyright notice, this list of conditions and the following |
| 14 |
disclaimer in the documentation and/or other materials |
| 15 |
provided with the distribution. |
| 16 |
|
| 17 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND |
| 18 |
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, |
| 19 |
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 20 |
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 21 |
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
| 22 |
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 |
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 24 |
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 25 |
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 26 |
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 27 |
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 28 |
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
| 29 |
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 |
*/ |
| 31 |
|
| 32 |
#ifndef DWARF_DEBUGADDR_H |
| 33 |
#define DWARF_DEBUGADDR_H |
| 34 |
#ifdef __cplusplus |
| 35 |
extern "C" { |
| 36 |
#endif /* __cplusplus */ |
| 37 |
|
| 38 |
#define DW_ADDR_TABLE_MAGIC 0xfade |
| 39 |
|
| 40 |
/* In DWARF5 each portion of .debug_addr has a header. |
| 41 |
|
| 42 |
In a DWARF4 extension gcc emits .debug_addr |
| 43 |
but without those headers, just with the |
| 44 |
array of data entries, so dwarf_debugaddr.c |
| 45 |
creates a table from data in Dwarf_Debug_S |
| 46 |
assuming every CU has the |
| 47 |
same address_size and version as in the initial |
| 48 |
.debug_info CU. */ |
| 49 |
|
| 50 |
struct Dwarf_Debug_Addr_Table_s { |
| 51 |
Dwarf_Unsigned da_magic; |
| 52 |
Dwarf_Debug da_dbg; |
| 53 |
/* Length includes the table header and |
| 54 |
the length-field of the header and |
| 55 |
the array of addresses. */ |
| 56 |
Dwarf_Unsigned da_length; |
| 57 |
Dwarf_Small da_length_size; /* 4 or 8 */ |
| 58 |
Dwarf_Small da_extension_size; /* 4 or 0 */ |
| 59 |
Dwarf_Unsigned da_table_section_offset; |
| 60 |
|
| 61 |
/* Whole section size. >= this table length */ |
| 62 |
Dwarf_Unsigned da_section_size ; |
| 63 |
|
| 64 |
/* pointer to entry[0] */ |
| 65 |
Dwarf_Small *da_data_entries; |
| 66 |
Dwarf_Unsigned da_entry_count; |
| 67 |
/* One past end of this Debug Addr Table */ |
| 68 |
Dwarf_Small *da_end_table; |
| 69 |
|
| 70 |
/* The value appearing in some DW_AT_addr_base: |
| 71 |
da_table_section_offset+da_local_offset_entry0. */ |
| 72 |
Dwarf_Unsigned da_addr_base; |
| 73 |
Dwarf_Half da_version; |
| 74 |
Dwarf_Small da_address_size; |
| 75 |
#if 0 |
| 76 |
/* this is not really handled anywhere by any compiler |
| 77 |
so we do not remember it. Must be zero. */ |
| 78 |
Dwarf_Small da_segment_selector_size; |
| 79 |
#endif |
| 80 |
}; |
| 81 |
|
| 82 |
#ifdef __cplusplus |
| 83 |
} |
| 84 |
#endif /* __cplusplus */ |
| 85 |
#endif /* DWARF_DEBUGADDR_H */ |