/* * Copyright (c) 1996 Barton P. Miller * * We provide the Paradyn Parallel Performance Tools (below * described as Paradyn") on an AS IS basis, and do not warrant its * validity or performance. We reserve the right to update, modify, * or discontinue this software at any time. We shall have no * obligation to supply such updates or modifications or any other * form of support to you. * * This license is for research uses. For such uses, there is no * charge. We define "research use" to mean you may freely use it * inside your organization for whatever purposes you see fit. But you * may not re-distribute Paradyn or parts of Paradyn, in any form * source or binary (including derivatives), electronic or otherwise, * to any other organization or entity without our permission. * * (for other uses, please contact us at paradyn@cs.wisc.edu) * * All warranties, including without limitation, any warranty of * merchantability or fitness for a particular purpose, are hereby * excluded. * * By your use of Paradyn, you understand and agree that we (or any * other person or entity with proprietary rights in Paradyn) are * under no obligation to provide either maintenance services, * update services, notices of latent defects, or correction of * defects for Paradyn. * * Even if advised of the possibility of such damages, under no * circumstances shall we (or any other person or entity with * proprietary rights in the software licensed hereunder) be liable * to you or any third party for direct, indirect, or consequential * damages of any character regardless of type of action, including, * without limitation, loss of profits, loss of use, loss of good * will, or computer failure or malfunction. You agree to indemnify * us (and any other person or entity with proprietary rights in the * software licensed hereunder) for any and all liability it may * incur to third parties resulting from your use of Paradyn. */ #ifndef _BPatch_thread_h_ #define _BPatch_thread_h_ #include /* * The following is a kludge so that the functions that refer to signals (such * as BPatch_thread::stopSignal) can emulate the Unix behavior on Windows NT. */ #include #ifndef SIGTRAP #define SIGTRAP 5 #endif #include "BPatch_dll.h" #include "BPatch_Vector.h" #include "BPatch_image.h" #include "BPatch_snippet.h" class process; class miniTrampHandle; class BPatch; class BPatch_thread; // BPatch_callWhen is defined in BPatch_point.h /* * Used to specify whether a snippet should be installed before other snippets * that have previously been inserted at the same point, or after. */ typedef enum { BPatch_firstSnippet, BPatch_lastSnippet } BPatch_snippetOrder; /* * Contains information about the code that was inserted by an earlier call to * Bpatch_thread::insertSnippet. */ class BPATCH_DLL_EXPORT BPatchSnippetHandle { friend class BPatch_thread; private: BPatch_Vector mtHandles; public: process *proc; BPatchSnippetHandle(process *_proc) : proc(_proc) {}; ~BPatchSnippetHandle(); void add(miniTrampHandle *pointInstance); void getMiniTrampHandles(BPatch_Vector *save_mtHandles) { for(unsigned i=0; i &points, BPatch_snippetOrder order = BPatch_firstSnippet); BPatchSnippetHandle *insertSnippet( const BPatch_snippet &expr, const BPatch_Vector &points, BPatch_callWhen when, BPatch_snippetOrder order = BPatch_firstSnippet); bool deleteSnippet(BPatchSnippetHandle *handle); void setMutationsActive(bool activate); bool replaceFunctionCall(BPatch_point &point, BPatch_function &newFunc); bool removeFunctionCall(BPatch_point &point); bool replaceFunction(BPatch_function &oldFunc, BPatch_function &newFunc); void oneTimeCode(const BPatch_snippet &expr) { oneTimeCodeInternal(expr, NULL, true); }; void oneTimeCodeAsync(const BPatch_snippet &expr, void *userData = NULL) { oneTimeCodeInternal(expr, userData, false); }; //the reload argument is used by save the world to determine //if this library should be reloaded by the mutated binary //when it starts up. this is up to the user because loading //an extra shared library could hide access to the 'correct' //function by redefining a function bool loadLibrary(const char *libname, bool reload = false); //method that retrieves the line number and file name corresponding //to an address bool getLineAndFile(unsigned long addr,unsigned short& lineNo, char* fileName,int length); //returns the function containing an address BPatch_function *findFunctionByAddr(void *addr); void getCallStack(BPatch_Vector& stack); void startSaveWorld();//ccw 23 jan 2002 #ifdef IBM_BPATCH_COMPAT bool isThreaded() { return false; } bool addSharedObject(const char *name, const unsigned long loadaddr); #endif }; #endif /* BPatch_thread_h_ */