diff --git a/src/apps/debugger/elf/ElfFile.cpp b/src/apps/debugger/elf/ElfFile.cpp index 2c156bc377..efd797214d 100644 --- a/src/apps/debugger/elf/ElfFile.cpp +++ b/src/apps/debugger/elf/ElfFile.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2009-2010, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ @@ -23,13 +23,16 @@ // #pragma mark - ElfSection -ElfSection::ElfSection(const char* name, int fd, off_t offset, off_t size) +ElfSection::ElfSection(const char* name, int fd, off_t offset, off_t size, + target_addr_t loadAddress, uint32 flags) : fName(name), fFD(fd), fOffset(offset), fSize(size), fData(NULL), + fLoadAddress(loadAddress), + fFlags(flags), fLoadCount(0) { } @@ -190,7 +193,8 @@ ElfFile::Init(const char* fileName) size_t sectionStringSize = stringSectionHeader->sh_size; ElfSection* sectionStringSection = new(std::nothrow) ElfSection(".shstrtab", - fFD, stringSectionHeader->sh_offset, sectionStringSize); + fFD, stringSectionHeader->sh_offset, sectionStringSize, + stringSectionHeader->sh_addr, stringSectionHeader->sh_flags); if (sectionStringSection == NULL) return B_NO_MEMORY; fSections.Add(sectionStringSection); @@ -215,7 +219,8 @@ ElfFile::Init(const char* fileName) // create an ElfSection ElfSection* section = new(std::nothrow) ElfSection(name, fFD, - sectionHeader->sh_offset, sectionHeader->sh_size); + sectionHeader->sh_offset, sectionHeader->sh_size, + sectionHeader->sh_addr, sectionHeader->sh_flags); if (section == NULL) return B_NO_MEMORY; fSections.Add(section); diff --git a/src/apps/debugger/elf/ElfFile.h b/src/apps/debugger/elf/ElfFile.h index 186fac8800..543aa12f5e 100644 --- a/src/apps/debugger/elf/ElfFile.h +++ b/src/apps/debugger/elf/ElfFile.h @@ -1,5 +1,5 @@ /* - * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2009-2010, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ #ifndef ELF_FILE_H @@ -18,13 +18,18 @@ class ElfSection : public DoublyLinkedListLinkImpl { public: ElfSection(const char* name, int fd, - off_t offset, off_t size); + off_t offset, off_t size, + target_addr_t loadAddress, uint32 flags); ~ElfSection(); const char* Name() const { return fName; } off_t Offset() const { return fOffset; } off_t Size() const { return fSize; } const void* Data() const { return fData; } + target_addr_t LoadAddress() const + { return fLoadAddress; } + bool IsWritable() const + { return (fFlags & SHF_WRITE) != 0; } status_t Load(); void Unload(); @@ -35,6 +40,8 @@ private: off_t fOffset; off_t fSize; void* fData; + target_addr_t fLoadAddress; + uint32 fFlags; int32 fLoadCount; };