| 1 |
/* |
| 2 |
|
| 3 |
Copyright (C) 2014-2023 David Anderson. All Rights Reserved. |
| 4 |
|
| 5 |
This program is free software; you can redistribute it |
| 6 |
and/or modify it under the terms of version 2.1 of the |
| 7 |
GNU Lesser General Public License as published by the Free |
| 8 |
Software Foundation. |
| 9 |
|
| 10 |
This program is distributed in the hope that it would be |
| 11 |
useful, but WITHOUT ANY WARRANTY; without even the implied |
| 12 |
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 13 |
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. Any license provided |
| 18 |
herein, whether implied or otherwise, applies only to this |
| 19 |
software file. Patent licenses, if any, provided herein |
| 20 |
do not apply to combinations of this program with other |
| 21 |
software, or any other product whatsoever. |
| 22 |
|
| 23 |
You should have received a copy of the GNU Lesser General |
| 24 |
Public License along with this program; if not, write the |
| 25 |
Free Software Foundation, Inc., 51 Franklin Street - Fifth |
| 26 |
Floor, Boston MA 02110-1301, USA. |
| 27 |
|
| 28 |
*/ |
| 29 |
|
| 30 |
/* The following is based on |
| 31 |
The gdb online documentation at |
| 32 |
https://sourceware.org/gdb/onlinedocs/gdb/ |
| 33 |
Appendix J, ".gdb_index section format". |
| 34 |
*/ |
| 35 |
|
| 36 |
/* These are the two types .gdb_index uses. |
| 37 |
the offset_type (32 bits) and other fields |
| 38 |
defined 64 bits. We use our own Dwarf_Unsigned |
| 39 |
for all the interfaces, these are just for reading |
| 40 |
the section data. |
| 41 |
|
| 42 |
The section data is defined to be in little-endian regardless of |
| 43 |
the target machine. |
| 44 |
We use our host endianness in all interfaces. |
| 45 |
|
| 46 |
We simply assume unsigned int is 32 bits FIXME. |
| 47 |
*/ |
| 48 |
|
| 49 |
typedef Dwarf_Unsigned gdbindex_64; |
| 50 |
enum gdbindex_type_e { |
| 51 |
git_unknown, |
| 52 |
git_std, |
| 53 |
git_address, |
| 54 |
git_cuvec |
| 55 |
}; |
| 56 |
|
| 57 |
struct Dwarf_Gdbindex_array_instance_s { |
| 58 |
Dwarf_Small * dg_base; |
| 59 |
Dwarf_Unsigned dg_count; |
| 60 |
/* the in_object struct size. */ |
| 61 |
Dwarf_Unsigned dg_entry_length; |
| 62 |
/* The size of a single field in the in-object struct */ |
| 63 |
unsigned dg_fieldlen; |
| 64 |
/* The address_area type is a bit irregular. */ |
| 65 |
enum gdbindex_type_e dg_type; |
| 66 |
}; |
| 67 |
|
| 68 |
struct Dwarf_Gdbindex_s { |
| 69 |
Dwarf_Debug gi_dbg; |
| 70 |
Dwarf_Small * gi_section_data; /* dss_data */ |
| 71 |
Dwarf_Unsigned gi_section_length; /* dss_size */ |
| 72 |
|
| 73 |
Dwarf_Unsigned gi_version; |
| 74 |
Dwarf_Unsigned gi_cu_list_offset; |
| 75 |
Dwarf_Unsigned gi_types_cu_list_offset; |
| 76 |
Dwarf_Unsigned gi_address_area_offset; |
| 77 |
Dwarf_Unsigned gi_symbol_table_offset; |
| 78 |
Dwarf_Unsigned gi_constant_pool_offset; |
| 79 |
struct Dwarf_Gdbindex_array_instance_s gi_culisthdr; |
| 80 |
struct Dwarf_Gdbindex_array_instance_s gi_typesculisthdr; |
| 81 |
struct Dwarf_Gdbindex_array_instance_s gi_addressareahdr; |
| 82 |
struct Dwarf_Gdbindex_array_instance_s gi_symboltablehdr; |
| 83 |
struct Dwarf_Gdbindex_array_instance_s gi_cuvectorhdr; |
| 84 |
}; |