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 * $Id: Symbol.h,v 1.20 2008/11/03 15:19:24 jaw Exp $ 00033 * Symbol.h: symbol table objects. 00034 ************************************************************************/ 00035 00036 #if !defined(_Function_h_) 00037 #define _Function_h_ 00038 00039 #include "Annotatable.h" 00040 #include "Serialization.h" 00041 #include "Aggregate.h" 00042 #include "Variable.h" 00043 00044 SYMTAB_EXPORT std::ostream &operator<<(std::ostream &os, const Dyninst::SymtabAPI::Function &); 00045 00046 namespace Dyninst{ 00047 namespace SymtabAPI{ 00048 00049 class Symbol; 00050 class Type; 00051 00052 00053 class Function : public Aggregate, public Serializable, public AnnotatableSparse 00054 { 00055 friend class Symtab; 00056 friend std::ostream &::operator<<(std::ostream &os, const Dyninst::SymtabAPI::Function &); 00057 00058 private: 00059 SYMTAB_EXPORT Function(Symbol *sym); 00060 00061 public: 00062 00063 SYMTAB_EXPORT Function(); 00064 SYMTAB_EXPORT virtual ~Function(); 00065 00066 /* Symbol management */ 00067 SYMTAB_EXPORT bool removeSymbol(Symbol *sym); 00068 00069 /***** Return Type Information *****/ 00070 SYMTAB_EXPORT Type * getReturnType() const; 00071 SYMTAB_EXPORT bool setReturnType(Type *); 00072 00073 /***** IA64-Specific Frame Pointer Information *****/ 00074 SYMTAB_EXPORT bool setFramePtrRegnum(int regnum); 00075 SYMTAB_EXPORT int getFramePtrRegnum() const; 00076 00077 /***** PPC64 Linux Specific Information *****/ 00078 SYMTAB_EXPORT Offset getPtrOffset() const; 00079 SYMTAB_EXPORT Offset getTOCOffset() const; 00080 00081 /***** Frame Pointer Information *****/ 00082 SYMTAB_EXPORT bool setFramePtr(std::vector<VariableLocation> *locs); 00083 SYMTAB_EXPORT std::vector<VariableLocation> &getFramePtrRefForInit(); 00084 SYMTAB_EXPORT std::vector<VariableLocation> &getFramePtr(); 00085 00086 /***** Local Variable Information *****/ 00087 SYMTAB_EXPORT bool findLocalVariable(std::vector<localVar *>&vars, std::string name); 00088 SYMTAB_EXPORT bool getLocalVariables(std::vector<localVar *>&vars); 00089 SYMTAB_EXPORT bool getParams(std::vector<localVar *>¶ms); 00090 00091 SYMTAB_EXPORT Serializable * serialize_impl(SerializerBase *sb, 00092 const char *tag = "Function") THROW_SPEC (SerializerError); 00093 00094 SYMTAB_EXPORT unsigned getSize(); 00095 00096 SYMTAB_EXPORT bool operator==(const Function &); 00097 /* internal helper functions */ 00098 bool addLocalVar(localVar *); 00099 bool addParam(localVar *); 00100 bool setupParams(); 00101 private: 00102 void expandLocation(const VariableLocation &loc, 00103 std::vector<VariableLocation> &ret); 00104 00105 00106 Type *retType_; 00107 int framePtrRegNum_; 00108 std::vector<VariableLocation> frameBase_; 00109 bool frameBaseExpanded_; 00110 unsigned functionSize_; 00111 }; 00112 00113 00114 } 00115 } 00116 00117 #endif
1.6.1