diff options
Diffstat (limited to 'src/core/arm/disassembler')
| -rw-r--r-- | src/core/arm/disassembler/load_symbol_map.cpp | 33 | ||||
| -rw-r--r-- | src/core/arm/disassembler/load_symbol_map.h | 13 |
2 files changed, 46 insertions, 0 deletions
diff --git a/src/core/arm/disassembler/load_symbol_map.cpp b/src/core/arm/disassembler/load_symbol_map.cpp new file mode 100644 index 000000000..d7fc0a042 --- /dev/null +++ b/src/core/arm/disassembler/load_symbol_map.cpp | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <string> | ||
| 6 | #include <vector> | ||
| 7 | |||
| 8 | #include "common/symbols.h" | ||
| 9 | #include "common/common_types.h" | ||
| 10 | #include "common/file_util.h" | ||
| 11 | |||
| 12 | #include "core/arm/disassembler/load_symbol_map.h" | ||
| 13 | |||
| 14 | /* | ||
| 15 | * Loads a symbol map file for use with the disassembler | ||
| 16 | * @param filename String filename path of symbol map file | ||
| 17 | */ | ||
| 18 | void LoadSymbolMap(std::string filename) { | ||
| 19 | std::ifstream infile(filename); | ||
| 20 | |||
| 21 | std::string address_str, function_name, line; | ||
| 22 | u32 size, address; | ||
| 23 | |||
| 24 | while (std::getline(infile, line)) { | ||
| 25 | std::istringstream iss(line); | ||
| 26 | if (!(iss >> address_str >> size >> function_name)) { | ||
| 27 | break; // Error parsing | ||
| 28 | } | ||
| 29 | u32 address = std::stoul(address_str, nullptr, 16); | ||
| 30 | |||
| 31 | Symbols::Add(address, function_name, size, 2); | ||
| 32 | } | ||
| 33 | } | ||
diff --git a/src/core/arm/disassembler/load_symbol_map.h b/src/core/arm/disassembler/load_symbol_map.h new file mode 100644 index 000000000..837cca99b --- /dev/null +++ b/src/core/arm/disassembler/load_symbol_map.h | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <string> | ||
| 8 | |||
| 9 | /* | ||
| 10 | * Loads a symbol map file for use with the disassembler | ||
| 11 | * @param filename String filename path of symbol map file | ||
| 12 | */ | ||
| 13 | void LoadSymbolMap(std::string filename); | ||