VariableLocation.h

Go to the documentation of this file.
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 #if !defined(_Variable_Location_h_)
00032 #define _Variable_Location_h_
00033 
00034 #include "dyn_regs.h"
00035 #include "dyntypes.h"
00036 #include "util.h"
00037 
00038 namespace Dyninst {
00039 
00040 /*
00041  * storageClass: Encodes how a variable is stored.
00042  *
00043  * storageAddr           - Absolute address of variable.
00044  * storageReg            - Register which holds variable value.
00045  * storageRegOffset      - Address of variable = $reg + address.
00046  */
00047 
00048 typedef enum {
00049    storageUnset,
00050    storageAddr,
00051    storageReg,
00052    storageRegOffset
00053 } storageClass;
00054 
00055 COMMON_EXPORT const char *storageClass2Str(storageClass sc);
00056 
00057 /*
00058  * storageRefClass: Encodes if a variable can be accessed through a register/address.
00059  *
00060  * storageRef        - There is a pointer to variable.
00061  * storageNoRef      - No reference. Value can be obtained using storageClass.
00062  */
00063 typedef enum {
00064    storageRefUnset,
00065    storageRef,
00066    storageNoRef
00067 } storageRefClass;
00068 
00069 COMMON_EXPORT const char *storageRefClass2Str(storageRefClass sc);
00070 
00071 //location for a variable
00072 //Use mr_reg instead of reg for new code.  reg left in for backwards
00073 // compatibility.
00074 
00075 struct VariableLocation  {
00076     storageClass stClass;
00077     storageRefClass refClass;
00078         MachRegister mr_reg;
00079     long frameOffset;
00080     Address lowPC;
00081     Address hiPC;
00082    
00083 VariableLocation() :
00084    stClass(storageUnset),
00085       refClass(storageRefUnset),
00086       frameOffset(0),
00087       lowPC(0),
00088       hiPC(0) {}
00089 
00090    bool operator==(const VariableLocation &rhs) const {
00091       return ((stClass == rhs.stClass) &&
00092               (refClass == rhs.refClass) &&
00093               (mr_reg == rhs.mr_reg) &&
00094               (frameOffset == rhs.frameOffset) &&
00095               (lowPC == rhs.lowPC) &&
00096               (hiPC == rhs.hiPC));
00097    }
00098 
00099 };
00100 
00101 }
00102 
00103 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 12 Jul 2013 for SymtabAPI by  doxygen 1.6.1