Bug fix: check if vm exists
[avr-sim.git] / BfdProgram.h
blob0132893e4c052cc0ace84c6ab0cf65c97260b485
1 #ifndef AVR_BFDPROGRAM_H
2 #define AVR_BFDPROGRAM_H
4 #ifdef HAVE_BFD
6 #include "Program.h"
8 struct bfd;
9 struct bfd_section;
11 namespace avr {
13 class BfdProgram : public Program {
14 public:
15 BfdProgram();
16 BfdProgram(const char *filename);
17 ~BfdProgram();
19 public:
20 void load(const char * filename);
21 bool readNextSection(Section & sec) const;
22 const std::string & functionName(int addr) const;
24 private:
25 void loadSymbols();
27 private:
28 bfd *abfd;
29 mutable bfd_section *sec;
32 inline BfdProgram::BfdProgram() : abfd(0), sec(0) {}
33 inline BfdProgram::BfdProgram(const char *filename) : abfd(0), sec(0) {
34 load( filename );
38 #endif
40 #endif /*AVR_BFDPROGRAM_H*/