diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/core/arm/disassembler/load_symbol_map.cpp | 33 | ||||
-rw-r--r-- | src/core/arm/disassembler/load_symbol_map.h | 13 | ||||
-rw-r--r-- | src/core/core.vcxproj | 2 | ||||
-rw-r--r-- | src/core/core.vcxproj.filters | 6 |
5 files changed, 55 insertions, 0 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 314f6e64c..3308f3c25 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -5,6 +5,7 @@ set(SRCS core.cpp mem_map_funcs.cpp system.cpp arm/disassembler/arm_disasm.cpp + arm/disassembler/load_symbol_map.cpp arm/interpreter/arm_interpreter.cpp arm/interpreter/armemu.cpp arm/interpreter/arminit.cpp 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 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include <string> +#include <vector> + +#include "common/symbols.h" +#include "common/common_types.h" +#include "common/file_util.h" + +#include "core/arm/disassembler/load_symbol_map.h" + +/* + * Loads a symbol map file for use with the disassembler + * @param filename String filename path of symbol map file + */ +void LoadSymbolMap(std::string filename) { + std::ifstream infile(filename); + + std::string address_str, function_name, line; + u32 size, address; + + while (std::getline(infile, line)) { + std::istringstream iss(line); + if (!(iss >> address_str >> size >> function_name)) { + break; // Error parsing + } + u32 address = std::stoul(address_str, nullptr, 16); + + Symbols::Add(address, function_name, size, 2); + } +} 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 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include <string> + +/* + * Loads a symbol map file for use with the disassembler + * @param filename String filename path of symbol map file + */ +void LoadSymbolMap(std::string filename); diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj index be8448969..a5043ea4b 100644 --- a/src/core/core.vcxproj +++ b/src/core/core.vcxproj @@ -138,6 +138,7 @@ </ItemGroup> <ItemGroup> <ClCompile Include="arm\disassembler\arm_disasm.cpp" /> + <ClCompile Include="arm\disassembler\load_symbol_map.cpp" /> <ClCompile Include="arm\interpreter\armemu.cpp" /> <ClCompile Include="arm\interpreter\arminit.cpp" /> <ClCompile Include="arm\interpreter\armmmu.cpp" /> @@ -171,6 +172,7 @@ <ItemGroup> <ClInclude Include="arm\arm_interface.h" /> <ClInclude Include="arm\disassembler\arm_disasm.h" /> + <ClInclude Include="arm\disassembler\load_symbol_map.h" /> <ClInclude Include="arm\interpreter\armcpu.h" /> <ClInclude Include="arm\interpreter\armdefs.h" /> <ClInclude Include="arm\interpreter\armemu.h" /> diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filters index b5473bc41..9c53f9eff 100644 --- a/src/core/core.vcxproj.filters +++ b/src/core/core.vcxproj.filters @@ -108,6 +108,9 @@ <ClCompile Include="hle\mrc.cpp"> <Filter>hle</Filter> </ClCompile> + <ClCompile Include="arm\disassembler\load_symbol_map.cpp"> + <Filter>arm\disassembler</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="arm\disassembler\arm_disasm.h"> @@ -211,6 +214,9 @@ <ClInclude Include="hle\mrc.h"> <Filter>hle</Filter> </ClInclude> + <ClInclude Include="arm\disassembler\load_symbol_map.h"> + <Filter>arm\disassembler</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <Text Include="CMakeLists.txt" /> |