summaryrefslogtreecommitdiff
path: root/dwarfgen/irepline.h
blob: 88c3e07da0aafc44faec561bddb19d5b1433da25 (plain)
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
#ifndef IREPLINE_H
#define IREPLINE_H
/*
  Copyright (C) 2011 David Anderson.  

  This program is free software; you can redistribute it and/or modify it
  under the terms of version 2 of the GNU General Public License as
  published by the Free Software Foundation.

  This program is distributed in the hope that it would be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

  You should have received a copy of the GNU General Public License along
  with this program; if not, write the Free Software Foundation, Inc., 51
  Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.

*/

// 
// irepline.h
//

class IRCULine {
public:
    IRCULine(Dwarf_Addr addr,Dwarf_Bool isset,
        Dwarf_Unsigned fileno,
        Dwarf_Unsigned lineno,
        Dwarf_Unsigned linecol,
        const std::string & linename,
        Dwarf_Bool is_stmt,
        Dwarf_Bool bb,
        Dwarf_Bool endseq,
        Dwarf_Bool prol_end,
        Dwarf_Bool epil_beg,
        Dwarf_Unsigned isa,
        Dwarf_Unsigned discrim):
        address_(addr),
        isaddrset_(isset),
        srcfileno_(fileno),
        lineno_(lineno),
        linecol_(linecol),
        linesrc_(linename),
        is_stmt_(is_stmt),
        basic_block_(bb),
        end_sequence_(endseq),
        prologue_end_(prol_end),
        epilogue_begin_(epil_beg),
        isa_(isa),
        discriminator_(discrim)
        {};
    const std::string &getpath() { return linesrc_; };
    Dwarf_Addr getaddr() { return address_;};
    bool getaddrset() { return isaddrset_;};
    bool getendsequence() { return end_sequence_; };
    Dwarf_Unsigned getlineno() { return lineno_; };
    Dwarf_Unsigned getlinecol() { return linecol_; };
    bool getisstmt() { return is_stmt_; };
    bool getisblock() { return basic_block_; };
    bool getepiloguebegin() { return epilogue_begin_; };
    bool getprologueend() { return prologue_end_; };
    Dwarf_Unsigned getisa() { return isa_; };
    Dwarf_Unsigned getdiscriminator() { return discriminator_; };
    ~IRCULine() {};
private:

    // Names taken from the DWARF4 std. document, sec 6.2.2.
    Dwarf_Addr address_;
    bool isaddrset_;
    Dwarf_Unsigned srcfileno_;
    Dwarf_Unsigned lineno_;
    Dwarf_Signed   linecol_; // aka lineoff
    std::string    linesrc_; // Name for the file, constructed by libdwarf.
    bool           is_stmt_;
    bool           basic_block_;
    bool           end_sequence_;
    bool           prologue_end_;
    bool           epilogue_begin_;
    int            isa_;
    int            discriminator_;
};
class IRCUSrcfile {
public:
    IRCUSrcfile(std::string file): cusrcfile_(file) {};
    ~IRCUSrcfile() {};
    std::string &getfilepath() {return cusrcfile_;};
private:
    std::string cusrcfile_;
};

class IRCULineData {
public:
    IRCULineData() {};
    ~IRCULineData() {};
    std::vector<IRCULine> &get_cu_lines() { return culinedata_; };
    std::vector<IRCUSrcfile> &get_cu_srcfiles() { return cusrcfiledata_; };
private:
    std::vector<IRCUSrcfile> cusrcfiledata_;
    std::vector<IRCULine> culinedata_;
};
#endif // IREPLINE_H