xref: /titanic_52/usr/src/lib/libdwarf/common/dwarf_global.h (revision 7fd791373689a6af05e27efec3b1ab556e02aa23)
1*7fd79137SRobert Mustacchi /*
2*7fd79137SRobert Mustacchi 
3*7fd79137SRobert Mustacchi   Copyright (C) 2000,2004,2005 Silicon Graphics, Inc.  All Rights Reserved.
4*7fd79137SRobert Mustacchi 
5*7fd79137SRobert Mustacchi   This program is free software; you can redistribute it and/or modify it
6*7fd79137SRobert Mustacchi   under the terms of version 2.1 of the GNU Lesser General Public License
7*7fd79137SRobert Mustacchi   as published by the Free Software Foundation.
8*7fd79137SRobert Mustacchi 
9*7fd79137SRobert Mustacchi   This program is distributed in the hope that it would be useful, but
10*7fd79137SRobert Mustacchi   WITHOUT ANY WARRANTY; without even the implied warranty of
11*7fd79137SRobert Mustacchi   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12*7fd79137SRobert Mustacchi 
13*7fd79137SRobert Mustacchi   Further, this software is distributed without any warranty that it is
14*7fd79137SRobert Mustacchi   free of the rightful claim of any third person regarding infringement
15*7fd79137SRobert Mustacchi   or the like.  Any license provided herein, whether implied or
16*7fd79137SRobert Mustacchi   otherwise, applies only to this software file.  Patent licenses, if
17*7fd79137SRobert Mustacchi   any, provided herein do not apply to combinations of this program with
18*7fd79137SRobert Mustacchi   other software, or any other product whatsoever.
19*7fd79137SRobert Mustacchi 
20*7fd79137SRobert Mustacchi   You should have received a copy of the GNU Lesser General Public
21*7fd79137SRobert Mustacchi   License along with this program; if not, write the Free Software
22*7fd79137SRobert Mustacchi   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
23*7fd79137SRobert Mustacchi   USA.
24*7fd79137SRobert Mustacchi 
25*7fd79137SRobert Mustacchi   Contact information:  Silicon Graphics, Inc., 1500 Crittenden Lane,
26*7fd79137SRobert Mustacchi   Mountain View, CA 94043, or:
27*7fd79137SRobert Mustacchi 
28*7fd79137SRobert Mustacchi   http://www.sgi.com
29*7fd79137SRobert Mustacchi 
30*7fd79137SRobert Mustacchi   For further information regarding this notice, see:
31*7fd79137SRobert Mustacchi 
32*7fd79137SRobert Mustacchi   http://oss.sgi.com/projects/GenInfo/NoticeExplan
33*7fd79137SRobert Mustacchi 
34*7fd79137SRobert Mustacchi */
35*7fd79137SRobert Mustacchi 
36*7fd79137SRobert Mustacchi 
37*7fd79137SRobert Mustacchi 
38*7fd79137SRobert Mustacchi 
39*7fd79137SRobert Mustacchi typedef struct Dwarf_Global_Context_s *Dwarf_Global_Context;
40*7fd79137SRobert Mustacchi 
41*7fd79137SRobert Mustacchi /*
42*7fd79137SRobert Mustacchi     This struct contains header information for a set of pubnames.
43*7fd79137SRobert Mustacchi     Essentially, they contain the context for a set of pubnames
44*7fd79137SRobert Mustacchi     belonging to a compilation-unit.
45*7fd79137SRobert Mustacchi 
46*7fd79137SRobert Mustacchi     This is also used for the sgi-specific
47*7fd79137SRobert Mustacchi     weaknames, typenames, varnames, funcnames data:
48*7fd79137SRobert Mustacchi     the structs for those are incomplete and
49*7fd79137SRobert Mustacchi     instances of this are used instead.
50*7fd79137SRobert Mustacchi 
51*7fd79137SRobert Mustacchi     Also used for DWARF3 .debug_pubtypes.
52*7fd79137SRobert Mustacchi 
53*7fd79137SRobert Mustacchi */
54*7fd79137SRobert Mustacchi struct Dwarf_Global_Context_s {
55*7fd79137SRobert Mustacchi 
56*7fd79137SRobert Mustacchi     /* Length in .debug_pubnames (etc) of a set of names for a
57*7fd79137SRobert Mustacchi        compilation-unit. Dwarf_Word pu_length; The value is not made
58*7fd79137SRobert Mustacchi        available outside libdwarf and not used inside, so no need to
59*7fd79137SRobert Mustacchi        record it. */
60*7fd79137SRobert Mustacchi 
61*7fd79137SRobert Mustacchi     /* For this context, size of a length. 4 or 8 */
62*7fd79137SRobert Mustacchi     unsigned char pu_length_size;
63*7fd79137SRobert Mustacchi 
64*7fd79137SRobert Mustacchi     /* For this CU, size of the extension 0 except for dwarf2 extension
65*7fd79137SRobert Mustacchi        64bit, in which case is 4. */
66*7fd79137SRobert Mustacchi     unsigned char pu_extension_size;
67*7fd79137SRobert Mustacchi 
68*7fd79137SRobert Mustacchi     /*
69*7fd79137SRobert Mustacchi        Offset into .debug_info of the compilation-unit header (not DIE)
70*7fd79137SRobert Mustacchi        for this set of pubnames. */
71*7fd79137SRobert Mustacchi     Dwarf_Off pu_offset_of_cu_header;
72*7fd79137SRobert Mustacchi 
73*7fd79137SRobert Mustacchi     /* Size of compilation-unit that these pubnames are in. */
74*7fd79137SRobert Mustacchi     Dwarf_Unsigned pu_info_length;
75*7fd79137SRobert Mustacchi 
76*7fd79137SRobert Mustacchi     Dwarf_Debug pu_dbg;
77*7fd79137SRobert Mustacchi };
78*7fd79137SRobert Mustacchi 
79*7fd79137SRobert Mustacchi 
80*7fd79137SRobert Mustacchi /* This struct contains information for a single pubname. */
81*7fd79137SRobert Mustacchi struct Dwarf_Global_s {
82*7fd79137SRobert Mustacchi 
83*7fd79137SRobert Mustacchi     /*
84*7fd79137SRobert Mustacchi        Offset from the start of the corresponding compilation-unit of
85*7fd79137SRobert Mustacchi        the DIE for the given pubname CU. */
86*7fd79137SRobert Mustacchi     Dwarf_Off gl_named_die_offset_within_cu;
87*7fd79137SRobert Mustacchi 
88*7fd79137SRobert Mustacchi     /* Points to the given pubname. */
89*7fd79137SRobert Mustacchi     Dwarf_Small *gl_name;
90*7fd79137SRobert Mustacchi 
91*7fd79137SRobert Mustacchi     /* Context for this pubname. */
92*7fd79137SRobert Mustacchi     Dwarf_Global_Context gl_context;
93*7fd79137SRobert Mustacchi };
94*7fd79137SRobert Mustacchi 
95*7fd79137SRobert Mustacchi int _dwarf_internal_get_pubnames_like_data(Dwarf_Debug dbg,
96*7fd79137SRobert Mustacchi 					   Dwarf_Small *
97*7fd79137SRobert Mustacchi 					   section_data_ptr,
98*7fd79137SRobert Mustacchi 					   Dwarf_Unsigned
99*7fd79137SRobert Mustacchi 					   section_length,
100*7fd79137SRobert Mustacchi 					   Dwarf_Global ** globals,
101*7fd79137SRobert Mustacchi 					   Dwarf_Signed * return_count,
102*7fd79137SRobert Mustacchi 					   Dwarf_Error * error,
103*7fd79137SRobert Mustacchi 					   int context_code,
104*7fd79137SRobert Mustacchi 					   int global_code,
105*7fd79137SRobert Mustacchi 					   int length_err_num,
106*7fd79137SRobert Mustacchi 					   int version_err_num);
107*7fd79137SRobert Mustacchi 
108*7fd79137SRobert Mustacchi void
109*7fd79137SRobert Mustacchi _dwarf_internal_globals_dealloc( Dwarf_Debug dbg, Dwarf_Global *dwgl,
110*7fd79137SRobert Mustacchi         Dwarf_Signed count,
111*7fd79137SRobert Mustacchi         int context_code,
112*7fd79137SRobert Mustacchi         int global_code,
113*7fd79137SRobert Mustacchi         int list_code);
114*7fd79137SRobert Mustacchi 
115*7fd79137SRobert Mustacchi 
116*7fd79137SRobert Mustacchi #ifdef __sgi  /* __sgi should only be defined for IRIX/MIPS. */
117*7fd79137SRobert Mustacchi void _dwarf_fix_up_offset_irix(Dwarf_Debug dbg,
118*7fd79137SRobert Mustacchi         Dwarf_Unsigned *varp,
119*7fd79137SRobert Mustacchi         char *caller_site_name);
120*7fd79137SRobert Mustacchi #define FIX_UP_OFFSET_IRIX_BUG(ldbg,var,name) _dwarf_fix_up_offset_irix(ldbg,&var,name)
121*7fd79137SRobert Mustacchi #else
122*7fd79137SRobert Mustacchi #define FIX_UP_OFFSET_IRIX_BUG(ldbg,var,name)
123*7fd79137SRobert Mustacchi #endif
124*7fd79137SRobert Mustacchi 
125