OpenCores
URL https://opencores.org/ocsvn/fwrisc/fwrisc/trunk

Subversion Repositories fwrisc

[/] [fwrisc/] [trunk/] [ve/] [fwrisc/] [tests/] [ElfSymtabReader.h] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mballance
/*
2
 * ElfSymtabReader.h
3
 *
4
 * Copyright 2018 Matthew Ballance
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the
7
 * "License"); you may not use this file except in
8
 * compliance with the License.  You may obtain a copy of
9
 * the License at
10
 *
11
 * http://www.apache.org/licenses/LICENSE-2.0
12
 *
13
 * Unless required by applicable law or agreed to in
14
 * writing, software distributed under the License is
15
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
16
 * CONDITIONS OF ANY KIND, either express or implied.  See
17
 * the License for the specific language governing
18
 * permissions and limitations under the License.
19
 *
20
 *  Created on: Nov 17, 2018
21
 *      Author: ballance
22
 */
23
 
24
#ifndef INCLUDED_ELF_SYMTAB_READER_H
25
#define INCLUDED_ELF_SYMTAB_READER_H
26
#include "ElfFileReader.h"
27
#include <stdint.h>
28
#include <string>
29
#include <map>
30
#include <vector>
31
 
32
class ElfSymtabReader : public ElfFileReader {
33
public:
34
        ElfSymtabReader();
35
 
36
        virtual ~ElfSymtabReader();
37
 
38
        Elf32_Sym find_sym(const std::string &name);
39
 
40
        bool find_sym(Elf32_Addr addr, std::string &name);
41
 
42
        int32_t find_sym(Elf32_Addr addr);
43
 
44
        const Elf32_Sym &get_sym(int32_t idx);
45
 
46
        const std::string &get_sym_name(int32_t idx);
47
 
48
        uint32_t n_syms() const { return m_symlist.size(); }
49
 
50
protected:
51
 
52
        virtual void visit_shdr(const Elf32_Shdr &shdr);
53
 
54
 
55
private:
56
        std::map<std::string, Elf32_Sym>                                        m_symtab;
57
        std::map<Elf32_Addr, uint32_t>                                          m_addrtab;
58
        std::vector<std::pair<Elf32_Sym, std::string>>          m_symlist;
59
 
60
};
61
 
62
#endif /* INCLUDED_ELF_SYMTAB_READER_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.