Debian Codegraph @

src/lib/libdwarf/dwarf_global.h

raw
1 /*
2
3 Copyright (C) 2000,2004,2005 Silicon Graphics, Inc. All Rights Reserved.
4 Portions Copyright (C) 2011-2023 David Anderson. All Rights Reserved.
5
6 This program is free software; you can redistribute it
7 and/or modify it under the terms of version 2.1 of the
8 GNU Lesser General Public License as published by the Free
9 Software Foundation.
10
11 This program is distributed in the hope that it would be
12 useful, but WITHOUT ANY WARRANTY; without even the implied
13 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE.
15
16 Further, this software is distributed without any warranty
17 that it is free of the rightful claim of any third person
18 regarding infringement or the like. Any license provided
19 herein, whether implied or otherwise, applies only to this
20 software file. Patent licenses, if any, provided herein
21 do not apply to combinations of this program with other
22 software, or any other product whatsoever.
23
24 You should have received a copy of the GNU Lesser General
25 Public License along with this program; if not, write the
26 Free Software Foundation, Inc., 51 Franklin Street - Fifth
27 Floor, Boston MA 02110-1301, USA.
28
29 */
30
31 typedef struct Dwarf_Global_Context_s *Dwarf_Global_Context;
32
33 /*
34 This struct contains header information for a set of pubnames.
35 Essentially, they contain the context for a set of pubnames
36 belonging to a compilation-unit.
37
38 Also used for the sgi-specific
39 weaknames, typenames, varnames, funcnames data:
40 the structs for those are incomplete and
41 instances of this are used instead.
42
43 Also used for DWARF3,4 .debug_pubtypes and DWARF5 .debug_names.
44
45 These never refer to .debug_types, only to .debug_info.
46 */
47 struct Dwarf_Global_Context_s {
48 unsigned pu_is_dnames; /* 0 if not .debug_names. */
49 unsigned pu_alloc_type; /* DW_DLA something */
50 Dwarf_Debug pu_dbg;
51
52 /* One of DW_GL_GLOBAL,DW_GL_PUBTYPES,etc */
53 int pu_global_category;
54
55 /* The following set with the DW_TAG of the DIE
56 involved. Left 0 with .debug_pubnames. */
57 Dwarf_Bool pu_is_debug_names;
58
59 /* For DWARF5 .debug_names the following
60 are irellevant, left 0. */
61 /* For this context, size of a length (offset). 4 or 8 */
62 unsigned char pu_length_size;
63
64 /* Size of the data section for the CU */
65 unsigned char pu_length;
66
67 /* For this CU, size of the extension. 0 except
68 for dwarf2 extension (IRIX) 64bit, in which case is 4. */
69 unsigned char pu_extension_size;
70
71 Dwarf_Half pu_version; /* 2,3,4 or 5 */
72
73 /* offset in pubnames or debug_names of the pu header. */
74 Dwarf_Off pu_pub_offset;
75 /* One past end of the section entries for this CU. */
76 Dwarf_Byte_Ptr pu_pub_entries_end_ptr;
77
78 /* Offset into .debug_info of the compilation-unit header
79 (not DIE) for this set of pubnames. */
80 Dwarf_Off pu_offset_of_cu_header;
81
82 /* Size of compilation-unit that these pubnames are in. */
83 Dwarf_Unsigned pu_info_length;
84
85 };
86
87 /* This struct contains information for a single pubname. */
88 struct Dwarf_Global_s {
89
90 /* Offset from the start of the corresponding compilation-unit of
91 the DIE for the given pubname CU. */
92 Dwarf_Off gl_named_die_offset_within_cu;
93
94 /* Points to the given pubname. */
95 Dwarf_Small *gl_name;
96
97 /* Context for this pubname. */
98 Dwarf_Global_Context gl_context;
99
100 Dwarf_Half gl_alloc_type; /* DW_DLA something */
101 Dwarf_Half gl_tag; /* .debug_names only. Else 0. */
102 };
103
104 /* In all but pubnames, head_chain and globals
105 should be passed in as NULL.
106 So that .debug_names entries can be added to the chain
107 before making an array.
108 */
109
110 int _dwarf_internal_get_pubnames_like_data(Dwarf_Debug dbg,
111 const char *secname,
112 Dwarf_Small *section_data_ptr,
113 Dwarf_Unsigned section_length,
114 Dwarf_Global ** globals,
115 Dwarf_Chain * head_chain,
116 Dwarf_Chain ** plast_chain,
117 Dwarf_Signed * return_count,
118 Dwarf_Error * error,
119 int context_code,
120 int global_code,
121 int length_err_num,
122 int version_err_num);
123
124 void _dwarf_internal_globals_dealloc( Dwarf_Debug dbg,
125 Dwarf_Global *dwgl, Dwarf_Signed count);
126
127 #ifdef __sgi /* __sgi should only be defined for IRIX/MIPS. */
128 void _dwarf_fix_up_offset_irix(Dwarf_Debug dbg,
129 Dwarf_Unsigned *varp,
130 char *caller_site_name);
131 #define FIX_UP_OFFSET_IRIX_BUG(ldbg,var,name) \
132 _dwarf_fix_up_offset_irix((ldbg),&(var),(name))
133 #else /* ! __sgi */
134 #define FIX_UP_OFFSET_IRIX_BUG(ldbg,var,name)
135 #endif /* __sgi */