aboutsummaryrefslogtreecommitdiff
path: root/includes/trygvis/elfinfo/Ld.h
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2016-07-26 21:17:20 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2016-07-26 21:17:20 +0200
commit4d8b6e0ceeb9c8df06decf33b83781adc00cbead (patch)
tree8adb7fffd5f609a7549f2cf21eca7803d8c1a326 /includes/trygvis/elfinfo/Ld.h
parentea58b3887a7deba05e3fc85eb536038a547f8871 (diff)
downloadelfinfo-4d8b6e0ceeb9c8df06decf33b83781adc00cbead.tar.gz
elfinfo-4d8b6e0ceeb9c8df06decf33b83781adc00cbead.tar.bz2
elfinfo-4d8b6e0ceeb9c8df06decf33b83781adc00cbead.tar.xz
elfinfo-4d8b6e0ceeb9c8df06decf33b83781adc00cbead.zip
cleaning.HEADmaster
Diffstat (limited to 'includes/trygvis/elfinfo/Ld.h')
-rw-r--r--includes/trygvis/elfinfo/Ld.h84
1 files changed, 0 insertions, 84 deletions
diff --git a/includes/trygvis/elfinfo/Ld.h b/includes/trygvis/elfinfo/Ld.h
deleted file mode 100644
index 03559a2..0000000
--- a/includes/trygvis/elfinfo/Ld.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#pragma once
-
-#include <string>
-#include <set>
-#include <vector>
-#include <sstream>
-
-namespace trygvis {
-namespace elfinfo {
-
-class LdParseException : public std::runtime_error {
-public:
- explicit LdParseException(const std::vector<std::string> &messages) :
- runtime_error("Parse error"), messages(messages) {}
-
- const std::vector<std::string> messages;
-};
-
-class LdInternalErrorException : public std::runtime_error {
-public:
- explicit LdInternalErrorException(const std::string &what) : runtime_error(what) {}
-};
-
-enum class MemoryAttribute {
- R, W, X
-};
-
-static char to_str(const MemoryAttribute &type) {
- switch (type) {
- case MemoryAttribute::R:
- return 'r';
- case MemoryAttribute::W:
- return 'w';
- case MemoryAttribute::X:
- return 'x';
- }
-}
-
-struct Section {
- std::string name;
-};
-
-struct MemoryArea {
- std::string name;
- uint64_t origin;
- uint64_t length;
- std::set<MemoryAttribute> attributes;
-
- bool contains(uint64_t address, uint64_t size) const {
- return contains(address) && contains(address + size);
- }
-
- bool contains(uint64_t address) const {
- return origin <= address && address < origin + length;
- }
-
- std::string attributes_string() const {
- char buf[4];
- buf[0] = attributes.find(MemoryAttribute::R) == attributes.end() ? '-' : 'r';
- buf[1] = attributes.find(MemoryAttribute::W) == attributes.end() ? '-' : 'w';
- buf[2] = attributes.find(MemoryAttribute::X) == attributes.end() ? '-' : 'x';
- buf[3] = '\0';
- return std::string(buf);
- }
-};
-
-struct LdScript {
- std::vector<MemoryArea> memoryAreas;
-};
-
-class LdScriptLoader {
-public:
- LdScriptLoader();
-
- LdScript load(std::string path);
-
- void setDebug(bool debug);
-
-private:
- bool debug_;
-};
-
-} // namespace elfinfo
-} // namespace trygvis