2 * Copyright (c) 1996-2004 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 // $Id: test_mem_5.C,v 1.1 2008/10/30 19:21:59 legendre Exp $
45 * #Desc: Instrumentation w/effective address snippet
47 * #Arch: !(sparc_sun_solaris2_4_test,,rs6000_ibm_aix4_1_test,i386_unknown_linux2_0_test,x86_64_unknown_linux2_4_test,i386_unknown_nt4_0_test,ia64_unknown_linux2_4_test)
52 #include "BPatch_Vector.h"
53 #include "BPatch_thread.h"
54 #include "BPatch_snippet.h"
59 #include "dyninst_comp.h"
60 class test_mem_5_Mutator : public DyninstMutator {
62 virtual test_results_t executeTest();
64 extern "C" DLLEXPORT TestMutator *test_mem_5_factory() {
65 return new test_mem_5_Mutator();
68 // Instrument all accesses with an effective address snippet
69 // static int mutatorTest(BPatch_thread *bpthr, BPatch_image *bpimg)
70 test_results_t test_mem_5_Mutator::executeTest() {
72 const char* testdesc = "instrumentation w/effective address snippet";
73 #if !defined(sparc_sun_solaris2_4_test) \
74 &&(!defined(rs6000_ibm_aix4_1_test) || defined(AIX5)) \
75 && !defined(i386_unknown_linux2_0_test) \
76 && !defined(x86_64_unknown_linux2_4_test) /* Blind duplication - Ray */ \
77 && !defined(i386_unknown_nt4_0_test) \
78 && !defined(ia64_unknown_linux2_4_test)
79 //skiptest(testnum, testdesc);
82 BPatch_Set<BPatch_opCode> axs;
83 axs.insert(BPatch_opLoad);
84 axs.insert(BPatch_opStore);
85 axs.insert(BPatch_opPrefetch);
88 BPatch_Vector<BPatch_function *> found_funcs;
89 const char *inFunction = "loadsnstores";
90 if ((NULL == appImage->findFunction(inFunction, found_funcs, 1)) || !found_funcs.size()) {
91 logerror(" Unable to find function %s\n",
96 if (1 < found_funcs.size()) {
97 logerror("%s[%d]: WARNING : found %d functions named %s. Using the first.\n",
98 __FILE__, __LINE__, found_funcs.size(), inFunction);
101 BPatch_Vector<BPatch_point *> *res1 = found_funcs[0]->findPoint(axs);
104 failtest(testnum, testdesc, "Unable to find function \"loadsnstores\".\n");
106 //logerror("Doing test %d!!!!!!\n", testnum);
107 if (instEffAddr(appThread, "EffAddr", res1, false) < 0) {
111 //appThread->detach(false);
116 // External Interface
117 // extern "C" TEST_DLL_EXPORT int test6_5_mutatorMAIN(ParameterDict ¶m)
120 // bpatch = (BPatch *)(param["bpatch"]->getPtr());
121 // BPatch_thread *appThread = (BPatch_thread *)(param["appThread"]->getPtr());
123 // // Get log file pointers
124 // FILE *outlog = (FILE *)(param["outlog"]->getPtr());
125 // FILE *errlog = (FILE *)(param["errlog"]->getPtr());
126 // setOutputLog(outlog);
127 // setErrorLog(errlog);
129 // // Read the program's image and get an associated image object
130 // BPatch_image *appImage = appThread->getImage();
132 // // Run mutator code
133 // return mutatorTest(appThread, appImage);