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

Subversion Repositories fwrisc

[/] [fwrisc/] [trunk/] [ve/] [fwrisc/] [tests/] [ElfSymtabReader.h] - Rev 2

Compare with Previous | Blame | View Log

/*
 * ElfSymtabReader.h
 *
 * Copyright 2018 Matthew Ballance
 *
 * Licensed under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in
 * compliance with the License.  You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in
 * writing, software distributed under the License is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied.  See
 * the License for the specific language governing
 * permissions and limitations under the License.
 *
 *  Created on: Nov 17, 2018
 *      Author: ballance
 */
 
#ifndef INCLUDED_ELF_SYMTAB_READER_H
#define INCLUDED_ELF_SYMTAB_READER_H
#include "ElfFileReader.h"
#include <stdint.h>
#include <string>
#include <map>
#include <vector>
 
class ElfSymtabReader : public ElfFileReader {
public:
	ElfSymtabReader();
 
	virtual ~ElfSymtabReader();
 
	Elf32_Sym find_sym(const std::string &name);
 
	bool find_sym(Elf32_Addr addr, std::string &name);
 
	int32_t find_sym(Elf32_Addr addr);
 
	const Elf32_Sym &get_sym(int32_t idx);
 
	const std::string &get_sym_name(int32_t idx);
 
	uint32_t n_syms() const { return m_symlist.size(); }
 
protected:
 
	virtual void visit_shdr(const Elf32_Shdr &shdr);
 
 
private:
	std::map<std::string, Elf32_Sym> 					m_symtab;
	std::map<Elf32_Addr, uint32_t>						m_addrtab;
	std::vector<std::pair<Elf32_Sym, std::string>>		m_symlist;
 
};
 
#endif /* INCLUDED_ELF_SYMTAB_READER_H */
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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