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

Subversion Repositories fwrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mballance
/*
2
 * ElfFileReader.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_FILE_READER_H
25
#define INCLUDED_ELF_FILE_READER_H
26
#include <string>
27
#include <elf.h>
28
 
29
class ElfFileReader {
30
public:
31
        ElfFileReader();
32
 
33
        virtual ~ElfFileReader();
34
 
35
        virtual bool read(const std::string &path);
36
 
37
protected:
38
 
39
        virtual void visit_shdr(const Elf32_Shdr &shdr) { }
40
 
41
        virtual void read(uint32_t off, void *dst, uint32_t sz);
42
 
43
        virtual const Elf32_Ehdr &hdr() const { return m_hdr; }
44
 
45
private:
46
        FILE                                    *m_fp;
47
        Elf32_Ehdr                              m_hdr;
48
};
49
 
50
#endif /* INCLUDED_ELF_FILE_READER_H */
51
 

powered by: WebSVN 2.1.0

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