Debian Codegraph @

src/bin/dwarfgen/ireppubnames.h

raw
1 /*
2 Copyright (C) 2010-2018 David Anderson. All rights reserved.
3
4 Redistribution and use in source and binary forms, with
5 or without modification, are permitted provided that the
6 following conditions are met:
7 * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following
9 disclaimer.
10 * Redistributions in binary form must reproduce the
11 above copyright
12 notice, this list of conditions and the following
13 disclaimer in the documentation and/or other materials
14 provided with the distribution.
15 * Neither the name of the example nor the
16 names of its contributors may be used to endorse or
17 promote products derived from this software without
18 specific prior written permission.
19
20 THIS SOFTWARE IS PROVIDED BY David Anderson ''AS IS''
21 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
22 NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
23 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
24 NO EVENT SHALL David Anderson BE LIABLE FOR ANY DIRECT,
25 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27 OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34 */
35
36 //
37 // ireppubnames.h
38 //
39 //
40
41 class IRPub{
42 public:
43 IRPub():dieoffset_(0),cudieoffset_(0) {
44 };
45 IRPub(const std::string &name,
46 Dwarf_Unsigned dieoffset,Dwarf_Unsigned cudieoffset):
47 name_(name),dieoffset_(dieoffset),cudieoffset_(cudieoffset) {
48 };
49 IRPub(const IRPub&r) {
50 name_ = r.name_;
51 dieoffset_ = r.dieoffset_;
52 cudieoffset_ = r.cudieoffset_;
53 };
54 IRPub& operator=( const IRPub&r) {
55 if (this == &r) {
56 return *this;
57 }
58 name_ = r.name_;
59 dieoffset_ = r.dieoffset_;
60 cudieoffset_ = r.cudieoffset_;
61 return *this;
62 };
63 void setBaseData(const std::string &name,
64 Dwarf_Unsigned dieoffset,
65 Dwarf_Unsigned cudieoffset){
66 name_ = name;
67 dieoffset_ = dieoffset;
68 cudieoffset_ = cudieoffset;
69 };
70 const std::string& getName() {return name_;};
71 Dwarf_Unsigned getDieOffset() {return dieoffset_;};
72 Dwarf_Unsigned getCUdieOffset() {return cudieoffset_;}
73 private:
74 std::string name_;
75 Dwarf_Unsigned dieoffset_;
76 Dwarf_Unsigned cudieoffset_;
77 };
78
79 // For .debug_pubnames and .debug_pubtypes.
80 // By the Dwarf Std sec 6.1.1 "Lookup by Name"
81 // these names and offsets refer to the .debug_info section.
82 class IRPubsData {
83 public:
84 IRPubsData() {};
85 ~IRPubsData() {};
86 std::list<IRPub>& getPubnames() {return pubnames_; };
87 std::list<IRPub>& getPubtypes() {return pubtypes_; };
88 private:
89 std::list<IRPub> pubnames_;
90 std::list<IRPub> pubtypes_;
91 };