added a module to load symbol map files for debugging

This commit is contained in:
bunnei 2014-04-30 23:46:06 -04:00
parent 924e7b6af8
commit 29da6e9ab5
5 changed files with 55 additions and 0 deletions

View file

@ -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

View file

@ -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);
}
}

View file

@ -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);

View file

@ -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" />

View file

@ -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" />