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