Debian Codegraph @

src/lib/libdwarf/dwarf_gnu_index.h

raw
1 /*
2 Copyright (C) 2020-2023 David Anderson. All Rights Reserved.
3 Redistribution and use in source and binary forms, with
4 or without modification, are permitted provided that the
5 following conditions are met:
6
7 Redistributions of source code must retain the above
8 copyright notice, this list of conditions and the following
9 disclaimer.
10
11 Redistributions in binary form must reproduce the above
12 copyright notice, this list of conditions and the following
13 disclaimer in the documentation and/or other materials
14 provided with the distribution.
15
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
17 CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
18 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 /* This is for accessing .debug_gnu_pubnames
32 and .debug_gnu_pubtypes.
33 It has nothing to do with .gdb_index. */
34
35 struct DGI_Entry_s {
36 char * ge_string;
37 Dwarf_Unsigned ge_debug_info_offset;
38 char ge_flag_byte;
39 #if 0
40 /* Following is DW_GNUIVIS bit 7 of flag byte
41 shifted right 7. */
42 char ge_flag_global_static;
43 /* Following is DW_GNUIKIND bits 4,5,6 of flag byte
44 shifted right 4.
45 Bits 0-3 are reserved and should de zero. */
46 char ge_flag_type;
47 #endif
48 };
49 /*
50 each block data on disk looks like:
51 LENGTH (which determines offset size)
52 version
53 offset into .debug_info (offsetsize)
54 size of area in .debug_info (offsetsize)
55 For each entry
56 offset in debug_info of DIE (offsetsize)
57 1 byte flag
58 strlen+1 string
59 Trailing LENGTH 4 bytes zero.
60 */
61 struct Dwarf_Gnu_IBlock_s {
62 Dwarf_Gnu_Index_Head ib_head;
63 Dwarf_Unsigned ib_index; /*of this ib */
64 Dwarf_Unsigned ib_block_length_offset;
65 Dwarf_Unsigned ib_block_length;
66 Dwarf_Half ib_offset_size; /* 4 or 8 */
67 Dwarf_Half ib_extension_size; /* 0 or 4 */
68 Dwarf_Half ib_version;
69 Dwarf_Bool ib_counted_entries; /* see ib_entry_count*/
70 Dwarf_Unsigned ib_offset_in_debug_info;
71 Dwarf_Unsigned ib_size_in_debug_info;
72
73 /* following the length field*/
74 Dwarf_Unsigned ib_b_data_offset;
75
76 Dwarf_Unsigned ib_b_offset; /* offset of entry area */
77 Dwarf_Small * ib_b_data; /* the entry area */
78 /* entrylength = LENGTH - 2 - 2*offsetsize */
79 Dwarf_Unsigned ib_b_entrylength;
80
81 Dwarf_Unsigned ib_entry_count;
82 struct DGI_Entry_s *ib_entryarray;
83 };
84
85 struct Dwarf_Gnu_Index_Head_s {
86 Dwarf_Debug gi_dbg;
87 Dwarf_Small * gi_section_data;
88 Dwarf_Unsigned gi_section_length;
89 Dwarf_Small * gi_section_end;
90 struct Dwarf_Gnu_IBlock_s *gi_blockarray;
91 Dwarf_Unsigned gi_blockcount;
92 Dwarf_Bool gi_is_pubnames; /* if false is pubtypes */
93 };
94 void _dwarf_gnu_index_head_destructor(void *incoming);
95 void _dwarf_free_gnu_index_head_content(Dwarf_Gnu_Index_Head);