xref: /titanic_44/usr/src/tools/ctf/dwarf/common/dwarf_global.h (revision 07dc1947c362e187fb955d283b692f8769dd5def)
149d3bc91SRichard Lowe /*
249d3bc91SRichard Lowe 
3*07dc1947SRichard Lowe   Copyright (C) 2000,2004,2005 Silicon Graphics, Inc.  All Rights Reserved.
449d3bc91SRichard Lowe 
549d3bc91SRichard Lowe   This program is free software; you can redistribute it and/or modify it
649d3bc91SRichard Lowe   under the terms of version 2.1 of the GNU Lesser General Public License
749d3bc91SRichard Lowe   as published by the Free Software Foundation.
849d3bc91SRichard Lowe 
949d3bc91SRichard Lowe   This program is distributed in the hope that it would be useful, but
1049d3bc91SRichard Lowe   WITHOUT ANY WARRANTY; without even the implied warranty of
1149d3bc91SRichard Lowe   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1249d3bc91SRichard Lowe 
1349d3bc91SRichard Lowe   Further, this software is distributed without any warranty that it is
1449d3bc91SRichard Lowe   free of the rightful claim of any third person regarding infringement
1549d3bc91SRichard Lowe   or the like.  Any license provided herein, whether implied or
1649d3bc91SRichard Lowe   otherwise, applies only to this software file.  Patent licenses, if
1749d3bc91SRichard Lowe   any, provided herein do not apply to combinations of this program with
1849d3bc91SRichard Lowe   other software, or any other product whatsoever.
1949d3bc91SRichard Lowe 
2049d3bc91SRichard Lowe   You should have received a copy of the GNU Lesser General Public
2149d3bc91SRichard Lowe   License along with this program; if not, write the Free Software
22*07dc1947SRichard Lowe   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
2349d3bc91SRichard Lowe   USA.
2449d3bc91SRichard Lowe 
25*07dc1947SRichard Lowe   Contact information:  Silicon Graphics, Inc., 1500 Crittenden Lane,
2649d3bc91SRichard Lowe   Mountain View, CA 94043, or:
2749d3bc91SRichard Lowe 
2849d3bc91SRichard Lowe   http://www.sgi.com
2949d3bc91SRichard Lowe 
3049d3bc91SRichard Lowe   For further information regarding this notice, see:
3149d3bc91SRichard Lowe 
3249d3bc91SRichard Lowe   http://oss.sgi.com/projects/GenInfo/NoticeExplan
3349d3bc91SRichard Lowe 
3449d3bc91SRichard Lowe */
3549d3bc91SRichard Lowe 
3649d3bc91SRichard Lowe 
3749d3bc91SRichard Lowe 
3849d3bc91SRichard Lowe 
3949d3bc91SRichard Lowe typedef struct Dwarf_Global_Context_s *Dwarf_Global_Context;
4049d3bc91SRichard Lowe 
4149d3bc91SRichard Lowe /*
4249d3bc91SRichard Lowe     This struct contains header information for a set of pubnames.
4349d3bc91SRichard Lowe     Essentially, they contain the context for a set of pubnames
4449d3bc91SRichard Lowe     belonging to a compilation-unit.
4549d3bc91SRichard Lowe 
4649d3bc91SRichard Lowe     This is also used for the sgi-specific
4749d3bc91SRichard Lowe     weaknames, typenames, varnames, funcnames data:
4849d3bc91SRichard Lowe     the structs for those are incomplete and
4949d3bc91SRichard Lowe     instances of this are used instead.
5049d3bc91SRichard Lowe 
51*07dc1947SRichard Lowe     Also used for DWARF3 .debug_pubtypes.
52*07dc1947SRichard Lowe 
5349d3bc91SRichard Lowe */
5449d3bc91SRichard Lowe struct Dwarf_Global_Context_s {
5549d3bc91SRichard Lowe 
56*07dc1947SRichard Lowe     /* Length in .debug_pubnames (etc) of a set of names for a
5749d3bc91SRichard Lowe        compilation-unit. Dwarf_Word pu_length; The value is not made
5849d3bc91SRichard Lowe        available outside libdwarf and not used inside, so no need to
5949d3bc91SRichard Lowe        record it. */
6049d3bc91SRichard Lowe 
61*07dc1947SRichard Lowe     /* For this context, size of a length. 4 or 8 */
6249d3bc91SRichard Lowe     unsigned char pu_length_size;
63*07dc1947SRichard Lowe 
64*07dc1947SRichard Lowe     /* For this CU, size of the extension 0 except for dwarf2 extension
6549d3bc91SRichard Lowe        64bit, in which case is 4. */
6649d3bc91SRichard Lowe     unsigned char pu_extension_size;
6749d3bc91SRichard Lowe 
6849d3bc91SRichard Lowe     /*
6949d3bc91SRichard Lowe        Offset into .debug_info of the compilation-unit header (not DIE)
7049d3bc91SRichard Lowe        for this set of pubnames. */
7149d3bc91SRichard Lowe     Dwarf_Off pu_offset_of_cu_header;
7249d3bc91SRichard Lowe 
7349d3bc91SRichard Lowe     /* Size of compilation-unit that these pubnames are in. */
7449d3bc91SRichard Lowe     Dwarf_Unsigned pu_info_length;
7549d3bc91SRichard Lowe 
7649d3bc91SRichard Lowe     Dwarf_Debug pu_dbg;
7749d3bc91SRichard Lowe };
7849d3bc91SRichard Lowe 
7949d3bc91SRichard Lowe 
8049d3bc91SRichard Lowe /* This struct contains information for a single pubname. */
8149d3bc91SRichard Lowe struct Dwarf_Global_s {
8249d3bc91SRichard Lowe 
8349d3bc91SRichard Lowe     /*
8449d3bc91SRichard Lowe        Offset from the start of the corresponding compilation-unit of
8549d3bc91SRichard Lowe        the DIE for the given pubname CU. */
8649d3bc91SRichard Lowe     Dwarf_Off gl_named_die_offset_within_cu;
8749d3bc91SRichard Lowe 
8849d3bc91SRichard Lowe     /* Points to the given pubname. */
8949d3bc91SRichard Lowe     Dwarf_Small *gl_name;
9049d3bc91SRichard Lowe 
9149d3bc91SRichard Lowe     /* Context for this pubname. */
9249d3bc91SRichard Lowe     Dwarf_Global_Context gl_context;
9349d3bc91SRichard Lowe };
9449d3bc91SRichard Lowe 
9549d3bc91SRichard Lowe int _dwarf_internal_get_pubnames_like_data(Dwarf_Debug dbg,
9649d3bc91SRichard Lowe 					   Dwarf_Small *
9749d3bc91SRichard Lowe 					   section_data_ptr,
9849d3bc91SRichard Lowe 					   Dwarf_Unsigned
9949d3bc91SRichard Lowe 					   section_length,
10049d3bc91SRichard Lowe 					   Dwarf_Global ** globals,
10149d3bc91SRichard Lowe 					   Dwarf_Signed * return_count,
10249d3bc91SRichard Lowe 					   Dwarf_Error * error,
103*07dc1947SRichard Lowe 					   int context_code,
104*07dc1947SRichard Lowe 					   int global_code,
10549d3bc91SRichard Lowe 					   int length_err_num,
10649d3bc91SRichard Lowe 					   int version_err_num);
107*07dc1947SRichard Lowe 
108*07dc1947SRichard Lowe void
109*07dc1947SRichard Lowe _dwarf_internal_globals_dealloc( Dwarf_Debug dbg, Dwarf_Global *dwgl,
110*07dc1947SRichard Lowe         Dwarf_Signed count,
111*07dc1947SRichard Lowe         int context_code,
112*07dc1947SRichard Lowe         int global_code,
113*07dc1947SRichard Lowe         int list_code);
114*07dc1947SRichard Lowe 
115*07dc1947SRichard Lowe 
116*07dc1947SRichard Lowe #ifdef __sgi  /* __sgi should only be defined for IRIX/MIPS. */
117*07dc1947SRichard Lowe void _dwarf_fix_up_offset_irix(Dwarf_Debug dbg,
118*07dc1947SRichard Lowe         Dwarf_Unsigned *varp,
119*07dc1947SRichard Lowe         char *caller_site_name);
120*07dc1947SRichard Lowe #define FIX_UP_OFFSET_IRIX_BUG(ldbg,var,name) _dwarf_fix_up_offset_irix(ldbg,&var,name)
121*07dc1947SRichard Lowe #else
122*07dc1947SRichard Lowe #define FIX_UP_OFFSET_IRIX_BUG(ldbg,var,name)
123*07dc1947SRichard Lowe #endif
124*07dc1947SRichard Lowe 
125