xref: /titanic_51/usr/src/lib/libdwarf/common/pro_line.h (revision 7fd791373689a6af05e27efec3b1ab556e02aa23)
1*7fd79137SRobert Mustacchi /*
2*7fd79137SRobert Mustacchi 
3*7fd79137SRobert Mustacchi   Copyright (C) 2000,2004 Silicon Graphics, Inc.  All Rights Reserved.
4*7fd79137SRobert Mustacchi   Portions Copyright 2007-2010 Sun Microsystems, Inc. All rights reserved.
5*7fd79137SRobert Mustacchi 
6*7fd79137SRobert Mustacchi   This program is free software; you can redistribute it and/or modify it
7*7fd79137SRobert Mustacchi   under the terms of version 2.1 of the GNU Lesser General Public License
8*7fd79137SRobert Mustacchi   as published by the Free Software Foundation.
9*7fd79137SRobert Mustacchi 
10*7fd79137SRobert Mustacchi   This program is distributed in the hope that it would be useful, but
11*7fd79137SRobert Mustacchi   WITHOUT ANY WARRANTY; without even the implied warranty of
12*7fd79137SRobert Mustacchi   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13*7fd79137SRobert Mustacchi 
14*7fd79137SRobert Mustacchi   Further, this software is distributed without any warranty that it is
15*7fd79137SRobert Mustacchi   free of the rightful claim of any third person regarding infringement
16*7fd79137SRobert Mustacchi   or the like.  Any license provided herein, whether implied or
17*7fd79137SRobert Mustacchi   otherwise, applies only to this software file.  Patent licenses, if
18*7fd79137SRobert Mustacchi   any, provided herein do not apply to combinations of this program with
19*7fd79137SRobert Mustacchi   other software, or any other product whatsoever.
20*7fd79137SRobert Mustacchi 
21*7fd79137SRobert Mustacchi   You should have received a copy of the GNU Lesser General Public
22*7fd79137SRobert Mustacchi   License along with this program; if not, write the Free Software
23*7fd79137SRobert Mustacchi   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
24*7fd79137SRobert Mustacchi   USA.
25*7fd79137SRobert Mustacchi 
26*7fd79137SRobert Mustacchi   Contact information:  Silicon Graphics, Inc., 1500 Crittenden Lane,
27*7fd79137SRobert Mustacchi   Mountain View, CA 94043, or:
28*7fd79137SRobert Mustacchi 
29*7fd79137SRobert Mustacchi   http://www.sgi.com
30*7fd79137SRobert Mustacchi 
31*7fd79137SRobert Mustacchi   For further information regarding this notice, see:
32*7fd79137SRobert Mustacchi 
33*7fd79137SRobert Mustacchi   http://oss.sgi.com/projects/GenInfo/NoticeExplan
34*7fd79137SRobert Mustacchi 
35*7fd79137SRobert Mustacchi */
36*7fd79137SRobert Mustacchi 
37*7fd79137SRobert Mustacchi 
38*7fd79137SRobert Mustacchi 
39*7fd79137SRobert Mustacchi #define VERSION				2
40*7fd79137SRobert Mustacchi #ifdef __i386
41*7fd79137SRobert Mustacchi #define MIN_INST_LENGTH			1
42*7fd79137SRobert Mustacchi #else
43*7fd79137SRobert Mustacchi #define MIN_INST_LENGTH			4
44*7fd79137SRobert Mustacchi #endif
45*7fd79137SRobert Mustacchi #define DEFAULT_IS_STMT			false
46*7fd79137SRobert Mustacchi 			/* line base and range are temporarily defines.
47*7fd79137SRobert Mustacchi 			   They need to be calculated later */
48*7fd79137SRobert Mustacchi #define LINE_BASE			-1
49*7fd79137SRobert Mustacchi #define LINE_RANGE			4
50*7fd79137SRobert Mustacchi 
51*7fd79137SRobert Mustacchi #define OPCODE_BASE			10
52*7fd79137SRobert Mustacchi #define MAX_OPCODE			255
53*7fd79137SRobert Mustacchi 
54*7fd79137SRobert Mustacchi 
55*7fd79137SRobert Mustacchi /*
56*7fd79137SRobert Mustacchi 	This struct is used to hold entries in the include directories
57*7fd79137SRobert Mustacchi 	part of statement prologue.
58*7fd79137SRobert Mustacchi */
59*7fd79137SRobert Mustacchi struct Dwarf_P_Inc_Dir_s {
60*7fd79137SRobert Mustacchi     char *did_name;		/* name of directory */
61*7fd79137SRobert Mustacchi     Dwarf_P_Inc_Dir did_next;
62*7fd79137SRobert Mustacchi };
63*7fd79137SRobert Mustacchi 
64*7fd79137SRobert Mustacchi 
65*7fd79137SRobert Mustacchi /*
66*7fd79137SRobert Mustacchi 	This struct holds file entries for the statement prologue.
67*7fd79137SRobert Mustacchi 	Defined in pro_line.h
68*7fd79137SRobert Mustacchi */
69*7fd79137SRobert Mustacchi struct Dwarf_P_F_Entry_s {
70*7fd79137SRobert Mustacchi     char *dfe_name;
71*7fd79137SRobert Mustacchi     char *dfe_args;		/* has dir index, time of modification,
72*7fd79137SRobert Mustacchi 				   length in bytes. Encodes as leb128 */
73*7fd79137SRobert Mustacchi     int dfe_nbytes;		/* number of bytes in args */
74*7fd79137SRobert Mustacchi     Dwarf_P_F_Entry dfe_next;
75*7fd79137SRobert Mustacchi };
76*7fd79137SRobert Mustacchi 
77*7fd79137SRobert Mustacchi 
78*7fd79137SRobert Mustacchi /*
79*7fd79137SRobert Mustacchi 	Struct holding line number information for each of the producer
80*7fd79137SRobert Mustacchi 	line entries
81*7fd79137SRobert Mustacchi */
82*7fd79137SRobert Mustacchi struct Dwarf_P_Line_s {
83*7fd79137SRobert Mustacchi     /* code address */
84*7fd79137SRobert Mustacchi     Dwarf_Addr dpl_address;
85*7fd79137SRobert Mustacchi 
86*7fd79137SRobert Mustacchi     /* file index, index into file entry */
87*7fd79137SRobert Mustacchi     Dwarf_Word dpl_file;
88*7fd79137SRobert Mustacchi 
89*7fd79137SRobert Mustacchi     /* line number */
90*7fd79137SRobert Mustacchi     Dwarf_Word dpl_line;
91*7fd79137SRobert Mustacchi 
92*7fd79137SRobert Mustacchi     /* column number */
93*7fd79137SRobert Mustacchi     Dwarf_Word dpl_column;
94*7fd79137SRobert Mustacchi 
95*7fd79137SRobert Mustacchi     /* whether its a beginning of a stmt */
96*7fd79137SRobert Mustacchi     Dwarf_Ubyte dpl_is_stmt;
97*7fd79137SRobert Mustacchi 
98*7fd79137SRobert Mustacchi     /* whether its a beginning of basic blk */
99*7fd79137SRobert Mustacchi     Dwarf_Ubyte dpl_basic_block;
100*7fd79137SRobert Mustacchi 
101*7fd79137SRobert Mustacchi     /* used to store opcodes set_address, and end_seq */
102*7fd79137SRobert Mustacchi     Dwarf_Ubyte dpl_opc;
103*7fd79137SRobert Mustacchi 
104*7fd79137SRobert Mustacchi     /*
105*7fd79137SRobert Mustacchi        Used only for relocations.  Has index of symbol relative to
106*7fd79137SRobert Mustacchi        which relocation has to be done (the S part in S + A) */
107*7fd79137SRobert Mustacchi     Dwarf_Unsigned dpl_r_symidx;
108*7fd79137SRobert Mustacchi 
109*7fd79137SRobert Mustacchi     Dwarf_P_Line dpl_next;
110*7fd79137SRobert Mustacchi };
111*7fd79137SRobert Mustacchi 
112*7fd79137SRobert Mustacchi /*
113*7fd79137SRobert Mustacchi 	to initialize state machine registers, definition in
114*7fd79137SRobert Mustacchi 	pro_line.c
115*7fd79137SRobert Mustacchi */
116*7fd79137SRobert Mustacchi void _dwarf_pro_reg_init(Dwarf_P_Line);
117