load_symbol_map.cpp 857 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2014 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include <string>
  5. #include <vector>
  6. #include "common/symbols.h"
  7. #include "common/file_util.h"
  8. #include "core/arm/disassembler/load_symbol_map.h"
  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) {
  14. std::ifstream infile(filename);
  15. std::string address_str, function_name, line;
  16. u32 size;
  17. while (std::getline(infile, line)) {
  18. std::istringstream iss(line);
  19. if (!(iss >> address_str >> size >> function_name)) {
  20. break; // Error parsing
  21. }
  22. u32 address = std::stoul(address_str, nullptr, 16);
  23. Symbols::Add(address, function_name, size, 2);
  24. }
  25. }