[llvm-commits] CVS: llvm/include/llvm/Reoptimizer/Inst/ElfReader.h

Joel Stanley jstanley at cs.uiuc.edu
Sun May 4 14:59:01 PDT 2003


Changes in directory llvm/include/llvm/Reoptimizer/Inst:

ElfReader.h updated: 1.7 -> 1.8

---
Log message:




---
Diffs of the changes:

Index: llvm/include/llvm/Reoptimizer/Inst/ElfReader.h
diff -u llvm/include/llvm/Reoptimizer/Inst/ElfReader.h:1.7 llvm/include/llvm/Reoptimizer/Inst/ElfReader.h:1.8
--- llvm/include/llvm/Reoptimizer/Inst/ElfReader.h:1.7	Wed Apr 30 17:51:20 2003
+++ llvm/include/llvm/Reoptimizer/Inst/ElfReader.h	Sun May  4 15:05:45 2003
@@ -2,37 +2,46 @@
 // programmer: Joel Stanley
 //       date: Fri Mar 21 16:11:07 CST 2003
 //     fileid: ElfReader.h
-//    purpose: Provides a convenient interface for use of the ELF library; in particular,
-//             facilitates querying the ELF symbol table for information about functions.
+//    purpose: Clients may provide a filename to the constructor (must be either an ELF
+//    object file or an archive of ELF object files) and make subsequent calls to
+//    findNextSymbol() to iterate over ELF symbol table contents.
 // []
 
 #ifndef _INCLUDED_ELFREADER_H
+#define _INCLUDED_ELFREADER_H
 
 #include <libelf.h>
 
 class ElfReader 
 {
   public:
-    ElfReader(const char* execName);
+    ElfReader(const char* filename);
     ~ElfReader();
 
-    bool GetNextFunction(std::string& string,
-                         std::pair<uint64_t, uint64_t>& range,
-                         unsigned instWidth);
-    
+    bool findNextSymbol(std::string& string,
+                        std::pair<uint64_t, uint64_t>& range,
+                        unsigned instWidth);
+
   private:
-    ElfReader() {}
-    void LocateSections();
+    ElfReader() { }
+
+    void locateSections();
+    bool handleNewFile();
+    void nextFile();
+    void printSymTableEntry(Elf64_Sym* sym, std::ostream& ostr = std::cerr);
 
-    int           m_execFD;       // Executable FD
-    Elf*          m_elfDes;       // ELF descriptor
-    Elf64_Ehdr*   m_elfHdr;       // ELF header
-    Elf64_Shdr*   m_symTab;       // Symbol table section header
-    Elf64_Xword   m_entrySize;
-    Elf64_Xword   m_numEntries;
-    Elf64_Xword   m_entriesProcessed;
-    char*         m_strTab;
-    unsigned      m_codeSectionIdx; // Section index of code section
+    int           m_fd;          // Raw file descriptor
+    Elf*          m_pPrimaryElf; // Primary ELF descriptor
+    Elf*          m_pCurrElf;    // Current ELF descriptor
+    Elf_Cmd       m_currCmd;     // Current ELF command
+    Elf64_Ehdr*   m_pElfHdr;     // Current ELF header
+    Elf64_Shdr*   m_pSymHdr;     // Section header of current symtable
+    Elf_Scn*      m_pSymSec;     // Section descriptor for current symtable
+    char*         m_pStrTab;     // String table of symbol names for current symtable
+    char*         m_pSecNameTab; // String table of section names for current file
+    Elf64_Sym*    m_pCurrSym;    // The current symtable entry
+    Elf64_Sym*    m_pSymEnd;     // The end of the current symtable
+    unsigned      m_codeSecIdx;  // Section index of code section in current object file
 
     static const std::string sm_codeSegmentName;
 };





More information about the llvm-commits mailing list