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