aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/yasm/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.h
blob: 9f4b1e1d1c66b55080b7c2eec9774b26755c697c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/* 
 * DWARF2 debugging format 
 * 
 *  Copyright (C) 2006-2007  Peter Johnson 
 * 
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted provided that the following conditions 
 * are met: 
 * 1. Redistributions of source code must retain the above copyright 
 *    notice, this list of conditions and the following disclaimer. 
 * 2. Redistributions in binary form must reproduce the above copyright 
 *    notice, this list of conditions and the following disclaimer in the 
 *    documentation and/or other materials provided with the distribution. 
 * 
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' 
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE 
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 * POSSIBILITY OF SUCH DAMAGE. 
 */ 
#ifndef YASM_DWARF2_DBGFMT_H 
#define YASM_DWARF2_DBGFMT_H 
 
#define WITH_DWARF3 1 
 
typedef struct { 
    char *pathname;         /* full filename */ 
    char *filename;         /* basename of full filename */ 
    unsigned long dir;      /* index into directories array for relative path; 
                             * 0 for current directory. */ 
} dwarf2_filename; 
 
/* Global data */ 
typedef struct yasm_dbgfmt_dwarf2 { 
    yasm_dbgfmt_base dbgfmt;        /* base structure */ 
 
    char **dirs; 
    unsigned long dirs_size; 
    unsigned long dirs_allocated; 
 
    dwarf2_filename *filenames; 
    unsigned long filenames_size; 
    unsigned long filenames_allocated; 
 
    enum { 
        DWARF2_FORMAT_32BIT, 
        DWARF2_FORMAT_64BIT 
    } format; 
 
    unsigned int sizeof_address, sizeof_offset, min_insn_len; 
} yasm_dbgfmt_dwarf2; 
 
/* .loc directive data */ 
typedef struct dwarf2_loc { 
    /*@reldef@*/ STAILQ_ENTRY(dwarf2_loc) link; 
 
    unsigned long vline;    /* virtual line number of .loc directive */ 
 
    /* source information */ 
    unsigned long file;     /* index into table of filenames */ 
    unsigned long line;     /* source line number */ 
    unsigned long column;   /* source column */ 
    unsigned long discriminator; 
    int isa_change; 
    unsigned long isa; 
    enum { 
        IS_STMT_NOCHANGE = 0, 
        IS_STMT_SET, 
        IS_STMT_CLEAR 
    } is_stmt; 
    int basic_block; 
    int prologue_end; 
    int epilogue_begin; 
 
    yasm_bytecode *bc;      /* first bytecode following */ 
    yasm_symrec *sym;       /* last symbol preceding */ 
} dwarf2_loc; 
 
/* Per-section data */ 
typedef struct dwarf2_section_data { 
    /* The locations set by the .loc directives in this section, in assembly 
     * source order. 
     */ 
    /*@reldef@*/ STAILQ_HEAD(dwarf2_lochead, dwarf2_loc) locs; 
} dwarf2_section_data; 
 
extern const yasm_assoc_data_callback yasm_dwarf2__section_data_cb; 
 
yasm_bytecode *yasm_dwarf2__append_bc(yasm_section *sect, yasm_bytecode *bc); 
 
/*@dependent@*/ yasm_symrec *yasm_dwarf2__bc_sym(yasm_symtab *symtab, 
                                                 yasm_bytecode *bc); 
 
typedef struct dwarf2_head dwarf2_head; 
dwarf2_head *yasm_dwarf2__add_head 
    (yasm_dbgfmt_dwarf2 *dbgfmt_dwarf2, yasm_section *sect, 
     /*@null@*/ yasm_section *debug_ptr, int with_address, int with_segment); 
void yasm_dwarf2__set_head_end(dwarf2_head *head, yasm_bytecode *end_prevbc); 
 
/* Line number functions */ 
yasm_section *yasm_dwarf2__generate_line 
    (yasm_object *object, yasm_linemap *linemap, yasm_errwarns *errwarns, 
     int asm_source, /*@out@*/ yasm_section **main_code, 
     /*@out@*/ size_t *num_line_sections); 
void yasm_dwarf2__dir_loc(yasm_object *object, yasm_valparamhead *valparams, 
                          yasm_valparamhead *objext_valparams, 
                          unsigned long line); 
void yasm_dwarf2__dir_file(yasm_object *object, yasm_valparamhead *valparams, 
                           yasm_valparamhead *objext_valparams, 
                           unsigned long line); 
 
/* Address range table functions */ 
yasm_section *yasm_dwarf2__generate_aranges(yasm_object *object, 
                                            yasm_section *debug_info); 
 
/* Name lookup table functions */ 
yasm_section *yasm_dwarf2__generate_pubnames(yasm_object *object, 
                                             yasm_section *debug_info); 
 
/* Information functions */ 
yasm_section *yasm_dwarf2__generate_info 
    (yasm_object *object, yasm_section *debug_line, 
     /*@null@*/ yasm_section *main_code); 
 
#endif