2 * Copyright (c) 1996 Barton P. Miller
4 * We provide the Paradyn Parallel Performance Tools (below
5 * described as Paradyn") on an AS IS basis, and do not warrant its
6 * validity or performance. We reserve the right to update, modify,
7 * or discontinue this software at any time. We shall have no
8 * obligation to supply such updates or modifications or any other
9 * form of support to you.
11 * This license is for research uses. For such uses, there is no
12 * charge. We define "research use" to mean you may freely use it
13 * inside your organization for whatever purposes you see fit. But you
14 * may not re-distribute Paradyn or parts of Paradyn, in any form
15 * source or binary (including derivatives), electronic or otherwise,
16 * to any other organization or entity without our permission.
18 * (for other uses, please contact us at paradyn@cs.wisc.edu)
20 * All warranties, including without limitation, any warranty of
21 * merchantability or fitness for a particular purpose, are hereby
24 * By your use of Paradyn, you understand and agree that we (or any
25 * other person or entity with proprietary rights in Paradyn) are
26 * under no obligation to provide either maintenance services,
27 * update services, notices of latent defects, or correction of
28 * defects for Paradyn.
30 * Even if advised of the possibility of such damages, under no
31 * circumstances shall we (or any other person or entity with
32 * proprietary rights in the software licensed hereunder) be liable
33 * to you or any third party for direct, indirect, or consequential
34 * damages of any character regardless of type of action, including,
35 * without limitation, loss of profits, loss of use, loss of good
36 * will, or computer failure or malfunction. You agree to indemnify
37 * us (and any other person or entity with proprietary rights in the
38 * software licensed hereunder) for any and all liability it may
39 * incur to third parties resulting from your use of Paradyn.
42 #ifndef _BPatch_type_h_
43 #define _BPatch_type_h_
45 #include "BPatch_dll.h"
46 #include "BPatch_Vector.h"
48 typedef enum {BPatchSymLocalVar, BPatchSymGlobalVar, BPatchSymRegisterVar,
49 BPatchSymStaticLocalVar, BPatchSymStaticGlobal,
50 BPatchSymLocalFunc, BPatchSymGlobalFunc, BPatchSymFuncParam,
51 BPatchSymTypeName, BPatchSymAggType, BPatchSymTypeTag}symDescr_t;
55 * BPatchSymLocalVar - local variable- gnu sun-(empty)
56 * BPatchSymGlobalVar - global variable- gnu sun-'G'
57 * BPatchSymRegisterVar - register variable- gnu sun-'r'
58 * BPatchSymStaticLocalVar - static local variable- gnu sun-'V'
59 * BPatchSymStaticGlobal - static global variable- gnu- sun'S'
60 * BPatchSymLocalFunc - local function- gnu sun-'f'
61 * BPatchSymGlobalFunc - global function- gnu- sun'F'
62 * BPatchSymFuncParam - function paramater - gnu- sun'p'
63 * BPatchSymTypeName - type name- gnu sun-'t'
64 * BPatchSymAggType - aggregate type-struct,union, enum- gnu sun-'T'
65 * BPatchSymTypeTag - C++ type name and tag combination
68 typedef enum {BPatch_scalar,
83 BPatch_common} BPatch_dataClass;
87 * BPatchSymTypeReference - type reference- gnu sun-(empty)
88 * BPatch_array - array type- gnu sun-'a'
89 * BPatch_enumerated - enumerated type- gnu sun-'e'
90 * BPatch_class - Class type
91 * BPatch_func - function type- gnu sun-'f'
92 * BPatchSymTypeRange - range type- gnu sun-'r'
93 * BPatch_structure - structure type- gnu sun-'s'
94 * BPatch_union - union specification- gnu sun-'u'
95 * BPatch_pointer - pointer type- gnu sun-'*'
96 * BPatch_referance - referance type- gnu sun-'*'
97 * BPatch_typeAttrib - type attribute (C++)- gnu sun- '@'
98 * BPatch_built_inType - built-in type -- gdb doc ->negative type number
99 * BPatch_reference - C++ reference to another type- gnu sun- '&'
100 * BPatch_method - C++ class method
103 typedef enum {BPatch_private, BPatch_protected, BPatch_public,
104 BPatch_optimized=9,BPatch_visUnknown}BPatch_visibility;
106 * BPatch_visibility: Accessibility of member data and functions
107 * These values follow the 'field_name:' after the '/' identifier.
108 * BPatch_private == 0 gnu Sun -- private
109 * BPatch_protected == 1 gnu Sun -- protected
110 * BPatch_public == 2 gnu Sun -- public
111 * BPatch_optimized == 9 gnu Sun -- field optimized out and is public
112 * BPatch_visUnknown visibility not known or doesn't apply(ANSIC), the default
117 class BPatch_function;
120 * A BPatch_field is equivalent to a field in a enum, struct, or union.
121 * A field can be an atomic type, i.e, int, char, or more complex like a
124 class BPATCH_DLL_EXPORT BPatch_field {
125 friend class BPatch_variableExpr;
128 BPatch_dataClass typeDes;
129 BPatch_visibility vis;
133 /* For structs and unions */
143 BPatch_field(const char * fName, BPatch_dataClass _typeDes, int eValue);
144 // C++ version for Enum constructor
145 BPatch_field(const char * fName, BPatch_dataClass _typeDes, int eValue,
146 BPatch_visibility _vis);
147 // Struct or Union construct
148 BPatch_field(const char * fName, BPatch_dataClass _typeDes,
149 BPatch_type *suType, int suOffset, int suSize);
150 // C++ version for Struct or Union construct
151 BPatch_field(const char * fName, BPatch_dataClass _typeDes,
152 BPatch_type *suType, int suOffset, int suSize,
153 BPatch_visibility _vis);
157 const char *getName() { return fieldname; }
158 BPatch_type *getType() { return type; }
159 int getValue() { return value;}
160 BPatch_visibility getVisibility() { return vis; }
161 BPatch_dataClass getTypeDesc() { return typeDes; }
162 int getSize() { return size; }
163 int getOffset() { return offset; }
167 // Define an instance of a Common block. Each subroutine can have its own
168 // version of the common block.
170 class BPATCH_DLL_EXPORT BPatch_cblock {
174 // the list of fields
175 BPatch_Vector<BPatch_field *> fieldList;
177 // which functions use this list
178 BPatch_Vector<BPatch_function *> functions;
181 BPatch_Vector<BPatch_field *> *getComponents() { return &fieldList; }
182 BPatch_Vector<BPatch_function *> *getFunctions() { return &functions; }
185 class BPATCH_DLL_EXPORT BPatch_type {
189 int ID; /* unique ID of type */
190 int size; /* size of type */
191 char *low; /* lower bound */
192 char *hi; /* upper bound */
194 BPatch_dataClass type_;
195 BPatch_type *ptr; /* pointer to other type (for ptrs, arrays) */
197 /* For enums, structs and union components */
198 BPatch_Vector<BPatch_field *> fieldList;
200 /* For common blocks */
201 BPatch_Vector<BPatch_cblock *> *cblocks;
204 // Start Internal Functions
207 BPatch_type(const char *_name, bool _nullType = false);
208 /* Enum constructor */
209 BPatch_type(const char *_name, int _ID, BPatch_dataClass _type);
210 /* Struct, union, range(size), reference(void) constructor and
211 Built-in type constructor-negative type numbers defined by gdb doc */
212 BPatch_type(const char *_name, int _ID, BPatch_dataClass _type, int _size);
213 /* Pointer (internal) constructor */
214 BPatch_type(const char *_name, int _ID, BPatch_dataClass _type,
216 /* Range (lower and uper bound) constructor */
217 BPatch_type(const char *_name, int _ID, BPatch_dataClass _type,
218 const char * _low, const char * _hi);
219 /* Array Constructor */
220 BPatch_type(const char *_name, int _ID, BPatch_dataClass _type,
221 BPatch_type * _ptr, int _low, int _hi);
222 /* Pre-existing type--typedef */
223 BPatch_type(const char *_name, int _ID, BPatch_type * _ptr);
224 /* defining a type in terms of a builtin type (Type Attribute) */
225 BPatch_type(const char *_name, int _ID, BPatch_dataClass _type,
226 int _size, BPatch_type * _ptr);
228 /* Add field for Enum */
229 void addField(const char * _fieldname, BPatch_dataClass _typeDes, int value);
230 /* Add field for C++(has visibility) Enum */
231 void addField(const char * _fieldname, BPatch_dataClass _typeDes, int value,
232 BPatch_visibility _vis);
233 /* Add field for struct or union */
234 void addField(const char * _fieldname, BPatch_dataClass _typeDes,
235 BPatch_type *_type, int _offset, int _size);
236 /* Add field for C++(has visibility) struct or union */
237 void addField(const char * _fieldname, BPatch_dataClass _typeDes,
238 BPatch_type *_type, int _offset, int _size, BPatch_visibility _vis);
240 void beginCommonBlock();
241 void endCommonBlock(BPatch_function *, void *baseAddr);
243 // END Internal Functions
246 // Constructors for USER DEFINED BPatch_types
247 /* Enum constructor */
248 BPatch_type(const char *_name, BPatch_dataClass _type);
249 /* Struct, union, range(size), reference(void) constructor and
250 Built-in type constructor-negative type numbers defined by gdb doc */
251 BPatch_type(const char *_name, BPatch_dataClass _type, int _size);
252 /* Pointer (internal) constructor */
253 BPatch_type(const char *_name, BPatch_type * _ptr, int size_);
254 /* Range (lower and uper bound) constructor */
255 BPatch_type(const char *_name, BPatch_dataClass _type,
256 const char * _low, const char * _hi);
257 /* Array Constructor */
258 BPatch_type(const char *_name, BPatch_dataClass _type,
259 BPatch_type * _ptr, int _low, int _hi);
260 /* Pre-existing type--typedef */
261 BPatch_type(const char *_name, BPatch_type * _ptr);
262 /* defining a type in terms of a builtin type (Type Attribute) */
263 BPatch_type(const char *_name, BPatch_dataClass _type, int _size,
266 int getID(){ return ID;}
267 void setID(int typeId) { ID = typeId; }
268 void setDataClass(BPatch_dataClass p1) { type_ = p1; }
270 int getSize() const { return size; };
271 const char *getName() { return name; }
272 const char *getLow() { return low; }
273 const char *getHigh() { return hi; }
274 BPatch_type *getConstituentType() { return ptr; }
275 bool isCompatible(BPatch_type *otype);
276 BPatch_dataClass getDataClass() { return type_; }
277 BPatch_Vector<BPatch_field *> *getComponents() {
279 BPatch_Vector<BPatch_cblock *> *getCblocks() { return cblocks; }
284 // This class stores information about local variables.
285 // It is desgined store information about a variable in a function.
286 // Scope needs to be addressed in this class.
288 class BPATCH_DLL_EXPORT BPatch_localVar{
294 //USed only in XCOFF/COFF format, can be
296 // scRegister, scVarRegister,
306 BPatch_localVar(char * _name, BPatch_type * _type, int _lineNum,
307 int _frameOffset, int _sc = 5 /* scAbs */, bool fr=true);
310 const char * getName() { return name; }
311 BPatch_type * getType() { return type; }
312 int getLineNum() { return lineNum; }
313 int getFrameOffset() { return frameOffset; }
314 int getFrameRelative() { return frameRelative; }
315 int getSc() { return storageClass; }
319 #endif /* _BPatch_type_h_ */