00001 /* 00002 * See the dyninst/COPYRIGHT file for copyright information. 00003 * 00004 * We provide the Paradyn Tools (below described as "Paradyn") 00005 * on an AS IS basis, and do not warrant its validity or performance. 00006 * We reserve the right to update, modify, or discontinue this 00007 * software at any time. We shall have no obligation to supply such 00008 * updates or modifications or any other form of support to you. 00009 * 00010 * By your use of Paradyn, you understand and agree that we (or any 00011 * other person or entity with proprietary rights in Paradyn) are 00012 * under no obligation to provide either maintenance services, 00013 * update services, notices of latent defects, or correction of 00014 * defects for Paradyn. 00015 * 00016 * This library is free software; you can redistribute it and/or 00017 * modify it under the terms of the GNU Lesser General Public 00018 * License as published by the Free Software Foundation; either 00019 * version 2.1 of the License, or (at your option) any later version. 00020 * 00021 * This library is distributed in the hope that it will be useful, 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00024 * Lesser General Public License for more details. 00025 * 00026 * You should have received a copy of the GNU Lesser General Public 00027 * License along with this library; if not, write to the Free Software 00028 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00029 */ 00030 00031 00032 /************************************************************************ 00033 * $Id: Object-coff.h,v 1.3 2007/05/30 19:20:46 legendre Exp $ 00034 * COFF object files. 00035 * Note - this is DEC OSF/1 coff which probably isn't the real thing 00036 * 00037 * Note - this probably isn't perfect 00038 * - the symbol dictionary will only map one symbol table entry to each name 00039 * - I am not determining if symbols are external 00040 * - I may be ignoring some useful symbols from the symbol table 00041 * - I am checking the dictionary to make sure no existing entry get clobbered 00042 * - I am using mmap 00043 * - All of these objects need some type of "destroy" method to munmap and 00044 * free memory. This method will be invoked explictly, not implicitly. 00045 ************************************************************************/ 00046 00047 00048 00049 00050 00051 #if !defined(_Object_coff_h_) 00052 #define _Object_coff_h_ 00053 00054 00055 00056 #define LOG_WORD 2 00057 00058 /************************************************************************ 00059 * header files. 00060 ************************************************************************/ 00061 00062 #include "symtabAPI/h/Dyn_Symbol.h" 00063 #include <common/h/Types.h> 00064 #include <string> 00065 #include <vector> 00066 #include <map> 00067 00068 using namespace std; 00069 00070 extern "C" { 00071 #include <a.out.h> 00072 }; 00073 00074 #include <filehdr.h> 00075 #include <syms.h> 00076 #include <ldfcn.h> 00077 #include <fcntl.h> 00078 #include <stdlib.h> 00079 #include <unistd.h> 00080 00081 #include <sys/types.h> 00082 #include <sys/mman.h> 00083 #include <sys/stat.h> 00084 #include <map> 00085 #include <string> 00086 #include <vector> 00087 00088 using namespace std; 00089 00090 00091 00092 00093 00094 /************************************************************************ 00095 * class Object 00096 ************************************************************************/ 00097 00098 class Object : public AObject { 00099 public: 00100 //Object (const string, void (*)(const char *) = log_msg); 00101 Object (const Object &); 00102 Object (const string, const Address baseAddr, 00103 void (*)(const char *) = log_msg); 00104 // "Filedescriptor" ctor 00105 //Object(const fileDescriptor &desc, void (*)(const char *) = log_msg); 00106 Object(const fDescriptor &desc, void (*)(const char *) = log_msg); 00107 00108 virtual ~Object (); 00109 Object& operator= (const Object &); 00110 bool isDynamic() { return dynamicallyLinked; } 00111 string& GetFile() { return file_; } 00112 00113 bool isEEL() const { return false; } 00114 const char *interpreter_name() const { return NULL; } 00115 00116 private: 00117 void load_object (bool sharedLib); 00118 void get_relocation_entries(LDFILE *ldptr, int num); 00119 bool dynamicallyLinked; 00120 LDFILE *ldptr; 00121 filehdr fhdr; 00122 bool did_open; 00123 }; 00124 00125 inline 00126 Object::~Object() { 00127 } 00128 00129 inline 00130 Object& 00131 Object::operator=(const Object& obj) { 00132 (void) AObject::operator=(obj); 00133 return *this; 00134 } 00135 00136 00137 00138 #endif /* !defined(_Object_bsd_h_) */
1.6.1