149d3bc9Richard Lowe/*
249d3bc9Richard Lowe
307dc194Richard Lowe  Copyright (C) 2000,2004 Silicon Graphics, Inc.  All Rights Reserved.
407dc194Richard Lowe  Portions Copyright 2007-2010 Sun Microsystems, Inc. All rights reserved.
549d3bc9Richard Lowe
649d3bc9Richard Lowe  This program is free software; you can redistribute it and/or modify it
749d3bc9Richard Lowe  under the terms of version 2.1 of the GNU Lesser General Public License
849d3bc9Richard Lowe  as published by the Free Software Foundation.
949d3bc9Richard Lowe
1049d3bc9Richard Lowe  This program is distributed in the hope that it would be useful, but
1149d3bc9Richard Lowe  WITHOUT ANY WARRANTY; without even the implied warranty of
1349d3bc9Richard Lowe
1449d3bc9Richard Lowe  Further, this software is distributed without any warranty that it is
1549d3bc9Richard Lowe  free of the rightful claim of any third person regarding infringement
1649d3bc9Richard Lowe  or the like.  Any license provided herein, whether implied or
1749d3bc9Richard Lowe  otherwise, applies only to this software file.  Patent licenses, if
1849d3bc9Richard Lowe  any, provided herein do not apply to combinations of this program with
1949d3bc9Richard Lowe  other software, or any other product whatsoever.
2049d3bc9Richard Lowe
2107dc194Richard Lowe  You should have received a copy of the GNU Lesser General Public
2207dc194Richard Lowe  License along with this program; if not, write the Free Software
2307dc194Richard Lowe  Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
2449d3bc9Richard Lowe  USA.
2549d3bc9Richard Lowe
2607dc194Richard Lowe  Contact information:  Silicon Graphics, Inc., 1500 Crittenden Lane,
2749d3bc9Richard Lowe  Mountain View, CA 94043, or:
2849d3bc9Richard Lowe
2949d3bc9Richard Lowe  http://www.sgi.com
3049d3bc9Richard Lowe
3149d3bc9Richard Lowe  For further information regarding this notice, see:
3249d3bc9Richard Lowe
3349d3bc9Richard Lowe  http://oss.sgi.com/projects/GenInfo/NoticeExplan
3449d3bc9Richard Lowe
3549d3bc9Richard Lowe*/
3649d3bc9Richard Lowe
3749d3bc9Richard Lowe
3849d3bc9Richard Lowe
3949d3bc9Richard Lowe#define VERSION				2
4007dc194Richard Lowe#ifdef __i386
4107dc194Richard Lowe#define MIN_INST_LENGTH			1
4207dc194Richard Lowe#else
4349d3bc9Richard Lowe#define MIN_INST_LENGTH			4
4407dc194Richard Lowe#endif
4549d3bc9Richard Lowe#define DEFAULT_IS_STMT			false
4649d3bc9Richard Lowe			/* line base and range are temporarily defines.
4749d3bc9Richard Lowe			   They need to be calculated later */
4849d3bc9Richard Lowe#define LINE_BASE			-1
4949d3bc9Richard Lowe#define LINE_RANGE			4
5049d3bc9Richard Lowe
5149d3bc9Richard Lowe#define OPCODE_BASE			10
5249d3bc9Richard Lowe#define MAX_OPCODE			255
5349d3bc9Richard Lowe
5449d3bc9Richard Lowe
5549d3bc9Richard Lowe/*
5649d3bc9Richard Lowe	This struct is used to hold entries in the include directories
5749d3bc9Richard Lowe	part of statement prologue.
5849d3bc9Richard Lowe*/
5949d3bc9Richard Lowestruct Dwarf_P_Inc_Dir_s {
6049d3bc9Richard Lowe    char *did_name;		/* name of directory */
6149d3bc9Richard Lowe    Dwarf_P_Inc_Dir did_next;
6249d3bc9Richard Lowe};
6349d3bc9Richard Lowe
6449d3bc9Richard Lowe
6549d3bc9Richard Lowe/*
6649d3bc9Richard Lowe	This struct holds file entries for the statement prologue.
6749d3bc9Richard Lowe	Defined in pro_line.h
6849d3bc9Richard Lowe*/
6949d3bc9Richard Lowestruct Dwarf_P_F_Entry_s {
7049d3bc9Richard Lowe    char *dfe_name;
7149d3bc9Richard Lowe    char *dfe_args;		/* has dir index, time of modification,
7249d3bc9Richard Lowe				   length in bytes. Encodes as leb128 */
7349d3bc9Richard Lowe    int dfe_nbytes;		/* number of bytes in args */
7449d3bc9Richard Lowe    Dwarf_P_F_Entry dfe_next;
7549d3bc9Richard Lowe};
7649d3bc9Richard Lowe
7749d3bc9Richard Lowe
7849d3bc9Richard Lowe/*
7949d3bc9Richard Lowe	Struct holding line number information for each of the producer
8049d3bc9Richard Lowe	line entries
8149d3bc9Richard Lowe*/
8249d3bc9Richard Lowestruct Dwarf_P_Line_s {
8349d3bc9Richard Lowe    /* code address */
8449d3bc9Richard Lowe    Dwarf_Addr dpl_address;
8549d3bc9Richard Lowe
8649d3bc9Richard Lowe    /* file index, index into file entry */
8749d3bc9Richard Lowe    Dwarf_Word dpl_file;
8849d3bc9Richard Lowe
8949d3bc9Richard Lowe    /* line number */
9049d3bc9Richard Lowe    Dwarf_Word dpl_line;
9149d3bc9Richard Lowe
9249d3bc9Richard Lowe    /* column number */
9349d3bc9Richard Lowe    Dwarf_Word dpl_column;
9449d3bc9Richard Lowe
9549d3bc9Richard Lowe    /* whether its a beginning of a stmt */
9649d3bc9Richard Lowe    Dwarf_Ubyte dpl_is_stmt;
9749d3bc9Richard Lowe
9849d3bc9Richard Lowe    /* whether its a beginning of basic blk */
9949d3bc9Richard Lowe    Dwarf_Ubyte dpl_basic_block;
10049d3bc9Richard Lowe
10149d3bc9Richard Lowe    /* used to store opcodes set_address, and end_seq */
10249d3bc9Richard Lowe    Dwarf_Ubyte dpl_opc;
10349d3bc9Richard Lowe
10449d3bc9Richard Lowe    /*
10549d3bc9Richard Lowe       Used only for relocations.  Has index of symbol relative to
10649d3bc9Richard Lowe       which relocation has to be done (the S part in S + A) */
10749d3bc9Richard Lowe    Dwarf_Unsigned dpl_r_symidx;
10849d3bc9Richard Lowe
10949d3bc9Richard Lowe    Dwarf_P_Line dpl_next;
11049d3bc9Richard Lowe};
11149d3bc9Richard Lowe
11249d3bc9Richard Lowe/*
11349d3bc9Richard Lowe	to initialize state machine registers, definition in
11449d3bc9Richard Lowe	pro_line.c
11549d3bc9Richard Lowe*/
11649d3bc9Richard Lowevoid _dwarf_pro_reg_init(Dwarf_P_Line);