| 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 |
Portions Copyright 2017 David Anderson All rights reserved. |
| 6 |
|
| 7 |
This program is free software; you can redistribute it |
| 8 |
and/or modify it under the terms of version 2.1 of the |
| 9 |
GNU Lesser General Public License as published by the Free |
| 10 |
Software Foundation. |
| 11 |
|
| 12 |
This program is distributed in the hope that it would be |
| 13 |
useful, but WITHOUT ANY WARRANTY; without even the implied |
| 14 |
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 15 |
PURPOSE. |
| 16 |
|
| 17 |
Further, this software is distributed without any warranty |
| 18 |
that it is free of the rightful claim of any third person |
| 19 |
regarding infringement or the like. Any license provided |
| 20 |
herein, whether implied or otherwise, applies only to this |
| 21 |
software file. Patent licenses, if any, provided herein |
| 22 |
do not apply to combinations of this program with other |
| 23 |
software, or any other product whatsoever. |
| 24 |
|
| 25 |
You should have received a copy of the GNU Lesser General |
| 26 |
Public License along with this program; if not, write the |
| 27 |
Free Software Foundation, Inc., 51 Franklin Street - Fifth |
| 28 |
Floor, Boston MA 02110-1301, USA. |
| 29 |
*/ |
| 30 |
|
| 31 |
#define DW_LINE_VERSION2 2 |
| 32 |
#define DW_LINE_VERSION3 3 |
| 33 |
#define DW_LINE_VERSION4 4 |
| 34 |
|
| 35 |
#if defined(__i386) || defined(__x86_64) |
| 36 |
#define MIN_INST_LENGTH 1 |
| 37 |
#elif defined(__s390__) || defined(__s390x__) |
| 38 |
/* Correct value unknown. This is temporary |
| 39 |
as we need a better way to set this (in |
| 40 |
dwarfgen). This at least works for dwarfgen testing |
| 41 |
at this point, avoids an error. */ |
| 42 |
#define MIN_INST_LENGTH 1 |
| 43 |
#else |
| 44 |
/* 1 is not necessarily the most efficient (space-wise) for various |
| 45 |
architectures, but will allow line tables to be generated |
| 46 |
without error if the input expects the min length to be 1. |
| 47 |
When using dwarfgen the setting should be that of the |
| 48 |
output arch, not the host (unless the two essentially match). */ |
| 49 |
#define MIN_INST_LENGTH 4 |
| 50 |
#endif |
| 51 |
#define DEFAULT_IS_STMT FALSE |
| 52 |
/* line base and range are temporarily defines. |
| 53 |
They need to be calculated later. */ |
| 54 |
#define LINE_BASE -1 |
| 55 |
#define LINE_RANGE 4 |
| 56 |
|
| 57 |
#define OPCODE_BASE 10 /* DWARF2. 13 in DWARF3, 4, 5 */ |
| 58 |
#define MAX_OPCODE 255 |
| 59 |
|
| 60 |
/* This struct holds file or include_dir |
| 61 |
entries for the statement prologue. |
| 62 |
Defined in pro_line.h */ |
| 63 |
struct Dwarf_P_F_Entry_s { |
| 64 |
char *dfe_name; |
| 65 |
Dwarf_P_F_Entry dfe_next; |
| 66 |
|
| 67 |
/* DWARF 2,3,4, files only not inc dirs */ |
| 68 |
char *dfe_args; /* has dir index, time of modification, |
| 69 |
length in bytes. Encodes as leb128 */ |
| 70 |
int dfe_nbytes; /* number of bytes in args */ |
| 71 |
|
| 72 |
/* Dwarf5 Use or not depends on file_name_entry_format |
| 73 |
actually used. */ |
| 74 |
unsigned dfe_index; |
| 75 |
Dwarf_Unsigned dfe_timestamp; |
| 76 |
unsigned dfe_size; |
| 77 |
unsigned char dfe_md5[16]; |
| 78 |
}; |
| 79 |
|
| 80 |
/* |
| 81 |
Struct holding line number information for each of the producer |
| 82 |
line entries. */ |
| 83 |
struct Dwarf_P_Line_s { |
| 84 |
/* code address */ |
| 85 |
Dwarf_Addr dpl_address; |
| 86 |
|
| 87 |
/* file index, index into file entry */ |
| 88 |
Dwarf_Unsigned dpl_file; |
| 89 |
|
| 90 |
/* line number */ |
| 91 |
Dwarf_Unsigned dpl_line; |
| 92 |
|
| 93 |
/* column number */ |
| 94 |
Dwarf_Unsigned dpl_column; |
| 95 |
|
| 96 |
/* whether its a beginning of a stmt */ |
| 97 |
Dwarf_Ubyte dpl_is_stmt; |
| 98 |
|
| 99 |
/* whether its a beginning of basic blk */ |
| 100 |
Dwarf_Ubyte dpl_basic_block; |
| 101 |
|
| 102 |
/* used to store opcodes set_address, and end_seq */ |
| 103 |
Dwarf_Ubyte dpl_opc; |
| 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 |
Dwarf_Ubyte dpl_prologue_end; /* DWARF3 */ |
| 112 |
Dwarf_Ubyte dpl_epilogue_begin; /* DWARF3 */ |
| 113 |
Dwarf_Unsigned dpl_isa; /* DWARF3 */ |
| 114 |
Dwarf_Unsigned dpl_discriminator; /* DWARF4 */ |
| 115 |
}; |
| 116 |
|
| 117 |
/* |
| 118 |
to initialize state machine registers, definition in |
| 119 |
pro_line.c */ |
| 120 |
void _dwarf_pro_reg_init(Dwarf_P_Debug dbg,Dwarf_P_Line); |
| 121 |
void _dwarf_init_default_line_header_vals(Dwarf_P_Debug dbg); |