aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/arm/disassembler/load_symbol_map.cpp
blob: 13d26d17093e7c8a2dfc67d3d41d0b93e48108d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2014 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

#include <string>
#include <vector>

#include "common/symbols.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;

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