diff options
Diffstat (limited to 'base')
-rw-r--r-- | base/loader/aout_object.cc | 9 | ||||
-rw-r--r-- | base/loader/aout_object.hh | 3 | ||||
-rw-r--r-- | base/loader/ecoff_object.cc | 8 | ||||
-rw-r--r-- | base/loader/ecoff_object.hh | 3 | ||||
-rw-r--r-- | base/loader/elf_object.cc | 10 | ||||
-rw-r--r-- | base/loader/elf_object.hh | 3 | ||||
-rw-r--r-- | base/loader/object_file.cc | 6 | ||||
-rw-r--r-- | base/loader/object_file.hh | 22 | ||||
-rw-r--r-- | base/remote_gdb.cc | 6 |
9 files changed, 51 insertions, 19 deletions
diff --git a/base/loader/aout_object.cc b/base/loader/aout_object.cc index 0270e02a3..42a376ed1 100644 --- a/base/loader/aout_object.cc +++ b/base/loader/aout_object.cc @@ -43,7 +43,9 @@ ObjectFile * AoutObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data) { if (!N_BADMAG(*(aout_exechdr *)data)) { - return new AoutObject(fname, fd, len, data); + // right now this is only used for Alpha PAL code + return new AoutObject(fname, fd, len, data, + ObjectFile::Alpha, ObjectFile::UnknownOpSys); } else { return NULL; @@ -52,8 +54,9 @@ AoutObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data) AoutObject::AoutObject(const string &_filename, int _fd, - size_t _len, uint8_t *_data) - : ObjectFile(_filename, _fd, _len, _data) + size_t _len, uint8_t *_data, + Arch _arch, OpSys _opSys) + : ObjectFile(_filename, _fd, _len, _data, _arch, _opSys) { execHdr = (aout_exechdr *)fileData; diff --git a/base/loader/aout_object.hh b/base/loader/aout_object.hh index 77c59aef6..9fb8cb3e8 100644 --- a/base/loader/aout_object.hh +++ b/base/loader/aout_object.hh @@ -40,7 +40,8 @@ class AoutObject : public ObjectFile aout_exechdr *execHdr; AoutObject(const std::string &_filename, int _fd, - size_t _len, uint8_t *_data); + size_t _len, uint8_t *_data, + Arch _arch, OpSys _opSys); public: virtual ~AoutObject() {} diff --git a/base/loader/ecoff_object.cc b/base/loader/ecoff_object.cc index 5e726a1c5..bab75944d 100644 --- a/base/loader/ecoff_object.cc +++ b/base/loader/ecoff_object.cc @@ -46,7 +46,8 @@ EcoffObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data) { if (((ecoff_filehdr *)data)->f_magic == ECOFF_MAGIC_ALPHA) { // it's Alpha ECOFF - return new EcoffObject(fname, fd, len, data); + return new EcoffObject(fname, fd, len, data, + ObjectFile::Alpha, ObjectFile::Tru64); } else { return NULL; @@ -55,8 +56,9 @@ EcoffObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data) EcoffObject::EcoffObject(const string &_filename, int _fd, - size_t _len, uint8_t *_data) - : ObjectFile(_filename, _fd, _len, _data) + size_t _len, uint8_t *_data, + Arch _arch, OpSys _opSys) + : ObjectFile(_filename, _fd, _len, _data, _arch, _opSys) { execHdr = (ecoff_exechdr *)fileData; fileHdr = &(execHdr->f); diff --git a/base/loader/ecoff_object.hh b/base/loader/ecoff_object.hh index 94b11c720..05d026d00 100644 --- a/base/loader/ecoff_object.hh +++ b/base/loader/ecoff_object.hh @@ -44,7 +44,8 @@ class EcoffObject : public ObjectFile ecoff_aouthdr *aoutHdr; EcoffObject(const std::string &_filename, int _fd, - size_t _len, uint8_t *_data); + size_t _len, uint8_t *_data, + Arch _arch, OpSys _opSys); public: virtual ~EcoffObject() {} diff --git a/base/loader/elf_object.cc b/base/loader/elf_object.cc index 605895c9c..30dec4c91 100644 --- a/base/loader/elf_object.cc +++ b/base/loader/elf_object.cc @@ -43,8 +43,9 @@ ObjectFile * ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data) { if (memcmp(((Elf64_Ehdr *)data)->e_ident, ELFMAG, SELFMAG) == 0) { - // for now we'll assume it's a 64-bit Alpha binary - return new ElfObject(fname, fd, len, data); + // for now we'll assume it's a 64-bit Alpha Linux binary + return new ElfObject(fname, fd, len, data, + ObjectFile::Alpha, ObjectFile::Linux); } else { return NULL; @@ -53,8 +54,9 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data) ElfObject::ElfObject(const string &_filename, int _fd, - size_t _len, uint8_t *_data) - : ObjectFile(_filename, _fd, _len, _data) + size_t _len, uint8_t *_data, + Arch _arch, OpSys _opSys) + : ObjectFile(_filename, _fd, _len, _data, _arch, _opSys) { ehdr = (Elf64_Ehdr *)fileData; diff --git a/base/loader/elf_object.hh b/base/loader/elf_object.hh index 28f6bb243..10d97d089 100644 --- a/base/loader/elf_object.hh +++ b/base/loader/elf_object.hh @@ -45,7 +45,8 @@ class ElfObject : public ObjectFile int dataPhdrIdx; ElfObject(const std::string &_filename, int _fd, - size_t _len, uint8_t *_data); + size_t _len, uint8_t *_data, + Arch _arch, OpSys _opSys); public: virtual ~ElfObject() {} diff --git a/base/loader/object_file.cc b/base/loader/object_file.cc index 5a13d180c..25e9b2d19 100644 --- a/base/loader/object_file.cc +++ b/base/loader/object_file.cc @@ -46,8 +46,10 @@ using namespace std; ObjectFile::ObjectFile(const string &_filename, int _fd, - size_t _len, uint8_t *_data) - : filename(_filename), descriptor(_fd), fileData(_data), len(_len) + size_t _len, uint8_t *_data, + Arch _arch, OpSys _opSys) + : filename(_filename), descriptor(_fd), fileData(_data), len(_len), + arch(_arch), opSys(_opSys) { } diff --git a/base/loader/object_file.hh b/base/loader/object_file.hh index 5950ea326..a29bdc153 100644 --- a/base/loader/object_file.hh +++ b/base/loader/object_file.hh @@ -36,14 +36,31 @@ class SymbolTable; class ObjectFile { + public: + + enum Arch { + UnknownArch, + Alpha + }; + + enum OpSys { + UnknownOpSys, + Tru64, + Linux + }; + protected: const std::string filename; int descriptor; uint8_t *fileData; size_t len; + Arch arch; + OpSys opSys; + ObjectFile(const std::string &_filename, int _fd, - size_t _len, uint8_t *_data); + size_t _len, uint8_t *_data, + Arch _arch, OpSys _opSys); public: virtual ~ObjectFile(); @@ -55,6 +72,9 @@ class ObjectFile virtual bool loadGlobalSymbols(SymbolTable *symtab) = 0; virtual bool loadLocalSymbols(SymbolTable *symtab) = 0; + Arch getArch() const { return arch; } + OpSys getOpSys() const { return opSys; } + protected: struct Section { diff --git a/base/remote_gdb.cc b/base/remote_gdb.cc index 6f9b35e8b..35a90073a 100644 --- a/base/remote_gdb.cc +++ b/base/remote_gdb.cc @@ -222,9 +222,6 @@ RemoteGDB::RemoteGDB(System *_system, ExecContext *c) : event(NULL), fd(-1), active(false), attached(false), system(_system), pmem(_system->physmem), context(c) { -#ifdef DEBUG - theDebugger = this; -#endif memset(gdbregs, 0, sizeof(gdbregs)); } @@ -248,6 +245,9 @@ RemoteGDB::attach(int f) attached = true; DPRINTFN("remote gdb attached\n"); +#ifdef DEBUG + theDebugger = this; +#endif } void |