[haiku-commits] r39275 - haiku/trunk/src/apps/debugger/elf

Author: bonefish
Date: 2010-11-02 21:03:11 +0100 (Tue, 02 Nov 2010)
New Revision: 39275
Changeset: http://dev.haiku-os.org/changeset/39275

Modified:
   haiku/trunk/src/apps/debugger/elf/ElfFile.cpp
   haiku/trunk/src/apps/debugger/elf/ElfFile.h
Log:
Added the load address and the section flags to ElfSection.


Modified: haiku/trunk/src/apps/debugger/elf/ElfFile.cpp
===================================================================
--- haiku/trunk/src/apps/debugger/elf/ElfFile.cpp       2010-11-02 15:22:54 UTC 
(rev 39274)
+++ haiku/trunk/src/apps/debugger/elf/ElfFile.cpp       2010-11-02 20:03:11 UTC 
(rev 39275)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009, Ingo Weinhold, ingo_weinhold@xxxxxxx
+ * Copyright 2009-2010, Ingo Weinhold, ingo_weinhold@xxxxxxx
  * 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 @@
        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 @@
 
                // 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);

Modified: haiku/trunk/src/apps/debugger/elf/ElfFile.h
===================================================================
--- haiku/trunk/src/apps/debugger/elf/ElfFile.h 2010-11-02 15:22:54 UTC (rev 
39274)
+++ haiku/trunk/src/apps/debugger/elf/ElfFile.h 2010-11-02 20:03:11 UTC (rev 
39275)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009, Ingo Weinhold, ingo_weinhold@xxxxxxx
+ * Copyright 2009-2010, Ingo Weinhold, ingo_weinhold@xxxxxxx
  * Distributed under the terms of the MIT License.
  */
 #ifndef ELF_FILE_H
@@ -18,13 +18,18 @@
 class ElfSection : public DoublyLinkedListLinkImpl<ElfSection> {
 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 @@
                        off_t                           fOffset;
                        off_t                           fSize;
                        void*                           fData;
+                       target_addr_t           fLoadAddress;
+                       uint32                          fFlags;
                        int32                           fLoadCount;
 };
 


Other related posts:

  • » [haiku-commits] r39275 - haiku/trunk/src/apps/debugger/elf - ingo_weinhold