source: soft/giet_vm/memo/include/libelfpp/elfpp/elfpp_section.hxx @ 378

Last change on this file since 378 was 173, checked in by karaoui, 12 years ago

Adding BLOB type for vobj.
Don't forget to set as BLOB type the mapping_info vobj in the xml.

File size: 2.9 KB
Line 
1/*
2    This file is part of Libelfpp.
3
4    Libelfpp is free software: you can redistribute it and/or modify
5    it under the terms of the GNU Lesser General Public License as
6    published by the Free Software Foundation, either version 3 of the
7    License, or (at your option) any later version.
8
9    Libelfpp is distributed in the hope that it will be useful, but
10    WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    General Public License for more details.
13
14    You should have received a copy of the GNU Lesser General Public
15    License along with Libelfpp.  If not, see
16    <http://www.gnu.org/licenses/>.
17
18   Copyright (c) Alexandre Becoulet <alexandre.becoulet@free.fr>
19*/
20
21#ifndef ELFPP_SECTION_HXX_
22#define ELFPP_SECTION_HXX_
23
24#include <stdexcept>
25
26
27namespace elfpp
28{
29
30  void section::set_name(const std::string &name)
31  {
32    name_ = name;
33  }
34
35  const std::string & section::get_name() const
36  {
37    return name_;
38  }
39
40  sh_type_e section::get_type() const
41  {
42    return type_;
43  }
44
45  void section::set_flags(sh_flags_e flags)
46  {
47    flags_ = flags;
48  }
49
50  sh_flags_e section::get_flags() const
51  {
52    return flags_;
53  }
54
55  void section::set_vaddr(uint64_t vaddr)
56  {
57    vaddr_ = vaddr;
58  }
59
60  uint64_t section::get_vaddr() const
61  {
62    return vaddr_;
63  }
64
65  size_t section::get_size() const
66  {
67    return size_;
68  }
69
70  void section::set_align(uint32_t align)
71  {
72    align_ = align;
73  }
74
75  uint32_t section::get_align() const
76  {
77    return align_;
78  }
79
80  void section::set_link(section *s)
81  {
82    link_ = s;
83    s->back_info_ = this;
84  }
85
86  section * section::get_link() const
87  {
88    return link_;
89  }
90
91  section * section::get_back_link() const
92  {
93    return back_link_;
94  }
95
96  void section::set_info(section *s)
97  {
98    info_ = s;
99    if (s)
100      s->back_info_ = this;
101  }
102
103  section * section::get_info() const
104  {
105    return info_;
106  }
107
108  section * section::get_back_info() const
109  {
110    return back_info_;
111  }
112
113  void section::set_info_last(unsigned int last)
114  {
115    info_last_ = last;
116  }
117
118  unsigned int section::get_info_last()
119  {
120    return info_last_;
121  }
122
123  void section::set_entsize(uint32_t entsize)
124  {
125    entsize_ = entsize;
126  }
127
128  uint32_t section::get_entsize() const
129  {
130    return entsize_;
131  }
132 
133  uint8_t * section::get_content() const
134  {
135    return content_;
136  }
137
138  off_t section::get_file_offset() const
139  {
140    return offset_;
141  }
142
143  void section::set_file_offset(off_t a)
144  {
145    offset_ = a;
146  }
147
148  const sym_tab_map_t & section::get_symbol_table() const
149  {
150    return sym_tab_;
151  }
152
153  symbol & section::get_symbol(const std::string &name)
154  {
155    sym_tab_map_t::iterator i = sym_tab_.find(name);
156
157    if (i == sym_tab_.end())
158      throw std::runtime_error("no such symbol name");
159
160    return *i->second;
161  }
162
163  object * section::get_object() const
164  {
165    return object_;
166  }
167
168}
169
170#endif
171
Note: See TracBrowser for help on using the repository browser.