extended parseThat to use new addressSpace abstraction
[dyninst.git] / dyninstAPI / h / BPatch_snippet.h
1 /*
2  * Copyright (c) 1996-2004 Barton P. Miller
3  * 
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.
10  * 
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.
17  * 
18  * (for other uses, please contact us at paradyn@cs.wisc.edu)
19  * 
20  * All warranties, including without limitation, any warranty of
21  * merchantability or fitness for a particular purpose, are hereby
22  * excluded.
23  * 
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.
29  * 
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.
40  */
41
42 #ifndef _BPatch_snippet_h_
43 #define _BPatch_snippet_h_
44
45 #include "BPatch_dll.h"
46 #include "BPatch_Vector.h"
47 #include "BPatch_sourceObj.h"
48 #include "BPatch_type.h"
49 #include "BPatch_module.h"
50 //#include "BPatch_addressSpace.h"
51 //#include "BPatch_function.h"
52 #include "BPatch_eventLock.h"
53
54 class AstNode;
55 // Don't include the boost shared_ptr library
56
57 namespace boost {
58     template< typename T > class shared_ptr;
59     template<> class shared_ptr<AstNode *>;
60 };
61 typedef boost::shared_ptr<AstNode> AstNodePtr;
62
63 class process;
64 class BPatch_process;
65 class BPatch_function;
66 class BPatch_point;
67 class BPatch_addressSpace;
68
69 /*
70  * Used to specify whether a snippet should be installed before other snippets
71  * that have previously been inserted at the same point, or after.
72  */
73 typedef enum {
74     BPatch_firstSnippet,
75     BPatch_lastSnippet
76 } BPatch_snippetOrder;
77
78 typedef enum {
79     BPatch_lt,
80     BPatch_eq,
81     BPatch_gt,
82     BPatch_le,
83     BPatch_ne,
84     BPatch_ge,
85     BPatch_and,
86     BPatch_or
87 } BPatch_relOp;
88
89 typedef enum {
90     BPatch_assign,
91     BPatch_plus,
92     BPatch_minus,
93     BPatch_divide,
94     BPatch_times,
95     BPatch_mod,
96     BPatch_ref,
97     BPatch_fieldref,
98     BPatch_seq,
99     BPatch_bit_and,             // not supported yet
100     BPatch_bit_or,              // not supported yet
101     BPatch_bit_xor,             // not supported yet
102     BPatch_left_shift,          // not supported yet
103     BPatch_right_shift          // not supported yet
104 } BPatch_binOp;
105
106 // for backwards compatability
107 #define BPatch_addr BPatch_address
108
109 typedef enum {
110     BPatch_negate,
111     BPatch_address,
112 #ifdef IBM_BPATCH_COMPAT
113     BPatch_deref,
114     BPatch_bit_compl            // not supported yet
115 #else
116     BPatch_deref
117 #endif
118 } BPatch_unOp;
119
120 #ifdef DYNINST_CLASS_NAME
121 #undef DYNINST_CLASS_NAME
122 #endif
123 #define DYNINST_CLASS_NAME BPatch_snippet
124
125 class BPATCH_DLL_EXPORT BPatch_snippet : public BPatch_eventLock {
126     friend class BPatch_process;
127     friend class BPatch_binaryEdit;
128     friend class BPatch_addressSpace;
129     friend class BPatch_thread;
130     friend class BPatch_arithExpr;
131     friend class BPatch_boolExpr;
132     friend class BPatch_funcCallExpr;
133     friend class BPatch_variableExpr;
134     friend class BPatch_ifExpr;
135     friend class BPatch_ifMachineConditionExpr;
136     friend class BPatch_sequence;
137     friend class BPatch_insnExpr;
138     friend AstNodePtr *generateArrayRef(const BPatch_snippet &lOperand, 
139                                         const BPatch_snippet &rOperand);
140     friend AstNodePtr *generateFieldRef(const BPatch_snippet &lOperand, 
141                                         const BPatch_snippet &rOperand);
142
143     public:
144
145     int PDSEP_astMinCost(); // This will go away too
146
147     //  BPatch_snippet::BPatch_snippet
148     //  Default constructor
149
150     BPatch_snippet();
151
152     //  BPatch_snippet::BPatch_snippet
153     //  Copy constructor
154
155     public:  BPatch_snippet(const BPatch_snippet &src) : BPatch_eventLock(src)
156              { LOCK_FUNCTION_V(BPatch_snippetInt,(src)); }
157     private: void BPatch_snippetInt(const BPatch_snippet &src);
158
159     //  BPatch_snippet:operator=
160     //  Assign one BPatch_snippet to another
161     API_EXPORT_OPER(_equals, (src),
162
163     BPatch_snippet &,operator=,(const BPatch_snippet &src));
164
165     //  BPatch_snippet::~BPatch_snippet
166     //  Destructor, decrements reference count to snippet, deleting when none are left
167     API_EXPORT_DTOR(_dtor, (),
168     
169     ~,BPatch_snippet,());
170
171     //  BPatch_snippet::getCost
172     //  Returns an estimated cost of executing the snippet, in seconds.
173     API_EXPORT(Int, (),
174
175     float,getCost,());
176
177     //  BPatch_snippet::getCostAtPoint
178     //  Returns an estimated cost of executing the snippet at a specified point, in seconds.
179     API_EXPORT(Int, (pt),
180
181     float,getCostAtPoint,(BPatch_point *pt));
182
183     //  BPatch_snippet::is_trivial
184     //  allows users to check to see if
185     //  a snippet operation failed (leaving ast NULL)
186     API_EXPORT(Int, (),
187
188     bool,is_trivial,());
189
190     protected:
191     AstNodePtr *ast_wrapper; 
192
193 };
194
195 #ifdef DYNINST_CLASS_NAME
196 #undef DYNINST_CLASS_NAME
197 #endif
198 #define DYNINST_CLASS_NAME BPatch_arithExpr
199
200 class BPATCH_DLL_EXPORT BPatch_arithExpr: public BPatch_snippet {
201
202     //  BPatch_arithExpr::BPatch_arithExpr (Binary Arithmetic Operation)
203     //  
204     API_EXPORT_CTOR(Bin, (op, lOperand, rOperand),
205     BPatch_arithExpr,(BPatch_binOp op,
206                       const BPatch_snippet &lOperand,
207                       const BPatch_snippet &rOperand));
208
209     //  BPatch_arithExpr::BPatch_arithExpr (Unary Arithmetic Operation)
210     //  
211     API_EXPORT_CTOR(Un, (op, lOperand),
212     BPatch_arithExpr,(BPatch_unOp op, const BPatch_snippet &lOperand));
213 };
214
215 #ifdef DYNINST_CLASS_NAME
216 #undef DYNINST_CLASS_NAME
217 #endif
218 #define DYNINST_CLASS_NAME BPatch_boolExpr
219
220 class BPATCH_DLL_EXPORT BPatch_boolExpr : public BPatch_snippet {
221
222     //  BPatch_boolExpr::BPatch_boolExpr
223     //  Creates a representation of boolean operation
224     API_EXPORT_CTOR(Int, (op, lOperand, rOperand),
225     BPatch_boolExpr,(BPatch_relOp op, const BPatch_snippet &lOperand,
226                      const BPatch_snippet &rOperand));
227 };
228
229 #ifdef DYNINST_CLASS_NAME
230 #undef DYNINST_CLASS_NAME
231 #endif
232 #define DYNINST_CLASS_NAME BPatch_constExpr
233
234 class BPATCH_DLL_EXPORT BPatch_constExpr : public BPatch_snippet {
235
236     //  BPatch_constExpr::BPatch_constExpr
237     //  Creates a representation of a (signed int) value
238     API_EXPORT_CTOR(SignedInt, (value),
239     BPatch_constExpr,(signed int value));
240
241     //  Creates a representation of an (unsigned int) value
242     API_EXPORT_CTOR(UnsignedInt, (value),
243     BPatch_constExpr,(unsigned int value));
244     
245     //  Creates a representation of a (signed long) value
246     API_EXPORT_CTOR(SignedLong, (value),
247     BPatch_constExpr,(signed long value));
248     
249     //  Creates a representation of an (unsigned long) value
250     API_EXPORT_CTOR(UnsignedLong, (value),
251     BPatch_constExpr,(unsigned long value));
252
253     //  BPatch_constExpr::BPatch_constExpr
254     //  Creates a representation of a (char *) value
255     API_EXPORT_CTOR(CharStar, (value),
256     BPatch_constExpr,(const char *value));
257
258     //  BPatch_constExpr::BPatch_constExpr
259     //  Creates a representation of a (void *) value
260     API_EXPORT_CTOR(VoidStar, (value),
261     BPatch_constExpr,(const void *value));
262
263     //  BPatch_constExpr::BPatch_constExpr
264     //  Creates a representation of a (long long) value
265     API_EXPORT_CTOR(LongLong, (value),
266     BPatch_constExpr,(long long value));
267
268 #ifdef IBM_BPATCH_COMPAT
269     //  BPatch_constExpr::BPatch_constExpr
270     //  Creates a representation of a (float) value
271     API_EXPORT_CTOR(Float, (value),
272     BPatch_constExpr,(float value));
273 #endif
274
275     // Should _always_ have a default constructor. This
276     // one produces a 0
277     BPatch_constExpr() : BPatch_snippet() {};
278
279 };
280
281 #ifdef DYNINST_CLASS_NAME
282 #undef DYNINST_CLASS_NAME
283 #endif
284 #define DYNINST_CLASS_NAME BPatch_regExpr
285
286 class BPATCH_DLL_EXPORT BPatch_regExpr : public BPatch_snippet {
287
288     //  BPatch_regExpr::BPatch_regExpr
289     //  Creates a representation of the contents of a particular register
290     //  specified by <value>
291     API_EXPORT_CTOR(Int, (value),
292     BPatch_regExpr,(unsigned int value));
293 };
294
295 #ifdef DYNINST_CLASS_NAME
296 #undef DYNINST_CLASS_NAME
297 #endif
298 #define DYNINST_CLASS_NAME BPatch_funcCallExpr
299
300 class BPATCH_DLL_EXPORT BPatch_funcCallExpr : public BPatch_snippet {
301
302     //  BPatch_funcCallExpr::BPatch_funcCallExpr
303     //  Creates a representation of a function call
304     API_EXPORT_CTOR(Int, (func, args),
305     BPatch_funcCallExpr,(const BPatch_function& func,
306                          const BPatch_Vector<BPatch_snippet *> &args));
307 };
308
309 #ifdef DYNINST_CLASS_NAME
310 #undef DYNINST_CLASS_NAME
311 #endif
312 #define DYNINST_CLASS_NAME BPatch_funcJumpExpr
313
314 class BPATCH_DLL_EXPORT BPatch_funcJumpExpr : public BPatch_snippet {
315
316     //  BPatch_funcJumpExpr::BPatch_funcJumpExpr
317     //  Creates a representation of a jump to a function without linkage
318     API_EXPORT_CTOR(Int, (func),
319     BPatch_funcJumpExpr,(const BPatch_function& func));
320 };
321
322 #ifdef DYNINST_CLASS_NAME
323 #undef DYNINST_CLASS_NAME
324 #endif
325 #define DYNINST_CLASS_NAME BPatch_ifExpr
326
327 class BPATCH_DLL_EXPORT BPatch_ifExpr : public BPatch_snippet {
328
329     //  BPatch_ifExpr::BPatch_ifExpr
330     //  Creates a conditional expression "if <conditional> tClause;"
331     API_EXPORT_CTOR(Int, (conditional, tClause),
332     BPatch_ifExpr,(const BPatch_boolExpr &conditional,
333                    const BPatch_snippet &tClause));
334
335     //  BPatch_ifExpr::BPatch_ifExpr
336     //  Creates a conditional expression 
337     //  "if <conditional> tClause; else fClause;"
338     API_EXPORT_CTOR(WithElse, (conditional, tClause, fClause),
339     BPatch_ifExpr,(const BPatch_boolExpr &conditional,
340                    const BPatch_snippet &tClause,
341                    const BPatch_snippet &fClause));
342 };
343
344 #ifdef DYNINST_CLASS_NAME
345 #undef DYNINST_CLASS_NAME
346 #endif
347 #define DYNINST_CLASS_NAME BPatch_nullExpr
348
349 class BPATCH_DLL_EXPORT BPatch_nullExpr : public BPatch_snippet {
350
351     //  BPatch_nullExpr::BPatch_nullExpr
352     //  Creates a null snippet that can be used as a placeholder.
353     API_EXPORT_CTOR(Int, (),
354     BPatch_nullExpr,());
355
356 };
357
358 #ifdef DYNINST_CLASS_NAME
359 #undef DYNINST_CLASS_NAME
360 #endif
361 #define DYNINST_CLASS_NAME BPatch_paramExpr
362
363 class BPATCH_DLL_EXPORT BPatch_paramExpr : public BPatch_snippet {
364
365     //  BPatch_paramExpr::BPatch_paramExpr
366     //  Represents a parameter of a function (used in creating funcCallExpr)
367     API_EXPORT_CTOR(Int, (n),
368     BPatch_paramExpr,(int n));
369 };
370
371 #ifdef DYNINST_CLASS_NAME
372 #undef DYNINST_CLASS_NAME
373 #endif
374 #define DYNINST_CLASS_NAME BPatch_retExpr
375
376 class BPATCH_DLL_EXPORT BPatch_retExpr : public BPatch_snippet {
377
378     //  BPatch_retExpr::BPatch_retExpr
379     //  Represents the return value from the function in which the 
380     //  snippet is inserted
381     API_EXPORT_CTOR(Int, (),
382     BPatch_retExpr,());
383 };
384
385 #ifdef DYNINST_CLASS_NAME
386 #undef DYNINST_CLASS_NAME
387 #endif
388 #define DYNINST_CLASS_NAME BPatch_sequence
389
390 class BPATCH_DLL_EXPORT BPatch_sequence : public BPatch_snippet {
391
392     //  BPatch_sequence::BPatch_sequence
393     //  Represents a sequence of statements
394     API_EXPORT_CTOR(Int, (items),
395     BPatch_sequence,(const BPatch_Vector<BPatch_snippet *> &items));
396 };
397
398 #ifdef DYNINST_CLASS_NAME
399 #undef DYNINST_CLASS_NAME
400 #endif
401 #define DYNINST_CLASS_NAME BPatch_variableExpr
402
403 class BPATCH_DLL_EXPORT BPatch_variableExpr : public BPatch_snippet 
404 {
405     friend class BPatch_process;
406     friend class BPatch_addressSpace;
407     friend class BPatch_binaryEdit;
408     friend class BPatch_image;
409     friend class BPatch_function;
410
411     char                *name;
412     BPatch_process      *appProcess;
413     BPatch_addressSpace     *appAddSpace;
414     void                *address;
415     int                 size;
416     BPatch_point        *scope;
417     bool                isLocal;
418     /*
419     BPatch_variableExpr(BPatch_process *in_process, void *in_address,
420                         int in_size);
421     BPatch_variableExpr(char *in_name, 
422                         BPatch_process *in_process, 
423                         AstNodePtr *ast_wrapper_,
424                         BPatch_type *type);
425     BPatch_variableExpr(char *in_name, 
426                         BPatch_process *in_process, 
427                         AstNodePtr *ast_wrapper_,
428                         BPatch_type *type, void* in_address);
429     BPatch_variableExpr(BPatch_process *in_process, void *in_address, 
430                         int in_register, BPatch_type *type, 
431                         BPatch_storageClass storage = BPatch_storageAddr,
432                         BPatch_point *scp = NULL);
433     */
434
435     BPatch_variableExpr(BPatch_addressSpace *in_addSpace, void *in_address,
436                         int in_size);
437     BPatch_variableExpr(char *in_name, 
438                         BPatch_addressSpace *in_addSpace,
439                         AstNodePtr *ast_wrapper_,
440                         BPatch_type *type);
441     BPatch_variableExpr(char *in_name, 
442                         BPatch_addressSpace *in_addSpace,
443                         AstNodePtr *ast_wrapper_,
444                         BPatch_type *type, void* in_address);
445     BPatch_variableExpr(BPatch_addressSpace *in_addSpace, void *in_address, 
446                         int in_register, BPatch_type *type, 
447                         BPatch_storageClass storage = BPatch_storageAddr,
448                         BPatch_point *scp = NULL);
449
450
451   public:
452     //  BPatch_variableExpr::BPatch_variableExpr
453     //  Represents a variable in the target application
454     //
455     //  The following constructor _should_ be private, but paradyn needs
456     //  some way of declaring its own variables in its shared memory
457     //  (counters, etc).  Until there is a way to do this in a better way,
458     //  this needs to remain public (consider this a warning, API user,
459     //  avoid using this constructor, it may not be here in the future).
460     API_EXPORT_CTOR(Int, (name, in_addSpace, in_address, type),
461                     BPatch_variableExpr,(char *name, /*BPatch_process *in_process,*/
462                                          BPatch_addressSpace *in_addSpace,
463                          void *in_address, BPatch_type *type));
464     // Public functions for use by users of the library:
465
466     //  BPatch_variableExpr::getSize
467     //  Returns the size (in bytes) of this variable
468     API_EXPORT(Int, (),
469     unsigned int,getSize,() CONST_EXPORT);
470
471     //  BPatch_variableExpr::getType
472     //  Returns the type of this variable
473     API_EXPORT(Int, (),
474     const BPatch_type *,getType,());
475
476     //  BPatch_variableExpr::setType
477     //  Sets the type of this variable
478     //  XXX -- should this really be public?
479     API_EXPORT(Int, (t),
480     bool,setType,(BPatch_type *t));
481
482     //  BPatch_variableExpr::setSize
483     //  Sets the size of this variable
484     //  XXX -- should this really be public?
485     API_EXPORT(Int, (sz),
486     bool,setSize,(int sz));
487
488     //  BPatch_variableExpr::readValue
489     //  Read the value of a variable in a thread's address space.
490     //  <dst> is assumed to be the same size as the variable.
491     API_EXPORT(Int, (dst),
492     bool,readValue,(void *dst));
493
494     //  BPatch_variableExpr::readValue
495     //  Read the value of a variable in a thread's address space.
496     //  Will read <len> bytes into <dst>
497     API_EXPORT(WithLength, (dst, len),
498     bool,readValue,(void *dst, int len));
499
500     //  BPatch_variableExpr::writeValue
501     //  Write a value into a variable in a thread's address space.
502     //  variable is assumed to be the same size as the <dst>.
503     //  returns false if the type info isn't available (i.e. we don't know the size)
504     API_EXPORT(Int, (src, saveWorld),
505     bool,writeValue,(const void *src, bool saveWorld=false));
506
507     //  BPatch_variableExpr::writeValue
508     //  Write a value into a variable in a thread's address space.
509     //  Will write <len> bytes from <src> into variable
510     API_EXPORT(WithLength, (src, len, saveWorld),
511     bool,writeValue,(const void *src, int len,bool saveWorld=false));
512
513     //  BPatch_variableExpr::getName
514     //  Returns the symbol table name for this variable
515     API_EXPORT(Int, (),
516     char *,getName,());
517
518     //  BPatch_variableExpr::getBaseAddr
519     //  Returns base address of this variable in the target's address space
520     API_EXPORT(Int, (),
521     void *,getBaseAddr,());
522
523     //  BPatch_variableExpr::getComponents
524     //  return variable expressions for all of the fields in a struct/union
525     API_EXPORT(Int, (),
526     BPatch_Vector<BPatch_variableExpr *> *,getComponents,());
527
528 #ifdef IBM_BPATCH_COMPAT
529     API_EXPORT(WithLength, (buffer, max),
530     char *,getName,(char *buffer, int max));
531
532     API_EXPORT(Int, (),
533     void *,getAddress,());
534
535 #endif
536
537 };
538
539 #ifdef DYNINST_CLASS_NAME
540 #undef DYNINST_CLASS_NAME
541 #endif
542 #define DYNINST_CLASS_NAME BPatch_breakPointExpr
543
544 class BPATCH_DLL_EXPORT BPatch_breakPointExpr : public BPatch_snippet {
545
546     //  BPatch_breakPointExpr::BPatch_breakPointExpr
547     //  Creates a representation of a break point in the target process
548
549     API_EXPORT_CTOR(Int, (),
550     BPatch_breakPointExpr,());
551 };
552
553 // VG(11/05/01): This nullary snippet will return the effective
554 // address of a memory access when inserted at an instrumentation
555 // point that is a memory access.  In other words, the instruction at
556 // the point where it is inserted is the one to get effective address
557 // for.  Furthermore, there must be memory access information about
558 // the inst. point; this basically means that the point must have been
559 // created using a method that attaches that info to the point -
560 // e.g. using findPoint(const BPatch_Set<BPatch_opCode>& ops) from
561 // BPatch_function.
562
563 // VG(7/31/02): Since x86 can have 2 addresses per instruction, there is
564 // now parameter for the constructor indicating which of these you want.
565 // It defaults to the 1st access (#0).
566
567 // VG(8/14/02): added conditional parameter
568
569 #ifdef DYNINST_CLASS_NAME
570 #undef DYNINST_CLASS_NAME
571 #endif
572 #define DYNINST_CLASS_NAME BPatch_effectiveAddressExpr
573
574 class BPATCH_DLL_EXPORT BPatch_effectiveAddressExpr : public BPatch_snippet
575 {
576
577   //  BPatch_effectiveAddressExpr:: BPatch_effectiveAddressExpr
578   //  Construct a snippet representing an effective address.
579
580   API_EXPORT_CTOR(Int, (_which),
581   BPatch_effectiveAddressExpr,(int _which = 0));
582 };
583
584 #ifdef DYNINST_CLASS_NAME
585 #undef DYNINST_CLASS_NAME
586 #endif
587 #define DYNINST_CLASS_NAME BPatch_bytesAccessedExpr
588
589 // Number of bytes moved
590 class BPATCH_DLL_EXPORT BPatch_bytesAccessedExpr : public BPatch_snippet
591 {
592
593   //  BPatch_bytesAccessedExpr::BPatch_bytesAccessedExpr
594   //  Construct a snippet representing the number of bytes accessed.
595
596   API_EXPORT_CTOR(Int, (_which),
597   BPatch_bytesAccessedExpr,(int _which = 0));
598 };
599
600 // VG(8/11/2): It is possible to have a more general expression, say 
601 // machineConditionExpr, then have this reimplemented as ifExpr(machineConditionExpr, ...),
602 // and have an optimization (fast path) for that case using the specialized
603 // AST that supports this class. Memory instrumentation has no need for a standalone
604 // machineConditionExpr, so that remains TBD...
605
606 #ifdef DYNINST_CLASS_NAME
607 #undef DYNINST_CLASS_NAME
608 #endif
609 #define DYNINST_CLASS_NAME BPatch_ifMachineConditionExpr
610
611 class BPATCH_DLL_EXPORT BPatch_ifMachineConditionExpr : public BPatch_snippet {
612
613   //  BPatch_ifMachineConditionExpr::BPatch_ifMachineConditionExpr
614   //  
615
616   API_EXPORT_CTOR(Int, (tClause),
617   BPatch_ifMachineConditionExpr,(const BPatch_snippet &tClause));
618 };
619
620 #ifdef DYNINST_CLASS_NAME
621 #undef DYNINST_CLASS_NAME
622 #endif
623 #define DYNINST_CLASS_NAME BPatch_threadIndexExpr
624
625 class BPATCH_DLL_EXPORT BPatch_threadIndexExpr : public BPatch_snippet {
626   //
627   // BPatch_threadIndexExpr::BPatch_threadIndexExpr
628   API_EXPORT_CTOR(Int, (),
629   BPatch_threadIndexExpr,());
630 };
631
632 #ifdef DYNINST_CLASS_NAME
633 #undef DYNINST_CLASS_NAME
634 #endif
635 #define DYNINST_CLASS_NAME BPatch_tidExpr
636
637 class BPATCH_DLL_EXPORT BPatch_tidExpr : public BPatch_snippet {
638   //
639   // BPatch_tidExpr::BPatch_tidExpr
640   API_EXPORT_CTOR(Int, (proc),
641   BPatch_tidExpr,(BPatch_process *proc));
642 };
643
644 class BPatch_instruction;
645
646 #ifdef DYNINST_CLASS_NAME
647 #undef DYNINST_CLASS_NAME
648 #endif
649 #define DYNINST_CLASS_NAME BPatch_insnExpr
650
651 class BPATCH_DLL_EXPORT BPatch_insnExpr : public BPatch_snippet {
652     //
653     // BPatch_insnExpr::BPatch_insnExpr
654     API_EXPORT_CTOR(Int, (insn),
655                     BPatch_insnExpr,(BPatch_instruction *insn));
656     
657     // Replace the effective address of a load with the provided snippet
658     API_EXPORT(Int, (l), 
659     bool, overrideLoadAddress, (BPatch_snippet &l));
660
661     // Replace the effective address of a store with the provided snippet
662     API_EXPORT(Int, (s), 
663     bool, overrideStoreAddress, (BPatch_snippet &s));
664
665 };
666
667
668
669 #endif /* _BPatch_snippet_h_ */