OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef LIBRARY_H__ | 5 #ifndef LIBRARY_H__ |
6 #define LIBRARY_H__ | 6 #define LIBRARY_H__ |
7 | 7 |
8 #include <elf.h> | 8 #include <elf.h> |
9 #include <functional> | 9 #include <functional> |
10 #include <map> | 10 #include <map> |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 return false; | 119 return false; |
120 } | 120 } |
121 *reinterpret_cast<T *>( | 121 *reinterpret_cast<T *>( |
122 reinterpret_cast<char *>(iter->second.start) + offset) = *value; | 122 reinterpret_cast<char *>(iter->second.start) + offset) = *value; |
123 return true; | 123 return true; |
124 } | 124 } |
125 | 125 |
126 bool parseElf(); | 126 bool parseElf(); |
127 const Elf_Ehdr* getEhdr(); | 127 const Elf_Ehdr* getEhdr(); |
128 const Elf_Shdr* getSection(const string& section); | 128 const Elf_Shdr* getSection(const string& section); |
129 const int getSectionIndex(const string& section); | 129 int getSectionIndex(const string& section); |
130 void makeWritable(bool state) const; | 130 void makeWritable(bool state) const; |
131 void patchSystemCalls(); | 131 void patchSystemCalls(); |
132 bool isVDSO() const { return isVDSO_; } | 132 bool isVDSO() const { return isVDSO_; } |
133 | 133 |
134 protected: | 134 protected: |
135 bool parseSymbols(); | 135 bool parseSymbols(); |
136 | 136 |
137 private: | 137 private: |
138 class GreaterThan : public std::binary_function<Elf_Addr, Elf_Addr, bool> { | 138 class GreaterThan : public std::binary_function<Elf_Addr, Elf_Addr, bool> { |
139 // We create the RangeMap with a GreaterThan rather than the default | 139 // We create the RangeMap with a GreaterThan rather than the default |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 char* image_; | 190 char* image_; |
191 size_t image_size_; | 191 size_t image_size_; |
192 static char* __kernel_vsyscall; | 192 static char* __kernel_vsyscall; |
193 static char* __kernel_sigreturn; | 193 static char* __kernel_sigreturn; |
194 static char* __kernel_rt_sigreturn; | 194 static char* __kernel_rt_sigreturn; |
195 }; | 195 }; |
196 | 196 |
197 } // namespace | 197 } // namespace |
198 | 198 |
199 #endif // LIBRARY_H__ | 199 #endif // LIBRARY_H__ |
OLD | NEW |