ABI.h | ABI.h | |||
---|---|---|---|---|
skipping to change at line 40 | skipping to change at line 40 | |||
#ifndef ABI_H | #ifndef ABI_H | |||
#define ABI_H | #define ABI_H | |||
#include "dyn_regs.h" | #include "dyn_regs.h" | |||
#include "bitArray.h" | #include "bitArray.h" | |||
#include <map> | #include <map> | |||
using namespace Dyninst; | using namespace Dyninst; | |||
class ABI{ | class ABI{ | |||
#if defined(cap_liveness) | ||||
static ABI* globalABI_; | static ABI* globalABI_; | |||
static ABI* globalABI64_; | static ABI* globalABI64_; | |||
std::map<MachRegister,int> *index; | std::map<MachRegister,int> *index; | |||
int addr_width; | int addr_width; | |||
public: | public: | |||
DATAFLOW_EXPORT const bitArray &getCallReadRegisters() const; | DATAFLOW_EXPORT const bitArray &getCallReadRegisters() const; | |||
DATAFLOW_EXPORT const bitArray &getCallWrittenRegisters() const; | DATAFLOW_EXPORT const bitArray &getCallWrittenRegisters() const; | |||
DATAFLOW_EXPORT const bitArray &getReturnReadRegisters() const; | DATAFLOW_EXPORT const bitArray &getReturnReadRegisters() const; | |||
// No such thing as return written... | // No such thing as return written... | |||
skipping to change at line 91 | skipping to change at line 89 | |||
static bitArray syscallWritten64_; | static bitArray syscallWritten64_; | |||
static bitArray allRegs_; | static bitArray allRegs_; | |||
static bitArray allRegs64_; | static bitArray allRegs64_; | |||
static bitArray getBitArray(int size){ | static bitArray getBitArray(int size){ | |||
return bitArray(size); | return bitArray(size); | |||
} | } | |||
ABI() {} | ABI() {} | |||
#endif | ||||
}; | }; | |||
#endif //ABI_H | #endif //ABI_H | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 0 lines changed or added | |||
Archive.h | Archive.h | |||
---|---|---|---|---|
skipping to change at line 90 | skipping to change at line 90 | |||
~Archive(); | ~Archive(); | |||
bool getMember(Symtab *&img, string& member_name); | bool getMember(Symtab *&img, string& member_name); | |||
bool getMemberByOffset(Symtab *&img, Offset memberOffset); | bool getMemberByOffset(Symtab *&img, Offset memberOffset); | |||
bool getMemberByGlobalSymbol(Symtab *&img, string& symbol_name); | bool getMemberByGlobalSymbol(Symtab *&img, string& symbol_name); | |||
bool getAllMembers(vector<Symtab *> &members); | bool getAllMembers(vector<Symtab *> &members); | |||
bool isMemberInArchive(string& member_name); | bool isMemberInArchive(string& member_name); | |||
bool findMemberWithDefinition(Symtab *&obj, string& name); | bool findMemberWithDefinition(Symtab *&obj, string& name); | |||
std::string name(); | std::string name(); | |||
bool getMembersBySymbol(string name, std::vector<Symtab *> &matches); | ||||
private: | private: | |||
Archive(string &filename, bool &err); | Archive(string &filename, bool &err); | |||
Archive(char *mem_image, size_t image_size, bool &err); | Archive(char *mem_image, size_t image_size, bool &err); | |||
/** | /** | |||
* This method is architecture specific | * This method is architecture specific | |||
* | * | |||
* Post-condition: | * Post-condition: | |||
* sets serr and errMsg if there is an error | * sets serr and errMsg if there is an error | |||
* sets Symtab field of passed ArchiveMember | * sets Symtab field of passed ArchiveMember | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 2 lines changed or added | |||
BPatch.h | BPatch.h | |||
---|---|---|---|---|
skipping to change at line 40 | skipping to change at line 40 | |||
#ifndef _BPatch_h_ | #ifndef _BPatch_h_ | |||
#define _BPatch_h_ | #define _BPatch_h_ | |||
#include <stdio.h> | #include <stdio.h> | |||
#include "BPatch_dll.h" | #include "BPatch_dll.h" | |||
#include "BPatch_Vector.h" | #include "BPatch_Vector.h" | |||
#include "BPatch_Set.h" | #include "BPatch_Set.h" | |||
#include "BPatch_thread.h" | #include "BPatch_thread.h" | |||
#include "BPatch_type.h" | #include "BPatch_type.h" | |||
#include "BPatch_eventLock.h" | ||||
#include "BPatch_process.h" | #include "BPatch_process.h" | |||
#include "BPatch_enums.h" | #include "BPatch_enums.h" | |||
#include "BPatch_callbacks.h" | #include "BPatch_callbacks.h" | |||
#include <set> | ||||
class BPatch_typeCollection; | class BPatch_typeCollection; | |||
class BPatch_libInfo; | class BPatch_libInfo; | |||
class BPatch_module; | class BPatch_module; | |||
class PCProcess; | class PCProcess; | |||
class PCThread; | class PCThread; | |||
class PCEventHandler; | class PCEventHandler; | |||
class func_instance; | class func_instance; | |||
//Keep old versions defined, that way someone can test if we're more | //Keep old versions defined, that way someone can test if we're more | |||
// at or more recent than version 5.1 with '#if defined(DYNINST_5_1)' | // at or more recent than version 5.1 with '#if defined(DYNINST_5_1)' | |||
//If they want to get the current version, they should use DYNINST_MAJOR, | //If they want to get the current version, they should use DYNINST_MAJOR, | |||
// DYNINST_MINOR, and DYNINST_SUBMINOR | // DYNINST_MINOR, and DYNINST_SUBMINOR | |||
#define DYNINST_5_1 | #define DYNINST_5_1 | |||
#define DYNINST_5_2 | #define DYNINST_5_2 | |||
#define DYNINST_6_0 | #define DYNINST_6_0 | |||
#define DYNINST_6_1 | #define DYNINST_6_1 | |||
#define DYNINST_7_0 | #define DYNINST_7_0 | |||
#define DYNINST_8_0 | #define DYNINST_8_0 | |||
#define DYNINST_8_1 | ||||
#define DYNINST_8_1_1 | ||||
#define DYNINST_MAJOR 8 | #define DYNINST_MAJOR 8 | |||
#define DYNINST_MINOR 0 | #define DYNINST_MINOR 1 | |||
#define DYNINST_SUBMINOR 0 | #define DYNINST_SUBMINOR 1 | |||
#ifdef IBM_BPATCH_COMPAT | #ifdef IBM_BPATCH_COMPAT | |||
typedef void *BPatch_Address; | typedef void *BPatch_Address; | |||
#endif | #endif | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
#pragma warning(push) | #pragma warning(push) | |||
#pragma warning(disable:4251) | #pragma warning(disable:4251) | |||
#endif | #endif | |||
skipping to change at line 116 | skipping to change at line 118 | |||
char *tool; | char *tool; | |||
char *host; | char *host; | |||
} BPatch_remoteWtxInfo; | } BPatch_remoteWtxInfo; | |||
typedef struct { | typedef struct { | |||
BPatch_remote_t type; | BPatch_remote_t type; | |||
void *info; | void *info; | |||
} BPatch_remoteHost; | } BPatch_remoteHost; | |||
// -------------------------------------------------------------------- | // -------------------------------------------------------------------- | |||
#ifdef DYNINST_CLASS_NAME | class BPATCH_DLL_EXPORT BPatch { | |||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch | ||||
class BPATCH_DLL_EXPORT BPatch : public BPatch_eventLock { | ||||
friend class BPatch_thread; | friend class BPatch_thread; | |||
friend class BPatch_process; | friend class BPatch_process; | |||
friend class BPatch_point; | friend class BPatch_point; | |||
friend class PCProcess; | friend class PCProcess; | |||
friend class func_instance; | friend class func_instance; | |||
BPatch_libInfo *info; | BPatch_libInfo *info; | |||
bool typeCheckOn; | bool typeCheckOn; | |||
int lastError; | int lastError; | |||
bool debugParseOn; | bool debugParseOn; | |||
bool baseTrampDeletionOn; | bool baseTrampDeletionOn; | |||
/* If true, trampolines can recurse to their heart's content. | /* If true, trampolines can recurse to their heart's content. | |||
Defaults to false */ | Defaults to false */ | |||
bool trampRecursiveOn; | bool trampRecursiveOn; | |||
bool forceRelocation_NP; | bool forceRelocation_NP; | |||
/* If true, allows automatic relocation of functions if dyninst | /* If true,allows automatic relocation of functions if dyninst | |||
deems it necessary. Defaults to true */ | deems it necessary. Defaults to true */ | |||
bool autoRelocation_NP; | bool autoRelocation_NP; | |||
/* If true, we save FPRs in situations we normally would | /* If true, we save FPRs in situations we normally would | |||
Defaults to true */ | Defaults to true */ | |||
bool saveFloatingPointsOn; | bool saveFloatingPointsOn; | |||
bool forceSaveFloatingPointsOn; | bool forceSaveFloatingPointsOn; | |||
/* If true, we will use liveness calculations to avoid saving | /* If true, we will use liveness calculations to avoid saving | |||
registers on platforms that support it. | registers on platforms that support it. | |||
skipping to change at line 196 | skipping to change at line 194 | |||
BPatchForkCallback preForkCallback; | BPatchForkCallback preForkCallback; | |||
BPatchForkCallback postForkCallback; | BPatchForkCallback postForkCallback; | |||
BPatchExecCallback execCallback; | BPatchExecCallback execCallback; | |||
BPatchExitCallback exitCallback; | BPatchExitCallback exitCallback; | |||
BPatchOneTimeCodeCallback oneTimeCodeCallback; | BPatchOneTimeCodeCallback oneTimeCodeCallback; | |||
BPatchDynLibraryCallback dynLibraryCallback; | BPatchDynLibraryCallback dynLibraryCallback; | |||
BPatchAsyncThreadEventCallback threadCreateCallback; | BPatchAsyncThreadEventCallback threadCreateCallback; | |||
BPatchAsyncThreadEventCallback threadDestroyCallback; | BPatchAsyncThreadEventCallback threadDestroyCallback; | |||
BPatchDynamicCallSiteCallback dynamicCallSiteCallback; | BPatchDynamicCallSiteCallback dynamicCallSiteCallback; | |||
InternalSignalHandlerCallback signalHandlerCallback; | InternalSignalHandlerCallback signalHandlerCallback; | |||
BPatch_Set<long> *callbackSignals; | std::set<long> callbackSignals; | |||
InternalCodeOverwriteCallback codeOverwriteCallback; | InternalCodeOverwriteCallback codeOverwriteCallback; | |||
BPatch_Vector<BPatchUserEventCallback> userEventCallbacks; | BPatch_Vector<BPatchUserEventCallback> userEventCallbacks; | |||
BPatch_Vector<BPatchStopThreadCallback> stopThreadCallbacks; | BPatch_Vector<BPatchStopThreadCallback> stopThreadCallbacks; | |||
public: | public: | |||
/* And auxiliary functions for the above */ | ||||
/* These are NOT part of the API, do not use externally */ | ||||
void signalNotificationFD(); // Called when an event happens | ||||
void clearNotificationFD(); // Called during poll/waitForStatusChange | ||||
void createNotificationFD(); // Creates the FD | ||||
public: | public: | |||
static BPatch *bpatch; | static BPatch *bpatch; | |||
static BPatch *getBPatch(); | static BPatch *getBPatch(); | |||
BPatch_builtInTypeCollection *builtInTypes; | BPatch_builtInTypeCollection *builtInTypes; | |||
BPatch_typeCollection *stdTypes; | BPatch_typeCollection *stdTypes; | |||
BPatch_typeCollection *APITypes; //API/User defined types | BPatch_typeCollection *APITypes; //API/User defined types | |||
BPatch_type *type_Error; | BPatch_type *type_Error; | |||
BPatch_type *type_Untyped; | BPatch_type *type_Untyped; | |||
skipping to change at line 265 | skipping to change at line 257 | |||
void clearError() { lastError = 0; } | void clearError() { lastError = 0; } | |||
int getLastError() { return lastError; } | int getLastError() { return lastError; } | |||
// End of functions that are for internal use only | // End of functions that are for internal use only | |||
public: | public: | |||
BPatch(); | BPatch(); | |||
// BPatch::~BPatch | // BPatch::~BPatch | |||
// destructor | // destructor | |||
API_EXPORT_DTOR(_dtor, (), | ~BPatch(); | |||
~,BPatch,()); | ||||
static const char *getEnglishErrorString(int number); | static const char *getEnglishErrorString(int number); | |||
static void formatErrorString(char *dst, int size, | static void formatErrorString(char *dst, int size, | |||
const char *fmt, const char * const *param s); | const char *fmt, const char * const *param s); | |||
// BPatch::isTypeChecked: | // BPatch::isTypeChecked: | |||
// returns whether type checking is on. | // returns whether type checking is on. | |||
API_EXPORT(Int, (), | bool isTypeChecked(); | |||
bool,isTypeChecked,()); | ||||
// BPatch::parseDebugInfo: | // BPatch::parseDebugInfo: | |||
// returns whether debugging information is set to be parsed | // returns whether debugging information is set to be parsed | |||
API_EXPORT(Int, (), | bool parseDebugInfo(); | |||
bool,parseDebugInfo,()); | ||||
// BPatch::baseTrampDeletion: | // BPatch::baseTrampDeletion: | |||
// returns whether base trampolines are set to be deleted | // returns whether base trampolines are set to be deleted | |||
API_EXPORT(Int, (), | bool baseTrampDeletion(); | |||
bool,baseTrampDeletion,()); | ||||
// BPatch::setPrelinkCommand | // BPatch::setPrelinkCommand | |||
// sets the fully qualified path name of the prelink command | // sets the fully qualified path name of the prelink command | |||
API_EXPORT_V(Int, (command), | void setPrelinkCommand(char *command); | |||
void,setPrelinkCommand,(char *command)); | ||||
// BPatch::getPrelinkCommand | // BPatch::getPrelinkCommand | |||
// gets the fully qualified path name of the prelink command | // gets the fully qualified path name of the prelink command | |||
API_EXPORT(Int, (), | char* getPrelinkCommand(); | |||
char*,getPrelinkCommand,()); | ||||
// BPatch::isTrampRecursive: | // BPatch::isTrampRecursive: | |||
// returns whether trampolines are set to handle recursive instrumentat ion | // returns whether trampolines are set to handle recursive instrumentat ion | |||
API_EXPORT(Int, (), | bool isTrampRecursive(); | |||
bool,isTrampRecursive,()); | ||||
// BPatch::isMergeTramp: | // BPatch::isMergeTramp: | |||
// returns whether base tramp and mini-tramp is merged | // returns whether base tramp and mini-tramp is merged | |||
API_EXPORT(Int, (), | bool isMergeTramp(); | |||
bool,isMergeTramp,()); | ||||
// BPatch::saveFPROn: | // BPatch::saveFPROn: | |||
// returns whether base tramp and mini-tramp is merged | // returns whether base tramp and mini-tramp is merged | |||
API_EXPORT(Int, (), | bool isSaveFPROn(); | |||
bool,isSaveFPROn,()); | ||||
// BPatch::forceSaveFPROn: | // BPatch::forceSaveFPROn: | |||
// returns whether base tramp and mini-tramp is merged | // returns whether base tramp and mini-tramp is merged | |||
API_EXPORT(Int, (), | bool isForceSaveFPROn(); | |||
bool,isForceSaveFPROn,()); | ||||
// BPatch::hasForcedRelocation_NP: | // BPatch::hasForcedRelocation_NP: | |||
// returns whether all instrumented functions will be relocated | // returns whether all instrumented functions will be relocated | |||
API_EXPORT(Int, (), | ||||
bool,hasForcedRelocation_NP,()); | bool hasForcedRelocation_NP(); | |||
// BPatch::autoRelocationsOn: | // BPatch::autoRelocationsOn: | |||
// returns whether functions will be relocated when appropriate | // returns whether functions will be relocated when appropriate | |||
API_EXPORT(Int, (), | ||||
bool,autoRelocationOn,()); | bool autoRelocationOn(); | |||
// BPatch::delayedParsingOn: | // BPatch::delayedParsingOn: | |||
// returns whether inst info is parsed a priori, or on demand | // returns whether inst info is parsed a priori, or on demand | |||
API_EXPORT(Int, (), | ||||
bool,delayedParsingOn,()); | bool delayedParsingOn(); | |||
// Liveness... | // Liveness... | |||
API_EXPORT(Int, (), | ||||
bool, livenessAnalysisOn, ()); | ||||
API_EXPORT(Int, (), | bool livenessAnalysisOn(); | |||
int, livenessAnalysisDepth, ()); | ||||
int livenessAnalysisDepth(); | ||||
// User-specified callback functions... | // User-specified callback functions... | |||
// BPatch::registerErrorCallback: | // BPatch::registerErrorCallback: | |||
// Register error handling/reporting callback | // Register error handling/reporting callback | |||
API_EXPORT(Int, (function), | ||||
BPatchErrorCallback, registerErrorCallback,(BPatchErrorCallback functio n)); | BPatchErrorCallback registerErrorCallback(BPatchErrorCallback function) ; | |||
// BPatch::registerDynLibraryCallback: | // BPatch::registerDynLibraryCallback: | |||
// Register callback for new library events (eg. load) | // Register callback for new library events (eg. load) | |||
API_EXPORT(Int, (func), | ||||
BPatchDynLibraryCallback, registerDynLibraryCallback,(BPatchDynLibraryC allback func)); | BPatchDynLibraryCallback registerDynLibraryCallback(BPatchDynLibraryCal lback func); | |||
// BPatch::registerPostForkCallback: | // BPatch::registerPostForkCallback: | |||
// Register callback to handle mutatee fork events (before fork) | // Register callback to handle mutatee fork events (before fork) | |||
API_EXPORT(Int, (func), | ||||
BPatchForkCallback, registerPostForkCallback,(BPatchForkCallback func)) ; | BPatchForkCallback registerPostForkCallback(BPatchForkCallback func); | |||
// BPatch::registerPreForkCallback: | // BPatch::registerPreForkCallback: | |||
// Register callback to handle mutatee fork events (before fork) | // Register callback to handle mutatee fork events (before fork) | |||
API_EXPORT(Int, (func), | ||||
BPatchForkCallback, registerPreForkCallback,(BPatchForkCallback func)); | BPatchForkCallback registerPreForkCallback(BPatchForkCallback func); | |||
// BPatch::registerExecCallback: | // BPatch::registerExecCallback: | |||
// Register callback to handle mutatee exec events | // Register callback to handle mutatee exec events | |||
API_EXPORT(Int, (func), | ||||
BPatchExecCallback, registerExecCallback,(BPatchExecCallback func)); | BPatchExecCallback registerExecCallback(BPatchExecCallback func); | |||
// BPatch::registerExitCallback: | // BPatch::registerExitCallback: | |||
// Register callback to handle mutatee exit events | // Register callback to handle mutatee exit events | |||
API_EXPORT(Int, (func), | ||||
BPatchExitCallback, registerExitCallback,(BPatchExitCallback func)); | BPatchExitCallback registerExitCallback(BPatchExitCallback func); | |||
// BPatch::registerOneTimeCodeCallback: | // BPatch::registerOneTimeCodeCallback: | |||
// Register callback to run at completion of oneTimeCode | // Register callback to run at completion of oneTimeCode | |||
API_EXPORT(Int, (func), | ||||
BPatchOneTimeCodeCallback, registerOneTimeCodeCallback,(BPatchOneTimeCo | BPatchOneTimeCodeCallback registerOneTimeCodeCallback(BPatchOneTimeCode | |||
deCallback func)); | Callback func); | |||
// BPatch::registerThreadEventCallback | // BPatch::registerThreadEventCallback | |||
// Registers a callback to run when a thread is created | // Registers a callback to run when a thread is created | |||
API_EXPORT(Int, (type,cb), | ||||
bool,registerThreadEventCallback,(BPatch_asyncEventType type, | bool registerThreadEventCallback(BPatch_asyncEventType type, | |||
BPatchAsyncThreadEventCallback cb)); | BPatchAsyncThreadEventCallback cb); | |||
// BPatch::removeThreadEventCallback | // BPatch::removeThreadEventCallback | |||
// Registers a callback to run when a thread is destroyed | // Registers a callback to run when a thread is destroyed | |||
API_EXPORT(Int, (type,cb), | ||||
bool,removeThreadEventCallback,(BPatch_asyncEventType type, | bool removeThreadEventCallback(BPatch_asyncEventType type, | |||
BPatchAsyncThreadEventCallback cb)); | BPatchAsyncThreadEventCallback cb); | |||
// BPatch::registerDynamicCallCallback | // BPatch::registerDynamicCallCallback | |||
// Specifies a user-supplied function to be called when a dynamic call is | // Specifies a user-supplied function to be called when a dynamic call is | |||
// executed. | // executed. | |||
API_EXPORT(Int, (cb), | bool registerDynamicCallCallback(BPatchDynamicCallSiteCallback cb); | |||
bool,registerDynamicCallCallback,(BPatchDynamicCallSiteCallback cb)); | ||||
API_EXPORT(Int, (cb), | bool removeDynamicCallCallback(BPatchDynamicCallSiteCallback cb); | |||
bool,removeDynamicCallCallback,(BPatchDynamicCallSiteCallback cb)); | ||||
// BPatch::registerUserEventCallback | // BPatch::registerUserEventCallback | |||
// | // | |||
// Specifies a user defined function to call when a "user event" | // Specifies a user defined function to call when a "user event" | |||
// occurs, user events are trigger by calls to the function | // occurs, user events are trigger by calls to the function | |||
// DYNINSTuserMessage(void *, int) in the runtime library. | // DYNINSTuserMessage(void *, int) in the runtime library. | |||
// | // | |||
// BPatchUserEventCallback is: | // BPatchUserEventCallback is: | |||
// void (*BPatchUserEventCallback)(void *msg, unsigned int msg_size); | // void (*BPatchUserEventCallback)(void *msg, unsigned int msg_size); | |||
API_EXPORT(Int, (cb), | bool registerUserEventCallback(BPatchUserEventCallback cb); | |||
bool,registerUserEventCallback,(BPatchUserEventCallback cb)); | ||||
API_EXPORT(Int, (cb), | bool removeUserEventCallback(BPatchUserEventCallback cb); | |||
bool,removeUserEventCallback,(BPatchUserEventCallback cb)); | ||||
// BPatch::registerSignalHandlerCallback | // BPatch::registerSignalHandlerCallback | |||
// | // | |||
// If the mutator produces a signal matching an element of | // If the mutator produces a signal matching an element of | |||
// signal_numbers, the callback is invoked, returning the point | // signal_numbers, the callback is invoked, returning the point | |||
// that caused the exception, the signal number, and a Vector | // that caused the exception, the signal number, and a Vector | |||
// representing the address of signal handler(s) in the mutatee | // representing the address of signal handler(s) in the mutatee | |||
// for the exception. In Windows this is the handler stack, each | // for the exception. In Windows this is the handler stack, each | |||
// function of which is invoked until one is found that agrees to | // function of which is invoked until one is found that agrees to | |||
// handle the exception. In Unix there will be at most one | // handle the exception. In Unix there will be at most one | |||
// handler for the signal number, the handler registered with | // handler for the signal number, the handler registered with | |||
// syscalls signal() or sigaction(), or the default system | // syscalls signal() or sigaction(), or the default system | |||
// handler, in which case we return an empty vector. | // handler, in which case we return an empty vector. | |||
API_EXPORT(Int, (cb,signal_numbers), | ||||
bool,registerSignalHandlerCallback, | bool registerSignalHandlerCallback(BPatchSignalHandlerCallback cb, | |||
(BPatchSignalHandlerCallback cb, | std::set<long> &signal_numbers); | |||
BPatch_Set<long> *signal_numbers)); | bool registerSignalHandlerCallback(BPatchSignalHandlerCallback cb, | |||
BPatch_Set<long> *signal_numbers); | ||||
API_EXPORT(Int, (cb), | ||||
bool,removeSignalHandlerCallback,(BPatchSignalHandlerCallback cb)); | bool removeSignalHandlerCallback(BPatchSignalHandlerCallback cb); | |||
API_EXPORT(Int, (cb), | bool registerCodeDiscoveryCallback(BPatchCodeDiscoveryCallback cb); | |||
bool,registerCodeDiscoveryCallback,(BPatchCodeDiscoveryCallback cb)); | ||||
API_EXPORT(Int, (cb), | bool removeCodeDiscoveryCallback(BPatchCodeDiscoveryCallback cb); | |||
bool,removeCodeDiscoveryCallback,(BPatchCodeDiscoveryCallback cb)); | ||||
// BPatch::registerCodeOverwriteCallbacks | // BPatch::registerCodeOverwriteCallbacks | |||
// | // | |||
// Registers a callback at the beginning and end of overwrite events | // Registers a callback at the beginning and end of overwrite events | |||
API_EXPORT(Int, (cbBegin, cbEnd), | ||||
bool,registerCodeOverwriteCallbacks, | bool registerCodeOverwriteCallbacks | |||
(BPatchCodeOverwriteBeginCallback cbBegin, | (BPatchCodeOverwriteBeginCallback cbBegin, | |||
BPatchCodeOverwriteEndCallback cbEnd)); | BPatchCodeOverwriteEndCallback cbEnd); | |||
// BPatch::getProcesses: | // BPatch::getProcesses: | |||
// Get a vector of all processes | // Get a vector of all processes | |||
API_EXPORT(Int, (), | ||||
BPatch_Vector<BPatch_process*> *,getProcesses,()); | BPatch_Vector<BPatch_process*> * getProcesses(); | |||
// | // | |||
// General BPatch parameter settings: | // General BPatch parameter settings: | |||
// | // | |||
// BPatch::setDebugParsing: | // BPatch::setDebugParsing: | |||
// Turn on/off parsing of debug section(s) | // Turn on/off parsing of debug section(s) | |||
API_EXPORT_V(Int, (x), | ||||
void,setDebugParsing,(bool x)); | void setDebugParsing(bool x); | |||
// BPatch::setBaseTrampDeletion: | // BPatch::setBaseTrampDeletion: | |||
// Turn on/off deletion of base tramp | // Turn on/off deletion of base tramp | |||
API_EXPORT_V(Int, (x), | ||||
void,setBaseTrampDeletion,(bool x)); | void setBaseTrampDeletion(bool x); | |||
// BPatch::setTypeChecking: | // BPatch::setTypeChecking: | |||
// Turn on/off type checking | // Turn on/off type checking | |||
API_EXPORT_V(Int, (x), | ||||
void,setTypeChecking,(bool x)); | void setTypeChecking(bool x); | |||
API_EXPORT_V(Int, (b), | void setInstrStackFrames(bool b); | |||
void,setInstrStackFrames,(bool b)); | ||||
API_EXPORT(Int, (), | bool getInstrStackFrames(); | |||
bool,getInstrStackFrames,()); | ||||
// BPatch::setTypeChecking: | // BPatch::setTypeChecking: | |||
// Turn on/off line info truncating | // Turn on/off line info truncating | |||
API_EXPORT_V(Int, (x), | ||||
void,truncateLineInfoFilenames,(bool x)); | void truncateLineInfoFilenames(bool x); | |||
// BPatch::setTrampRecursive: | // BPatch::setTrampRecursive: | |||
// Turn on/off recursive trampolines | // Turn on/off recursive trampolines | |||
API_EXPORT_V(Int, (x), | ||||
void,setTrampRecursive,(bool x)); | void setTrampRecursive(bool x); | |||
// BPatch::setMergeTramp: | // BPatch::setMergeTramp: | |||
// Turn on/off merged base & mini-tramps | // Turn on/off merged base & mini-tramps | |||
API_EXPORT_V(Int, (x), | ||||
void,setMergeTramp,(bool x)); | void setMergeTramp(bool x); | |||
// BPatch::setSaveFPR: | // BPatch::setSaveFPR: | |||
// Turn on/off merged base & mini-tramps | // Turn on/off merged base & mini-tramps | |||
API_EXPORT_V(Int, (x), | ||||
void,setSaveFPR,(bool x)); | void setSaveFPR(bool x); | |||
// BPatch::forceSaveFPR: | // BPatch::forceSaveFPR: | |||
// Force Turn on/off merged base & mini-tramps - ignores isConservativ e | // Force Turn on/off merged base & mini-tramps - ignores isConservativ e | |||
API_EXPORT_V(Int, (x), | ||||
void,forceSaveFPR,(bool x)); | void forceSaveFPR(bool x); | |||
// BPatch::setForcedRelocation_NP: | // BPatch::setForcedRelocation_NP: | |||
// Turn on/off forced relocation of instrumted functions | // Turn on/off forced relocation of instrumted functions | |||
API_EXPORT_V(Int, (x), | ||||
void,setForcedRelocation_NP,(bool x)); | void setForcedRelocation_NP(bool x); | |||
// BPatch::setAutoRelocation_NP: | // BPatch::setAutoRelocation_NP: | |||
// Turn on/off function relocations, performed when necessary | // Turn on/off function relocations, performed when necessary | |||
API_EXPORT_V(Int, (x), | ||||
void,setAutoRelocation_NP,(bool x)); | void setAutoRelocation_NP(bool x); | |||
// BPatch::setDelayedParsing: | // BPatch::setDelayedParsing: | |||
// Turn on/off delayed parsing | // Turn on/off delayed parsing | |||
API_EXPORT_V(Int, (x), | ||||
void,setDelayedParsing,(bool x)); | void setDelayedParsing(bool x); | |||
// Liveness... | // Liveness... | |||
API_EXPORT_V(Int, (x), | ||||
void, setLivenessAnalysis, (bool x)); | ||||
API_EXPORT_V(Int, (x), | void setLivenessAnalysis(bool x); | |||
void, setLivenessAnalysisDepth, (int x)); | ||||
void setLivenessAnalysisDepth(int x); | ||||
// BPatch::processCreate: | // BPatch::processCreate: | |||
// Create a new mutatee process | // Create a new mutatee process | |||
API_EXPORT(Int, (path, argv, envp, stdin_fd, stdout_fd, stderr_fd, mode | ||||
), | BPatch_process * processCreate(const char *path, | |||
BPatch_process *,processCreate,(const char *path, | const char *argv[], | |||
const char *argv[], | const char **envp = NULL, | |||
const char **envp = NULL, | int stdin_fd=0, | |||
int stdin_fd=0, | int stdout_fd=1, | |||
int stdout_fd=1, | int stderr_fd=2, | |||
int stderr_fd=2, | BPatch_hybridMode mode=BPatch_normalMode) | |||
BPatch_hybridMode mode=BPatch_normalMod | ; | |||
e)); | ||||
// BPatch::processAttach | // BPatch::processAttach | |||
// Attach to mutatee process | // Attach to mutatee process | |||
API_EXPORT(Int, (path, pid, mode), | ||||
BPatch_process *,processAttach,(const char *path, int pid, | BPatch_process *processAttach(const char *path, int pid, | |||
BPatch_hybridMode mode=BPatch_normalMod | BPatch_hybridMode mode=BPatch_normalMod | |||
e)); | e); | |||
// BPatch::openBinary | // BPatch::openBinary | |||
// Open a binary for static instrumentation | // Open a binary for static instrumentation | |||
// | // | |||
// The second parameter really should be a boolean, but the value | // The second parameter really should be a boolean, but the value | |||
// gets reset between the openBinary and openBinaryInt calls--is | // gets reset between the openBinary and openBinaryInt calls--is | |||
// this a gcc bug??? | // this a gcc bug??? | |||
// | // | |||
API_EXPORT(Int, (path, openDependencies), | ||||
BPatch_binaryEdit *, openBinary, (const char *path, bool ope | BPatch_binaryEdit * openBinary(const char *path, bool openDe | |||
nDependencies = false)); | pendencies = false); | |||
// BPatch::createEnum: | // BPatch::createEnum: | |||
// Create Enum types. | // Create Enum types. | |||
API_EXPORT(Int, (name, elementNames, elementIds), | ||||
BPatch_type *,createEnum,(const char * name, BPatch_Vector<char *> &ele | BPatch_type *createEnum(const char * name, BPatch_Vector<char *> &eleme | |||
mentNames, | ntNames, | |||
BPatch_Vector<int> &elementIds)); | BPatch_Vector<int> &elementIds); | |||
// BPatch::createEnum: | // BPatch::createEnum: | |||
// API selects elementIds | // API selects elementIds | |||
API_EXPORT(AutoId, (name, elementNames), | ||||
BPatch_type *,createEnum,(const char * name, BPatch_Vector<char *> &ele mentNames)); | BPatch_type *createEnum(const char * name, BPatch_Vector<char *> &eleme ntNames); | |||
// BPatch::createStruct: | // BPatch::createStruct: | |||
// Create Struct types. | // Create Struct types. | |||
API_EXPORT(Int, (name, fieldNames, fieldTypes), | ||||
BPatch_type *,createStruct,(const char * name, BPatch_Vector<char *> &f | BPatch_type *createStruct(const char * name, BPatch_Vector<char *> &fie | |||
ieldNames, | ldNames, | |||
BPatch_Vector<BPatch_type *> &fieldTypes)); | BPatch_Vector<BPatch_type *> &fieldTypes); | |||
// BPatch::createUnion: | // BPatch::createUnion: | |||
// Create Union types. | // Create Union types. | |||
API_EXPORT(Int, (name, fieldNames, fieldTypes), | ||||
BPatch_type *,createUnion,(const char * name, BPatch_Vector<char *> &fi | BPatch_type *createUnion(const char * name, BPatch_Vector<char *> &fiel | |||
eldNames, | dNames, | |||
BPatch_Vector<BPatch_type *> &fieldTypes)); | BPatch_Vector<BPatch_type *> &fieldTypes); | |||
// BPatch::createArray: | // BPatch::createArray: | |||
// Creates BPatch_array type or symtyperanges ( scalars with upper and | // Creates BPatch_array type or symtyperanges ( scalars with upper and | |||
//lower bound). | //lower bound). | |||
API_EXPORT(Int, (name, ptr, low, hi), | ||||
BPatch_type *,createArray,(const char * name, BPatch_type * ptr, | BPatch_type *createArray(const char * name, BPatch_type * ptr, | |||
unsigned int low, unsigned int hi)); | unsigned int low, unsigned int hi); | |||
// BPatch::createPointer: | // BPatch::createPointer: | |||
// Creates BPatch_pointer types | // Creates BPatch_pointer types | |||
API_EXPORT(Int, (name, ptr, size), | ||||
BPatch_type *,createPointer,(const char * name, BPatch_type * ptr, | BPatch_type *createPointer(const char * name, BPatch_type * ptr, | |||
int size = sizeof(void *))); | int size = sizeof(void *)); | |||
// BPatch::createScalar: | // BPatch::createScalar: | |||
// Creates BPatch_scalar types | // Creates BPatch_scalar types | |||
API_EXPORT(Int, (name, size), | ||||
BPatch_type *,createScalar,(const char * name, int size)); | BPatch_type *createScalar(const char * name, int size); | |||
// BPatch::createTypedef: | // BPatch::createTypedef: | |||
// Creates typedefs. | // Creates typedefs. | |||
API_EXPORT(Int, (name, ptr), | ||||
BPatch_type *,createTypedef,(const char * name, BPatch_type * ptr)); | BPatch_type *createTypedef(const char * name, BPatch_type * ptr); | |||
// User programs are required to call pollForStatusChange or | // User programs are required to call pollForStatusChange or | |||
// waitForStatusChange before user-level callback functions | // waitForStatusChange before user-level callback functions | |||
// are executed (for example, fork, exit, or a library load). | // are executed (for example, fork, exit, or a library load). | |||
// Non-blocking form; returns immediately if no callback is | // Non-blocking form; returns immediately if no callback is | |||
// ready, or executes callback(s) then returns. | // ready, or executes callback(s) then returns. | |||
API_EXPORT(Int, (), | ||||
bool,pollForStatusChange,()); | bool pollForStatusChange(); | |||
// Blocks until a callback is ready. | // Blocks until a callback is ready. | |||
API_EXPORT(Int, (), | ||||
bool,waitForStatusChange,()); | bool waitForStatusChange(); | |||
// For user programs that block on other things as well, | // For user programs that block on other things as well, | |||
// we provide a (simulated) file descriptor that can be added | // we provide a (simulated) file descriptor that can be added | |||
// to a poll or select fdset. When a callback is prepared the BPatch | // to a poll or select fdset. When a callback is prepared the BPatch | |||
// layer writes to this fd, thus making poll/select return. The user | // layer writes to this fd, thus making poll/select return. The user | |||
// program should then call pollForStatusChange. The BPatch layer | // program should then call pollForStatusChange. The BPatch layer | |||
// will handle clearing the file descriptor; all the program must do | // will handle clearing the file descriptor; all the program must do | |||
// is call pollForStatusChange or waitForStatusChange. | // is call pollForStatusChange or waitForStatusChange. | |||
API_EXPORT(Int, (), | ||||
int, getNotificationFD, ()); | int getNotificationFD(); | |||
// BPatch:: waitUntilStopped: | // BPatch:: waitUntilStopped: | |||
// Block until specified process has stopped. | // Block until specified process has stopped. | |||
API_EXPORT(Int, (appThread), | ||||
bool,waitUntilStopped,(BPatch_thread *appThread)); | bool waitUntilStopped(BPatch_thread *appThread); | |||
// BPatch::getBPatchStatistics: | // BPatch::getBPatchStatistics: | |||
// Get Instrumentation statistics | // Get Instrumentation statistics | |||
API_EXPORT(Int, (), | ||||
BPatch_stats &,getBPatchStatistics,()); | BPatch_stats & getBPatchStatistics(); | |||
API_EXPORT_V(Int, (major, minor, subminor), | void getBPatchVersion(int &major, int &minor, int &subminor); | |||
void ,getBPatchVersion,(int &major, int &minor, int &subminor)); | ||||
// These three should probably be moved into their own BPatch_* class. | // These three should probably be moved into their own BPatch_* class. | |||
// Perhaps BPatch_remoteDebug? | // Perhaps BPatch_remoteDebug? | |||
API_EXPORT(Int, (), | ||||
bool, isConnected, ()); | ||||
API_EXPORT(Int, (remote), | bool isConnected(); | |||
bool, remoteConnect, (BPatch_remoteHost &remote)); | ||||
API_EXPORT(Int, (remote, pidlist), | bool remoteConnect(BPatch_remoteHost &remote); | |||
bool,getPidList,(BPatch_remoteHost &remote, BPatch_Vector<unsigned int> | ||||
&pidlist)); | ||||
API_EXPORT(Int, (remote, pid, pidStr), | bool getPidList(BPatch_remoteHost &remote, BPatch_Vector<unsigned int> | |||
bool,getPidInfo,(BPatch_remoteHost &remote, unsigned int pid, std::stri | &pidlist); | |||
ng &pidStr)); | ||||
API_EXPORT(Int, (remote), | bool getPidInfo(BPatch_remoteHost &remote, unsigned int pid, std::strin | |||
bool, remoteDisconnect, (BPatch_remoteHost &remote)); | g &pidStr); | |||
bool remoteDisconnect(BPatch_remoteHost &remote); | ||||
// BPatch::addNonReturningFunc: | // BPatch::addNonReturningFunc: | |||
// Globally specify that any function with a given name will not retur n | // Globally specify that any function with a given name will not retur n | |||
API_EXPORT_V(Int, (name), | ||||
void, addNonReturningFunc, (std::string name)); | void addNonReturningFunc(std::string name); | |||
}; | }; | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
#pragma warning(pop) | #pragma warning(pop) | |||
#endif | #endif | |||
#endif /* _BPatch_h_ */ | #endif /* _BPatch_h_ */ | |||
End of changes. 107 change blocks. | ||||
199 lines changed or deleted | 127 lines changed or added | |||
BPatch_Set.h | BPatch_Set.h | |||
---|---|---|---|---|
skipping to change at line 59 | skipping to change at line 59 | |||
#include <iterator> | #include <iterator> | |||
#include <functional> | #include <functional> | |||
#if !defined(DO_INLINE_P) | #if !defined(DO_INLINE_P) | |||
#define DO_INLINE_P | #define DO_INLINE_P | |||
#endif | #endif | |||
#if !defined(DO_INLINE_F) | #if !defined(DO_INLINE_F) | |||
#define DO_INLINE_F | #define DO_INLINE_F | |||
#endif | #endif | |||
class BPatch_basicBlock; | ||||
class BPatch_function; | ||||
class BPatch_flowGraph; | ||||
class BPatch; | ||||
/** template struct that will be used for default compare | /** template struct that will be used for default compare | |||
* class for BPatch_Set operations. | * class for BPatch_Set operations. | |||
*/ | */ | |||
/** template class for BPatch_Set. The implementation is based on red black | ||||
* tree implementation for efficiency concerns and for getting sorted | ||||
* elements easier. The template depends on two types. The first one is th | ||||
e | ||||
* the type of the elements in the BPatch_Set and the second one is the te | ||||
mplate | ||||
* structure that is used to compare the elements of the BPatch_Set. The t | ||||
emplate | ||||
* structure has to overload () for comparison of two elements as explaine | ||||
d above | ||||
*/ | ||||
typedef enum { RED, BLACK } bpatch_entry_color_type; | ||||
template <class T> | template <class T> | |||
struct comparison { | struct comparison { | |||
bool operator() (const T&l, const T&r) const { return l < r; } | bool operator() (const T&l, const T&r) const { return l < r; } | |||
}; | }; | |||
template<class Key, class Compare = comparison<Key> > | template<class Key, class Compare = comparison<Key> > | |||
class BPATCH_DLL_EXPORT BPatch_Set { | class BPATCH_DLL_EXPORT BPatch_Set { | |||
friend class BPatch_basicBlock; | ||||
friend class BPatch_function; | ||||
friend class BPatch_flowGraph; | ||||
friend class BPatch; | ||||
typedef std::set<Key, Compare> int_t; | typedef std::set<Key, Compare> int_t; | |||
int_t int_set; | int_t int_set; | |||
public: | public: | |||
typedef typename int_t::iterator iterator; | typedef typename int_t::iterator iterator; | |||
typedef typename int_t::const_iterator const_iterator; | typedef typename int_t::const_iterator const_iterator; | |||
typedef typename int_t::reverse_iterator reverse_iterator; | typedef typename int_t::reverse_iterator reverse_iterator; | |||
typedef typename int_t::const_reverse_iterator const_reverse_iterator; | typedef typename int_t::const_reverse_iterator const_reverse_iterator; | |||
iterator begin() { return int_set.begin(); } | DO_INLINE_F iterator begin() { return int_set.begin(); } | |||
const_iterator begin() const { return int_set.begin(); } | DO_INLINE_F const_iterator begin() const { return int_set.begin(); } | |||
iterator end() { return int_set.end(); } | DO_INLINE_F iterator end() { return int_set.end(); } | |||
const_iterator end() const { return int_set.end(); } | DO_INLINE_F const_iterator end() const { return int_set.end(); } | |||
reverse_iterator rbegin() { return int_set.rbegin(); } | DO_INLINE_F reverse_iterator rbegin() { return int_set.rbegin(); } | |||
const_reverse_iterator rbegin() const { return int_set.rbegin(); } | DO_INLINE_F const_reverse_iterator rbegin() const { return int_set.rbegi | |||
reverse_iterator rend() { return int_set.rend(); } | n(); } | |||
const_reverse_iterator rend() const { return int_set.rend(); } | DO_INLINE_F reverse_iterator rend() { return int_set.rend(); } | |||
DO_INLINE_F const_reverse_iterator rend() const { return int_set.rend(); | ||||
} | ||||
DO_INLINE_F BPatch_Set() {}; | DO_INLINE_F BPatch_Set() {}; | |||
DO_INLINE_F BPatch_Set(int_t s) : int_set(s) {}; | ||||
/** copy constructor. | /** copy constructor. | |||
* @param newBPatch_Set the BPatch_Set which will be copied | * @param newBPatch_Set the BPatch_Set which will be copied | |||
*/ | */ | |||
DO_INLINE_F BPatch_Set(const BPatch_Set<Key,Compare>& rhs){ | DO_INLINE_F BPatch_Set(const BPatch_Set<Key,Compare>& rhs){ | |||
int_set = rhs.int_set; | int_set = rhs.int_set; | |||
} | } | |||
/** returns the cardinality of the tree , number of elements */ | /** returns the cardinality of the tree , number of elements */ | |||
DO_INLINE_F unsigned int size() const { return int_set.size(); } | DO_INLINE_F unsigned int size() const { return int_set.size(); } | |||
End of changes. 5 change blocks. | ||||
23 lines changed or deleted | 23 lines changed or added | |||
BPatch_addressSpace.h | BPatch_addressSpace.h | |||
---|---|---|---|---|
skipping to change at line 37 | skipping to change at line 37 | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | */ | |||
#ifndef _BPatch_addressSpace_h_ | #ifndef _BPatch_addressSpace_h_ | |||
#define _BPatch_addressSpace_h_ | #define _BPatch_addressSpace_h_ | |||
#include "boost/shared_ptr.hpp" | #include "boost/shared_ptr.hpp" | |||
#include "BPatch_dll.h" | #include "BPatch_dll.h" | |||
#include "BPatch_Vector.h" | #include "BPatch_Vector.h" | |||
#include "BPatch_eventLock.h" | ||||
#include "BPatch_enums.h" | #include "BPatch_enums.h" | |||
#include "BPatch_instruction.h" // for register type | #include "BPatch_instruction.h" // for register type | |||
#include "BPatch_callbacks.h" | #include "BPatch_callbacks.h" | |||
#include <vector> | #include <vector> | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <signal.h> | #include <signal.h> | |||
// PatchAPI stuffs | // PatchAPI stuffs | |||
//#include "Command.h" | //#include "Command.h" | |||
class BPatch_addressSpace; | class BPatch_addressSpace; | |||
namespace Dyninst { | namespace Dyninst { | |||
namespace PatchAPI { | namespace PatchAPI { | |||
class PatchMgr; | class PatchMgr; | |||
class DynAddrSpace; | class DynAddrSpace; | |||
class Patcher; | class Patcher; | |||
class Instance; | class Instance; | |||
class PatchFunction; | class PatchFunction; | |||
class Point; | class Point; | |||
typedef boost::shared_ptr<PatchMgr> PatchMgrPtr; | typedef boost::shared_ptr<PatchMgr> PatchMgrPtr; | |||
typedef boost::shared_ptr<DynAddrSpace> DynAddrSpacePtr; | typedef boost::shared_ptr<DynAddrSpace> DynAddrSpacePtr; | |||
typedef boost::shared_ptr<Instance> InstancePtr; | typedef boost::shared_ptr<Instance> InstancePtr; | |||
PatchMgrPtr convert(const BPatch_addressSpace *); | BPATCH_DLL_EXPORT PatchMgrPtr convert(const BPatch_addressSpace *); | |||
}; | }; | |||
namespace SymtabAPI { | namespace SymtabAPI { | |||
class Symbol; | class Symbol; | |||
}; | }; | |||
} | } | |||
class BPatch_statement; | class BPatch_statement; | |||
class BPatch_snippet; | class BPatch_snippet; | |||
class BPatch_point; | class BPatch_point; | |||
class BPatch_variableExpr; | class BPatch_variableExpr; | |||
class BPatch_type; | class BPatch_type; | |||
class AddressSpace; | class AddressSpace; | |||
class miniTrampHandle; | class miniTrampHandle; | |||
class miniTramp; | class miniTramp; | |||
skipping to change at line 89 | skipping to change at line 88 | |||
class BPatch_image; | class BPatch_image; | |||
struct batchInsertionRecord; | struct batchInsertionRecord; | |||
class instPoint; | class instPoint; | |||
class int_variable; | class int_variable; | |||
typedef enum{ | typedef enum{ | |||
TRADITIONAL_PROCESS, STATIC_EDITOR | TRADITIONAL_PROCESS, STATIC_EDITOR | |||
} processType; | } processType; | |||
#ifdef DYNINST_CLASS_NAME | class BPATCH_DLL_EXPORT BPatchSnippetHandle { | |||
#undef DYNINST_CLASS_NAME | friend class BPatch_point; | |||
#endif | friend class BPatch_image; | |||
#define DYNINST_CLASS_NAME BPatchSnippetHandle | friend class BPatch_process; | |||
class BPATCH_DLL_EXPORT BPatchSnippetHandle : public BPatch_eventLock { | friend class BPatch_binaryEdit; | |||
friend class BPatch_point; | friend class BPatch_addressSpace; | |||
friend class BPatch_image; | friend class BPatch_thread; | |||
friend class BPatch_process; | ||||
friend class BPatch_binaryEdit; | private: | |||
friend class BPatch_addressSpace; | // Address Space snippet belogns to | |||
friend class BPatch_thread; | BPatch_addressSpace *addSpace_; | |||
private: | // low-level mappings for removal | |||
// Address Space snippet belogns to | std::vector<Dyninst::PatchAPI::InstancePtr> instances_; | |||
BPatch_addressSpace *addSpace_; | ||||
// a flag for catchup | ||||
// low-level mappings for removal | bool catchupNeeded; | |||
std::vector<Dyninst::PatchAPI::InstancePtr> instances_; | // and a list of threads to apply catchup to | |||
BPatch_Vector<BPatch_thread *> catchup_threads; | ||||
// a flag for catchup | ||||
bool catchupNeeded; | ||||
// and a list of threads to apply catchup to | ||||
BPatch_Vector<BPatch_thread *> catchup_threads; | ||||
BPatchSnippetHandle(BPatch_addressSpace * addSpace); | ||||
void addInstance(Dyninst::PatchAPI::InstancePtr p) { instances_.push_ba | ||||
ck(p); } | ||||
public: | ||||
API_EXPORT_DTOR(_dtor, (), | ||||
~,BPatchSnippetHandle,()); | ||||
// Returns whether the installed miniTramps use traps. | ||||
// Not 100% accurate due to internal Dyninst design; we can | ||||
// have multiple instances of instrumentation due to function | ||||
// relocation. | ||||
API_EXPORT(Int, (), bool, usesTrap, ()); | ||||
// mtHandles_ is not empty, , returns the function that the | ||||
// instrumentation was added to | ||||
API_EXPORT(Int, (), | ||||
BPatch_function *, getFunc, ()); | ||||
API_EXPORT(Int, (), | BPatchSnippetHandle(BPatch_addressSpace * addSpace); | |||
BPatch_addressSpace *, getAddressSpace, ()); | ||||
API_EXPORT(Int, (), | void addInstance(Dyninst::PatchAPI::InstancePtr p) { instances_.push_back | |||
BPatch_process *, getProcess, ()); | (p); } | |||
API_EXPORT(Int, (), | public: | |||
BPatch_Vector<BPatch_thread *> &, getCatchupThreads, ()); | ||||
}; | ~BPatchSnippetHandle(); | |||
#ifdef DYNINST_CLASS_NAME | // Returns whether the installed miniTramps use traps. | |||
#undef DYNINST_CLASS_NAME | // Not 100% accurate due to internal Dyninst design; we can | |||
#endif | // have multiple instances of instrumentation due to function | |||
#define DYNINST_CLASS_NAME BPatch_addressSpace | // relocation. | |||
bool usesTrap(); | ||||
// mtHandles_ is not empty, , returns the function that the | ||||
// instrumentation was added to | ||||
BPatch_function * getFunc (); | ||||
BPatch_addressSpace * getAddressSpace(); | ||||
BPatch_process * getProcess(); | ||||
class BPATCH_DLL_EXPORT BPatch_addressSpace : public BPatch_eventLock { | BPatch_Vector<BPatch_thread *> & getCatchupThreads(); | |||
friend class BPatch; | ||||
friend class BPatch_image; | }; | |||
friend class BPatch_function; | ||||
friend class BPatch_frame; | class BPATCH_DLL_EXPORT BPatch_addressSpace { | |||
friend class BPatch_module; | friend class BPatch; | |||
friend class BPatch_basicBlock; | friend class BPatch_image; | |||
friend class BPatch_flowGraph; | friend class BPatch_function; | |||
friend class BPatch_loopTreeNode; | friend class BPatch_frame; | |||
friend class BPatch_point; | friend class BPatch_module; | |||
friend class BPatch_funcCallExpr; | friend class BPatch_basicBlock; | |||
friend class BPatch_eventMailbox; | friend class BPatch_flowGraph; | |||
friend class BPatch_instruction; | friend class BPatch_loopTreeNode; | |||
friend Dyninst::PatchAPI::PatchMgrPtr Dyninst::PatchAPI::convert(const | friend class BPatch_point; | |||
BPatch_addressSpace *); | friend class BPatch_funcCallExpr; | |||
friend class BPatch_eventMailbox; | ||||
friend class BPatch_instruction; | ||||
friend Dyninst::PatchAPI::PatchMgrPtr Dyninst::PatchAPI::convert(const BP | ||||
atch_addressSpace *); | ||||
public: | public: | |||
BPatch_function *findOrCreateBPFunc(Dyninst::PatchAPI::PatchFunction *ifu nc, | BPatch_function *findOrCreateBPFunc(Dyninst::PatchAPI::PatchFunction *ifu nc, | |||
BPatch_module *bpmod); | BPatch_module *bpmod); | |||
BPatch_point *findOrCreateBPPoint(BPatch_function *bpfunc, | BPatch_point *findOrCreateBPPoint(BPatch_function *bpfunc, | |||
Dyninst::PatchAPI::Point *ip, | Dyninst::PatchAPI::Point *ip, | |||
BPatch_procedureLocation pointType); | BPatch_procedureLocation pointType); | |||
skipping to change at line 222 | skipping to change at line 207 | |||
// internal functions, do not use // | // internal functions, do not use // | |||
BPatch_module *findModuleByAddr(Dyninst::Address addr);//doesn't cause pa rsing | BPatch_module *findModuleByAddr(Dyninst::Address addr);//doesn't cause pa rsing | |||
bool findFuncsByRange(Dyninst::Address startAddr, | bool findFuncsByRange(Dyninst::Address startAddr, | |||
Dyninst::Address endAddr, | Dyninst::Address endAddr, | |||
std::set<BPatch_function*> &funcs); | std::set<BPatch_function*> &funcs); | |||
// end internal functions........ // | // end internal functions........ // | |||
// BPatch_addressSpace::insertSnippet | // BPatch_addressSpace::insertSnippet | |||
// | // | |||
// Insert new code into the mutatee | // Insert new code into the mutatee | |||
API_EXPORT_VIRT(Int, (expr, point, order), | virtual BPatchSnippetHandle * insertSnippet(const BPatch_snippet &expr, | |||
BPatchSnippetHandle *,insertSnippet,(const BPatch_snippet | BPatch_point &point, | |||
&expr, | BPatch_snippetOrder order = BP | |||
BPatch_point &point, | atch_firstSnippet); | |||
BPatch_snippetOrder | ||||
order = BPatch_firstSnippet)); | ||||
//BPatch_addressSpace::insertSnippet | //BPatch_addressSpace::insertSnippet | |||
//Insert new code into the mutatee, specifying "when" (before/after poi nt) | //Insert new code into the mutatee, specifying "when" (before/after point ) | |||
API_EXPORT_VIRT(When, (expr, point, when, order), | virtual BPatchSnippetHandle* insertSnippet(const BPatch_snippet &expr, | |||
BPatchSnippetHandle *,insertSnippet,(const BPatch_snipp | BPatch_point &point, | |||
et &expr, | BPatch_callWhen when, | |||
BPatch_point &poin | BPatch_snippetOrder order = BPa | |||
t, | tch_firstSnippet); | |||
BPatch_callWhen wh | ||||
en, | ||||
BPatch_snippetOrde | ||||
r order = BPatch_firstSnippet)); | ||||
//BPatch_addressSpace::insertSnippet | //BPatch_addressSpace::insertSnippet | |||
//Insert new code into the mutatee at multiple points | //Insert new code into the mutatee at multiple points | |||
API_EXPORT_VIRT(AtPoints, (expr, points, order), | virtual BPatchSnippetHandle * insertSnippet(const BPatch_snippet &expr, | |||
BPatchSnippetHandle *,insertSnippet,(const BPatch_snipp | const BPatch_Vector<BPatch_poi | |||
et &expr, | nt *> &points, | |||
const BPatch_Vecto | BPatch_snippetOrder order = BP | |||
r<BPatch_point *> &points, | atch_firstSnippet); | |||
BPatch_snippetOrde | ||||
r order = BPatch_firstSnippet)); | ||||
// BPatch_addressSpace::insertSnippet | // BPatch_addressSpace::insertSnippet | |||
//Insert new code into the mutatee at multiple points, specifying "wh en" | //Insert new code into the mutatee at multiple points, specifying "when" | |||
API_EXPORT_VIRT(AtPointsWhen, (expr, points, when, order), | virtual BPatchSnippetHandle * insertSnippet(const BPatch_snippet &expr, | |||
BPatchSnippetHandle *,insertSnippet,(const BPatch_snipp | const BPatch_Vector<BPatch_poi | |||
et &expr, | nt *> &points, | |||
const BPatch_Vecto | BPatch_callWhen when, | |||
r<BPatch_point *> &points, | BPatch_snippetOrder order = BP | |||
BPatch_callWhen wh | atch_firstSnippet); | |||
en, | ||||
BPatch_snippetOrde | ||||
r order = BPatch_firstSnippet)); | ||||
virtual void beginInsertionSet() = 0; | virtual void beginInsertionSet() = 0; | |||
virtual bool finalizeInsertionSet(bool atomic, bool *modified = NULL) = 0 ; | virtual bool finalizeInsertionSet(bool atomic, bool *modified = NULL) = 0 ; | |||
// BPatch_addressSpace::deleteSnippet | // BPatch_addressSpace::deleteSnippet | |||
// | // | |||
// Remove instrumentation from the mutatee process | // Remove instrumentation from the mutatee process | |||
API_EXPORT(Int, (handle), | bool deleteSnippet(BPatchSnippetHandle *handle); | |||
bool,deleteSnippet,(BPatchSnippetHandle *handle)); | ||||
// BPatch_addressSpace::replaceCode | // BPatch_addressSpace::replaceCode | |||
// | // | |||
// Replace a point (must be an instruction...) with a given BPatch_snipp et | // Replace a point (must be an instruction...) with a given BPatch_snipp et | |||
API_EXPORT(Int, (point, snippet), | bool replaceCode(BPatch_point *point, BPatch_snippet *snippet); | |||
bool, replaceCode, (BPatch_point *point, BPatch_snippet *snippet)); | ||||
// BPatch_addressSpace::replaceFunctionCall | ||||
// | ||||
// Replace function call at one point with another | ||||
bool replaceFunctionCall(BPatch_point &point, BPatch_function &newFunc); | ||||
// BPatch_addressSpace::removeFunctionCall | ||||
// | ||||
// Remove function call at one point | ||||
bool removeFunctionCall(BPatch_point &point); | ||||
// BPatch_addressSpace::replaceFunction | ||||
// | ||||
// Replace all calls to a function with calls to another | ||||
bool replaceFunction(BPatch_function &oldFunc, BPatch_function &newFunc); | ||||
// BPatch_addressSpace::revertReplaceFunction | ||||
// | ||||
// Undo the operation of a replace function | ||||
bool revertReplaceFunction(BPatch_function &oldFunc); | ||||
// BPatch_addressSpace::wrapFunction | ||||
// | ||||
// Replace oldFunc with newFunc as above; however, also rename oldFunc | ||||
// to the provided name so it can still be reached. | ||||
bool wrapFunction(BPatch_function *oldFunc, BPatch_function *newFunc, Dyn | ||||
inst::SymtabAPI::Symbol *clone); | ||||
// BPatch_addressSpace::revertWrapFunction | ||||
// | ||||
// Undo the operations of a wrapFunction, restoring the original | ||||
// functionality | ||||
bool revertWrapFunction(BPatch_function *wrappedFunc); | ||||
// BPatch_addressSpace::getSourceLines | ||||
// | ||||
// Method that retrieves the line number and file name corresponding | ||||
// to an address | ||||
bool getSourceLines(unsigned long addr, BPatch_Vector< BPatch_statement > | ||||
& lines ); | ||||
// BPatch_addressSpace::getAddressRanges | ||||
// | ||||
// Method that retrieves address range(s) for a given filename and line n | ||||
umber. | ||||
bool getAddressRanges(const char * fileName, unsigned int lineNo, std::ve | ||||
ctor< std::pair< unsigned long, unsigned long > > & ranges ); | ||||
// DEPRECATED: | ||||
// BPatch_addressSpace::findFunctionByAddr | ||||
// | ||||
// Returns the function containing an address | ||||
BPatch_function * findFunctionByAddr(void *addr); | ||||
// BPatch_addressSpace::findFunctionByEntry | ||||
// | ||||
// Returns the function starting at the given address | ||||
BPatch_function * findFunctionByEntry(Dyninst::Address entry); | ||||
// BPatch_addressSpace::findFunctionsByAddr | ||||
// | ||||
// Returns the functions containing an address | ||||
// (multiple functions are returned when code is shared) | ||||
bool findFunctionsByAddr(Dyninst::Address addr, | ||||
std::vector<BPatch_function*> &funcs); | ||||
// BPatch_addressSpace::getImage | ||||
// | ||||
// Obtain BPatch_image associated with this BPatch_addressSpace | ||||
BPatch_image * getImage(); | ||||
// BPatch_addressSpace::malloc | ||||
// | ||||
// Allocate memory for a new variable in the mutatee process | ||||
BPatch_variableExpr * malloc(int n, std::string name = std::string("")); | ||||
// BPatch_addressSpace::replaceFunctionCall | // BPatch_addressSpace::malloc | |||
// | // | |||
// Replace function call at one point with another | // Allocate memory for a new variable in the mutatee process | |||
API_EXPORT(Int, (point, newFunc), | BPatch_variableExpr * malloc(const BPatch_type &type, std::string name = | |||
bool,replaceFunctionCall,(BPatch_point &point, BPatch_function &newFunc | std::string("")); | |||
)); | ||||
BPatch_variableExpr * createVariable(Dyninst::Address at_addr, | ||||
// BPatch_addressSpace::removeFunctionCall | BPatch_type *type, | |||
// | std::string var_name = std::string("" | |||
// Remove function call at one point | ), | |||
BPatch_module *in_module = NULL); | ||||
API_EXPORT(Int, (point), | ||||
bool,removeFunctionCall,(BPatch_point &point)); | // BPatch_addressSpace::free | |||
// | ||||
// BPatch_addressSpace::replaceFunction | // Free memory allocated by Dyninst in the mutatee process | |||
// | ||||
// Replace all calls to a function with calls to another | bool free(BPatch_variableExpr &ptr); | |||
API_EXPORT(Int, (oldFunc, newFunc), | // BPatch_addressSpace::createVariable | |||
bool,replaceFunction,(BPatch_function &oldFunc, BPatch_function &newFun | // | |||
c)); | // Wrap an existing piece of allocated memory with a BPatch_variableExpr. | |||
// Used (for instance) by the shared memory library to wrap its externall | ||||
// BPatch_addressSpace::revertReplaceFunction | y | |||
// | // allocated memory for use by BPatch. | |||
// Undo the operation of a replace function | BPatch_variableExpr * createVariable(std::string name, | |||
API_EXPORT(Int, (oldFunc), | Dyninst::Address addr, | |||
bool, revertReplaceFunction, (BPatch_function &oldFunc)); | BPatch_type *type = NULL); | |||
bool getRegisters(std::vector<BPatch_register> ®s); | ||||
// BPatch_addressSpace::wrapFunction | ||||
// | bool createRegister_NP(std::string regName, BPatch_register ®); | |||
// Replace oldFunc with newFunc as above; however, also rename oldFunc | ||||
// to the provided name so it can still be reached. | void allowTraps(bool allowtraps); | |||
API_EXPORT(Int, (oldFunc, newFunc, clone), | // BPatch_addressSpace::loadLibrary | |||
bool,wrapFunction,(BPatch_function *oldFunc, BPatch_function | // | |||
*newFunc, Dyninst::SymtabAPI::Symbol *clone)); | // Load a shared library into the mutatee's address space | |||
// Returns true if successful | ||||
// BPatch_addressSpace::revertWrapFunction | // | |||
// | // the reload argument is used by save the world to determine | |||
// Undo the operations of a wrapFunction, restoring the original | // if this library should be reloaded by the mutated binary | |||
// functionality | // when it starts up. this is up to the user because loading | |||
// an extra shared library could hide access to the 'correct' | ||||
API_EXPORT(Int, (wrappedFunc), | // function by redefining a function | |||
bool,revertWrapFunction,(BPatch_function *wrappedFunc)); | ||||
virtual BPatch_object * loadLibrary(const char *libname, bool reload = fa | ||||
// BPatch_addressSpace::getSourceLines | lse) = 0; | |||
// | ||||
// Method that retrieves the line number and file name corresponding | // BPatch_addressSpace::isStaticExecutable | |||
// to an address | // | |||
// Returns true if the underlying image represents a | ||||
API_EXPORT(Int, (addr, lines), | // statically-linked executable, false otherwise | |||
bool,getSourceLines,(unsigned long addr, BPatch_Vector< BPatch_statemen | bool isStaticExecutable(); | |||
t > & lines )); | ||||
// BPatch_addressSpace::getAddressRanges | ||||
// | ||||
// Method that retrieves address range(s) for a given filename and line | ||||
number. | ||||
API_EXPORT(Int, (fileName, lineNo, ranges), | ||||
bool,getAddressRanges,(const char * fileName, unsigned int lineNo, std: | ||||
:vector< std::pair< unsigned long, unsigned long > > & ranges )); | ||||
// DEPRECATED: | ||||
// BPatch_addressSpace::findFunctionByAddr | ||||
// | ||||
// Returns the function containing an address | ||||
API_EXPORT(Int, (addr), | ||||
BPatch_function *,findFunctionByAddr,(void *addr)); | ||||
// BPatch_addressSpace::findFunctionByEntry | ||||
// | ||||
// Returns the function starting at the given address | ||||
API_EXPORT(Int, (entry), | ||||
BPatch_function *,findFunctionByEntry,(Dyninst::Address entry)); | ||||
// BPatch_addressSpace::findFunctionsByAddr | ||||
// | ||||
// Returns the functions containing an address | ||||
// (multiple functions are returned when code is shared) | ||||
API_EXPORT(Int, (addr,funcs), | ||||
bool, findFunctionsByAddr,(Dyninst::Address addr, | ||||
std::vector<BPatch_function*> &funcs)); | ||||
// BPatch_addressSpace::getImage | ||||
// | ||||
// Obtain BPatch_image associated with this BPatch_addressSpace | ||||
API_EXPORT(Int, (), | ||||
BPatch_image *,getImage,()); | ||||
// BPatch_addressSpace::malloc | ||||
// | ||||
// Allocate memory for a new variable in the mutatee process | ||||
API_EXPORT(Int, (n, name), | ||||
BPatch_variableExpr *,malloc,(int n, std::string name = std: | ||||
:string(""))); | ||||
// BPatch_addressSpace::malloc | ||||
// | ||||
// Allocate memory for a new variable in the mutatee process | ||||
API_EXPORT(ByType, (type, name), | ||||
BPatch_variableExpr *,malloc,(const BPatch_type &type, std:: | ||||
string name = std::string(""))); | ||||
API_EXPORT(Int, (at_addr, type, var_name, in_module), | ||||
BPatch_variableExpr *, createVariable,(Dyninst::Address at_addr, | ||||
BPatch_type *type, | ||||
std::string var_name = std::stri | ||||
ng(""), | ||||
BPatch_module *in_module = NULL) | ||||
); | ||||
// BPatch_addressSpace::free | ||||
// | ||||
// Free memory allocated by Dyninst in the mutatee process | ||||
API_EXPORT(Int, (ptr), | ||||
bool,free,(BPatch_variableExpr &ptr)); | ||||
// BPatch_addressSpace::createVariable | ||||
// | ||||
// Wrap an existing piece of allocated memory with a BPatch_variableExp | ||||
r. | ||||
// Used (for instance) by the shared memory library to wrap its externa | ||||
lly | ||||
// allocated memory for use by BPatch. | ||||
API_EXPORT(Int, (name, addr, type), | ||||
BPatch_variableExpr *, createVariable, | ||||
(std::string name, Dyninst::Address addr, BPatch_type *type | ||||
= NULL)); | ||||
API_EXPORT(Int, (regs), | ||||
bool, getRegisters, (std::vector<BPatch_register> ®s)); | ||||
API_EXPORT(Int, (regName, reg), | ||||
bool, createRegister_NP, (std::string regName, BPatch_register ®)); | ||||
API_EXPORT_V(Int, (allowtraps), | ||||
void, allowTraps, (bool allowtraps)); | ||||
// BPatch_addressSpace::loadLibrary | ||||
// | ||||
// Load a shared library into the mutatee's address space | ||||
// Returns true if successful | ||||
// | ||||
// 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 | ||||
API_EXPORT_VIRT(Int, (libname, reload), | ||||
BPatch_object *, loadLibrary,(const char *libname, bool reload = false) | ||||
); | ||||
// BPatch_addressSpace::isStaticExecutable | ||||
// | ||||
// Returns true if the underlying image represents a | ||||
// statically-linked executable, false otherwise | ||||
API_EXPORT(Int, (), | ||||
bool, isStaticExecutable,()); | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 22 change blocks. | ||||
296 lines changed or deleted | 239 lines changed or added | |||
BPatch_basicBlock.h | BPatch_basicBlock.h | |||
---|---|---|---|---|
skipping to change at line 39 | skipping to change at line 39 | |||
*/ | */ | |||
#ifndef _BPatch_basicBlock_h_ | #ifndef _BPatch_basicBlock_h_ | |||
#define _BPatch_basicBlock_h_ | #define _BPatch_basicBlock_h_ | |||
#include "BPatch_dll.h" | #include "BPatch_dll.h" | |||
#include "BPatch_Vector.h" | #include "BPatch_Vector.h" | |||
#include "BPatch_Set.h" | #include "BPatch_Set.h" | |||
#include "BPatch_sourceBlock.h" | #include "BPatch_sourceBlock.h" | |||
#include "BPatch_instruction.h" | #include "BPatch_instruction.h" | |||
#include "BPatch_eventLock.h" | ||||
#include "Instruction.h" | #include "Instruction.h" | |||
#include "BPatch_enums.h" | #include "BPatch_enums.h" | |||
//#include "BPatch_edge.h" | //#include "BPatch_edge.h" | |||
class image; | class image; | |||
class func_instance; | class func_instance; | |||
class instPoint; | class instPoint; | |||
class block_instance; | class block_instance; | |||
class BPatch_point; | class BPatch_point; | |||
class BPatch_edge; | class BPatch_edge; | |||
class BPatch_function; | class BPatch_function; | |||
class BPatch_flowGraph; | class BPatch_flowGraph; | |||
class BPatch_basicBlock; | class BPatch_basicBlock; | |||
/* Currently all this bitarray stuff is just for power, | /* Currently all this bitarray stuff is just for power, | |||
but could be extended as we do liveness stuff for other platforms */ | but could be extended as we do liveness stuff for other platforms */ | |||
namespace Dyninst { | namespace Dyninst { | |||
namespace ParseAPI { | namespace ParseAPI { | |||
class Block; | class Block; | |||
Block *convert(const BPatch_basicBlock *); | BPATCH_DLL_EXPORT Block *convert(const BPatch_basicBlock *); | |||
}; | }; | |||
namespace PatchAPI { | namespace PatchAPI { | |||
class PatchBlock; | class PatchBlock; | |||
PatchBlock *convert(const BPatch_basicBlock *); | BPATCH_DLL_EXPORT PatchBlock *convert(const BPatch_basicBlock *); | |||
}; | }; | |||
}; | ||||
namespace std { | ||||
template <> | ||||
struct less<BPatch_basicBlock *> { | ||||
BPATCH_DLL_EXPORT bool operator()(const BPatch_basicBlock * const &l, co | ||||
nst BPatch_basicBlock * const &r) const; | ||||
}; | ||||
}; | ||||
template <> | ||||
struct comparison <BPatch_basicBlock *> { | ||||
BPATCH_DLL_EXPORT bool operator()(const BPatch_basicBlock * const &x, | ||||
const BPatch_basicBlock * const &y) const; | ||||
}; | }; | |||
/** class for machine code basic blocks. We assume the user can not | /** class for machine code basic blocks. We assume the user can not | |||
* create basic blocks using its constructor. It is not safe. | * create basic blocks using its constructor. It is not safe. | |||
* basic blocks are used for reading purposes not for inserting | * basic blocks are used for reading purposes not for inserting | |||
* a new code to the machine executable other than instrumentation code | * a new code to the machine executable other than instrumentation code | |||
* | * | |||
* @see BPatch_flowGraph | * @see BPatch_flowGraph | |||
* @see BPatch_sourceBlock | * @see BPatch_sourceBlock | |||
* @see BPatch_basicBlockLoop | * @see BPatch_basicBlockLoop | |||
*/ | */ | |||
class BPatch_flowGraph; | class BPatch_flowGraph; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | struct BPATCH_DLL_EXPORT insnPredicate : public std::unary_function<Dyninst | |||
#endif | ::InstructionAPI::Instruction::Ptr, bool> | |||
#define DYNINST_CLASS_NAME BPatch_basicBlock | ||||
struct insnPredicate : public std::unary_function<Dyninst::InstructionAPI:: | ||||
Instruction::Ptr, bool> | ||||
{ | { | |||
virtual result_type operator()(argument_type arg) = 0; | virtual result_type operator()(argument_type arg) = 0; | |||
virtual ~insnPredicate() {} | virtual ~insnPredicate() {} | |||
}; | }; | |||
class BPATCH_DLL_EXPORT BPatch_basicBlock : public BPatch_eventLock { | class BPATCH_DLL_EXPORT BPatch_basicBlock { | |||
friend class BPatch_flowGraph; | friend class BPatch_flowGraph; | |||
friend class TarjanDominator; | friend class TarjanDominator; | |||
friend class dominatorCFG; | friend class dominatorCFG; | |||
friend class InstrucIter; | friend class InstrucIter; | |||
friend class func_instance; | friend class func_instance; | |||
friend class BPatch_instruction; | friend class BPatch_instruction; | |||
friend std::ostream& operator<<(std::ostream&,BPatch_basicBlock&); | friend std::ostream& operator<<(std::ostream&,BPatch_basicBlock&); | |||
friend Dyninst::ParseAPI::Block *Dyninst::ParseAPI::convert(const B | friend Dyninst::ParseAPI::Block *Dyninst::ParseAPI::convert(const BPatch_ | |||
Patch_basicBlock *); | basicBlock *); | |||
friend Dyninst::PatchAPI::PatchBlock *Dyninst::PatchAPI::convert(co | friend Dyninst::PatchAPI::PatchBlock *Dyninst::PatchAPI::convert(const BP | |||
nst BPatch_basicBlock *); | atch_basicBlock *); | |||
private: | private: | |||
/** the internal basic block structure **/ | /** the internal basic block structure **/ | |||
block_instance *iblock; | block_instance *iblock; | |||
/** the flow graph that contains this basic block */ | /** the flow graph that contains this basic block */ | |||
BPatch_flowGraph *flowGraph; | BPatch_flowGraph *flowGraph; | |||
/** set of basic blocks that this basicblock dominates immediately*/ | /** set of basic blocks that this basicblock dominates immediately*/ | |||
BPatch_Set<BPatch_basicBlock*>* immediateDominates; | std::set<BPatch_basicBlock*>* immediateDominates; | |||
/** basic block which is the immediate dominator of the basic block */ | /** basic block which is the immediate dominator of the basic block */ | |||
BPatch_basicBlock *immediateDominator; | BPatch_basicBlock *immediateDominator; | |||
/** same as previous two fields, but for postdominator tree */ | /** same as previous two fields, but for postdominator tree */ | |||
BPatch_Set<BPatch_basicBlock*> *immediatePostDominates; | std::set<BPatch_basicBlock*> *immediatePostDominates; | |||
BPatch_basicBlock *immediatePostDominator; | BPatch_basicBlock *immediatePostDominator; | |||
/** the source block(source lines) that basic block corresponds*/ | /** the source block(source lines) that basic block corresponds*/ | |||
BPatch_Vector<BPatch_sourceBlock*> *sourceBlocks; | BPatch_Vector<BPatch_sourceBlock*> *sourceBlocks; | |||
/** the instructions within this block */ | /** the instructions within this block */ | |||
BPatch_Vector<BPatch_instruction*> *instructions; | BPatch_Vector<BPatch_instruction*> *instructions; | |||
/** the incoming edges */ | /** the incoming edges */ | |||
BPatch_Set<BPatch_edge*> incomingEdges; | std::set<BPatch_edge*> incomingEdges; | |||
/** the outgoing edges */ | /** the outgoing edges */ | |||
BPatch_Set<BPatch_edge*> outgoingEdges; | std::set<BPatch_edge*> outgoingEdges; | |||
public: | public: | |||
BPatch_flowGraph *fg() const { return flowGraph; } | BPatch_flowGraph *fg() const { return flowGraph; } | |||
block_instance *block() const { return iblock; } | block_instance *block() const { return iblock; } | |||
BPatch_function *func() const; | BPatch_function *func() const; | |||
func_instance *ifunc() const; | func_instance *ifunc() const; | |||
protected: | protected: | |||
/** constructor of class */ | /** constructor of class */ | |||
BPatch_basicBlock(block_instance *ib, BPatch_flowGraph *fg); | BPatch_basicBlock(block_instance *ib, BPatch_flowGraph *fg); | |||
BPatch_Vector<BPatch_point*>* | BPatch_Vector<BPatch_point*>* | |||
findPointByPredicate(insnPredicate& f); | findPointByPredicate(insnPredicate& f); | |||
public: | public: | |||
// Internal functions. Don't use these unless you know what you're | // Internal functions. Don't use these unless you know what you're | |||
// doing. | // doing. | |||
block_instance *lowlevel_block() { return iblock; } | block_instance *lowlevel_block() { return iblock; } | |||
void setlowlevel_block(block_instance *b) { iblock = b; } | void setlowlevel_block(block_instance *b) { iblock = b; } | |||
void getAllPoints(std::vector<BPatch_point*>& allPoints); | void getAllPoints(std::vector<BPatch_point*>& allPoints); | |||
BPatch_point *convertPoint(instPoint *pt); | BPatch_point *convertPoint(instPoint *pt); | |||
BPatch_function *getCallTarget(); | BPatch_function *getCallTarget(); | |||
// end internal functions | // end internal functions | |||
API_EXPORT(Int, (), | BPatch_flowGraph * getFlowGraph() const; | |||
BPatch_flowGraph *, getFlowGraph, () CONST_EXPORT); | ||||
/** BPatch_basicBlock::getSources */ | /** BPatch_basicBlock::getSources */ | |||
/** method that returns the predecessors of the basic block */ | /** method that returns the predecessors of the basic block */ | |||
API_EXPORT_V(Int, (srcs), | void getSources(BPatch_Vector<BPatch_basicBlock*> &srcs); | |||
void,getSources,(BPatch_Vector<BPatch_basicBlock*> &srcs)); | ||||
/** BPatch_basicBlock::getTargets */ | /** BPatch_basicBlock::getTargets */ | |||
/** method that returns the successors of the basic block */ | /** method that returns the successors of the basic block */ | |||
API_EXPORT_V(Int, (targets), | void getTargets(BPatch_Vector<BPatch_basicBlock*> &targets); | |||
void,getTargets,(BPatch_Vector<BPatch_basicBlock*> &targets | ||||
)); | ||||
/** BPatch_basicBlock::dominates */ | /** BPatch_basicBlock::dominates */ | |||
/** returns true if argument is dominated by this basic block */ | /** returns true if argument is dominated by this basic block */ | |||
API_EXPORT(Int, (block), | bool dominates(BPatch_basicBlock *block); | |||
bool,dominates,(BPatch_basicBlock *block)); | ||||
/** BPatch_basicBlock::getImmediateDominiator */ | /** BPatch_basicBlock::getImmediateDominiator */ | |||
/** return the immediate dominator of a basic block */ | /** return the immediate dominator of a basic block */ | |||
API_EXPORT(Int, (), | BPatch_basicBlock* getImmediateDominator(); | |||
BPatch_basicBlock*,getImmediateDominator,()); | ||||
/** BPatch_basicBlock::getImmediateDominates */ | /** BPatch_basicBlock::getImmediateDominates */ | |||
/** method that returns the basic blocks immediately dominated by | /** method that returns the basic blocks immediately dominated by */ | |||
*/ | /** the basic block */ | |||
/** the basic block */ | ||||
API_EXPORT_V(Int, (blocks), | void getImmediateDominates(BPatch_Vector<BPatch_basicBlock*> &blocks); | |||
void,getImmediateDominates,(BPatch_Vector<BPatch_basicBlock | ||||
*> &blocks)); | ||||
/** BPatch_basicBlock::getAllDominates */ | /** BPatch_basicBlock::getAllDominates */ | |||
/** method that returns all basic blocks dominated by the basic bloc | /** method that returns all basic blocks dominated by the basic block */ | |||
k */ | ||||
API_EXPORT_V(Int, (blocks), | void getAllDominates(BPatch_Set<BPatch_basicBlock*> &blocks); | |||
void,getAllDominates,(BPatch_Set<BPatch_basicBlock*> &block | void getAllDominates(std::set<BPatch_basicBlock*> &blocks); | |||
s)); | ||||
/** the previous four methods, but for postdominators */ | /** the previous four methods, but for postdominators */ | |||
/** BPatch_basicBlock::postdominates */ | /** BPatch_basicBlock::postdominates */ | |||
API_EXPORT(Int, (block), | bool postdominates(BPatch_basicBlock *block); | |||
bool,postdominates,(BPatch_basicBlock *block)); | ||||
/** BPatch_basicBlock::getImmediatePostDominator */ | /** BPatch_basicBlock::getImmediatePostDominator */ | |||
API_EXPORT(Int, (), | BPatch_basicBlock* getImmediatePostDominator(); | |||
BPatch_basicBlock*,getImmediatePostDominator,()); | ||||
/** BPatch_basicBlock::getImmediatePostDominates */ | /** BPatch_basicBlock::getImmediatePostDominates */ | |||
API_EXPORT_V(Int, (blocks), | void getImmediatePostDominates(BPatch_Vector<BPatch_basicBlock*> &blocks) | |||
void,getImmediatePostDominates,(BPatch_Vector<BPatch_basicB | ; | |||
lock*> &blocks)); | ||||
/** BPatch_basicBlock::getAllPostDominates */ | /** BPatch_basicBlock::getAllPostDominates */ | |||
API_EXPORT_V(Int, (blocks), | void getAllPostDominates(BPatch_Set<BPatch_basicBlock*> &blocks); | |||
void,getAllPostDominates,(BPatch_Set<BPatch_basicBlock*> &b | void getAllPostDominates(std::set<BPatch_basicBlock*> &blocks); | |||
locks)); | ||||
/** BPatch_basicBlock::getSourceBlocks */ | /** BPatch_basicBlock::getSourceBlocks */ | |||
/** returns the source block corresponding to the basic block */ | /** returns the source block corresponding to the basic block */ | |||
API_EXPORT(Int, (blocks), | bool getSourceBlocks(BPatch_Vector<BPatch_sourceBlock*> &blocks); | |||
bool,getSourceBlocks,(BPatch_Vector<BPatch_sourceBlock*> &blo | ||||
cks)); | ||||
/** BPatch_basicBlock::getBlockNumber */ | /** BPatch_basicBlock::getBlockNumber */ | |||
/** returns the block id */ | /** returns the block id */ | |||
API_EXPORT(Int, (), | int getBlockNumber(); | |||
int,getBlockNumber,()); | ||||
/** BPatch_basicBlock::setEmtryBlock */ | /** BPatch_basicBlock::setEmtryBlock */ | |||
/** sets whether this block is an entry block (or not) */ | /** sets whether this block is an entry block (or not) */ | |||
/** BPatch_basicBlock::isEntryBlock */ | /** BPatch_basicBlock::isEntryBlock */ | |||
API_EXPORT(Int, (), | bool isEntryBlock() const; | |||
bool,isEntryBlock,() CONST_EXPORT); | ||||
/** BPatch_basicBlock::isExitBlock */ | /** BPatch_basicBlock::isExitBlock */ | |||
API_EXPORT(Int, (), | bool isExitBlock() const; | |||
bool,isExitBlock,() CONST_EXPORT); | ||||
/** BPatch_basicBlock::size */ | /** BPatch_basicBlock::size */ | |||
API_EXPORT(Int, (), | unsigned size() const; | |||
unsigned,size,() CONST_EXPORT); | ||||
/** BPatch_basicBlock::getStartAddress */ | /** BPatch_basicBlock::getStartAddress */ | |||
//these always return absolute address | //these always return absolute address | |||
API_EXPORT(Int, (), | unsigned long getStartAddress() const; | |||
unsigned long,getStartAddress,() CONST_EXPORT); | ||||
/** BPatch_basicBlock::getLastInsnAddress */ | /** BPatch_basicBlock::getLastInsnAddress */ | |||
API_EXPORT(Int, (), | unsigned long getLastInsnAddress() const; | |||
unsigned long,getLastInsnAddress,() CONST_EXPORT); | ||||
/** BPatch_basicBlock::getEndAddress */ | /** BPatch_basicBlock::getEndAddress */ | |||
API_EXPORT(Int, (), | unsigned long getEndAddress() const; | |||
unsigned long, getEndAddress, () CONST_EXPORT); | ||||
/** BPatch_basicBlock::~BPatch_basicBlock */ | /** BPatch_basicBlock::~BPatch_basicBlock */ | |||
/** destructor of class */ | /** destructor of class */ | |||
API_EXPORT_DTOR(_dtor, (), | ~BPatch_basicBlock(); | |||
~,BPatch_basicBlock,()); | ||||
/** BPatch_basicBlock::getAddressRange */ | /** BPatch_basicBlock::getAddressRange */ | |||
/** return the start and end addresses of the basic block */ | /** return the start and end addresses of the basic block */ | |||
API_EXPORT(Int, (_startAddress, _endAddress), | bool getAddressRange(void*& _startAddress, void*& _endAddress); | |||
bool,getAddressRange,(void*& _startAddress, void*& _endAddres | ||||
s)); | ||||
#ifdef IBM_BPATCH_COMPAT | #ifdef IBM_BPATCH_COMPAT | |||
// dummy placeholder. I think this is only used by dpcl in a debug rou | // dummy placeholder. I think this is only used by dpcl in a debug rout | |||
tine | ine | |||
API_EXPORT(Int, (_startLine, _endLine), | bool getLineNumbers(unsigned int &_startLine, unsigned int &_endLine); | |||
bool,getLineNumbers,(unsigned int &_startLine, unsigned int | ||||
&_endLine)); | ||||
#endif | #endif | |||
/** BPatch_basicBlock::findEntryPoint */ | /** BPatch_basicBlock::findEntryPoint */ | |||
/** return point at the start of the basic block */ | /** return point at the start of the basic block */ | |||
API_EXPORT(Int, (), | BPatch_point* findEntryPoint(); | |||
BPatch_point*, findEntryPoint,()); | ||||
/** BPatch_basicBlock::findExitPoint */ | /** BPatch_basicBlock::findExitPoint */ | |||
/** return point at the start of the basic block */ | /** return point at the start of the basic block */ | |||
API_EXPORT(Int, (), | BPatch_point* findExitPoint(); | |||
BPatch_point*, findExitPoint,()); | ||||
/** BPatch_basicBlock::findPoint */ | /** BPatch_basicBlock::findPoint */ | |||
/** return a set of points within the basic block */ | /** return a set of points within the basic block */ | |||
API_EXPORT(Int, (ops), | BPatch_Vector<BPatch_point*> * findPoint(const BPatch_Set<BPatch_opCode>& | |||
BPatch_Vector<BPatch_point*> *,findPoint,(const BPatch_Set<BP | ops); | |||
atch_opCode>& ops)); | BPatch_Vector<BPatch_point*> * findPoint(const std::set<BPatch_opCode>& o | |||
ps); | ||||
API_EXPORT(Int, (filter), | BPatch_Vector<BPatch_point*> * findPoint(bool(*filter)(Dyninst::Instructi | |||
BPatch_Vector<BPatch_point*> *,findPoint,(bool(*filter)(Dynin | onAPI::Instruction::Ptr)); | |||
st::InstructionAPI::Instruction::Ptr))); | ||||
API_EXPORT(Int, (addr), | BPatch_point * findPoint(Dyninst::Address addr); | |||
BPatch_point *, findPoint, (Dyninst::Address addr)); | ||||
/** BPatch_basicBlock::getInstructions */ | /** BPatch_basicBlock::getInstructions */ | |||
/** return the instructions that belong to the block */ | /** return the instructions that belong to the block */ | |||
API_EXPORT(Int, (insns), | bool getInstructions(std::vector<Dyninst::InstructionAPI::Instruction::P | |||
bool, getInstructions, (std::vector<Dyninst::InstructionAPI::I | tr>& insns); | |||
nstruction::Ptr>& insns)); | bool getInstructions(std::vector<std::pair<Dyninst::InstructionAPI::Inst | |||
API_EXPORT(Addrs, (insnInstances), | ruction::Ptr, Dyninst::Address> >& insnInstances); | |||
bool, getInstructions, (std::vector<std::pair<Dyninst::Instruc | ||||
tionAPI::Instruction::Ptr, Dyninst::Address> >& insnInstances)); | ||||
/** BPatch_basicBlock::getIncomingEdges */ | /** BPatch_basicBlock::getIncomingEdges */ | |||
/** returns the incoming edges */ | /** returns the incoming edges */ | |||
API_EXPORT_V(Int, (inc), | void getIncomingEdges(BPatch_Vector<BPatch_edge*> &inc); | |||
void,getIncomingEdges,(BPatch_Vector<BPatch_edge*> &inc)); | ||||
/** BPatch_basicBlock::getOutgoingEdges */ | /** BPatch_basicBlock::getOutgoingEdges */ | |||
/** returns the outgoming edges */ | /** returns the outgoming edges */ | |||
API_EXPORT_V(Int, (out), | void getOutgoingEdges(BPatch_Vector<BPatch_edge*> &out); | |||
void,getOutgoingEdges,(BPatch_Vector<BPatch_edge*> &out)); | ||||
operator Dyninst::ParseAPI::Block *() const; | operator Dyninst::ParseAPI::Block *() const; | |||
operator Dyninst::PatchAPI::PatchBlock *() const; | operator Dyninst::PatchAPI::PatchBlock *() const; | |||
int blockNo() const; | int blockNo() const; | |||
}; | }; | |||
template <> | ||||
struct comparison <BPatch_basicBlock *> { | ||||
bool operator()(const BPatch_basicBlock * const &x, | ||||
const BPatch_basicBlock * const &y) const { | ||||
return (x->getStartAddress() < y->getStartAddress()); | ||||
}; | ||||
}; | ||||
#endif /* _BPatch_basicBlock_h_ */ | #endif /* _BPatch_basicBlock_h_ */ | |||
End of changes. 81 change blocks. | ||||
204 lines changed or deleted | 170 lines changed or added | |||
BPatch_basicBlockLoop.h | BPatch_basicBlockLoop.h | |||
---|---|---|---|---|
skipping to change at line 41 | skipping to change at line 41 | |||
#ifndef _BPatch_basicBlockLoop_h | #ifndef _BPatch_basicBlockLoop_h | |||
#define _BPatch_basicBlockLoop_h | #define _BPatch_basicBlockLoop_h | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#include <string> | #include <string> | |||
#include "Annotatable.h" | #include "Annotatable.h" | |||
#include "BPatch_dll.h" | #include "BPatch_dll.h" | |||
#include "BPatch_Vector.h" | #include "BPatch_Vector.h" | |||
#include "BPatch_Set.h" | #include "BPatch_Set.h" | |||
#include "BPatch_basicBlock.h" | #include "BPatch_basicBlock.h" | |||
#include "BPatch_eventLock.h" | ||||
#include "BPatch_flowGraph.h" | #include "BPatch_flowGraph.h" | |||
/** class to represent the loops composed of machine code basic | /** class to represent the loops composed of machine code basic | |||
* blocks in the executable (Natural loops) | * blocks in the executable (Natural loops) | |||
* | * | |||
* @see BPatch_basicBlock | * @see BPatch_basicBlock | |||
* @see BPatch_flowGraph | * @see BPatch_flowGraph | |||
*/ | */ | |||
class BPatch_variableExpr; | class BPatch_variableExpr; | |||
class BPatch_loopTreeNode; | class BPatch_loopTreeNode; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_basicBlockLoop | ||||
class BPATCH_DLL_EXPORT BPatch_basicBlockLoop : | class BPATCH_DLL_EXPORT BPatch_basicBlockLoop : | |||
public BPatch_eventLock, | ||||
public Dyninst::AnnotatableSparse | public Dyninst::AnnotatableSparse | |||
{ | { | |||
friend class BPatch_flowGraph; | friend class BPatch_flowGraph; | |||
friend std::ostream& operator<<(std::ostream&,BPatch_basicBlockLoop& ); | friend std::ostream& operator<<(std::ostream&,BPatch_basicBlockLoop& ); | |||
friend void dfsCreateLoopHierarchy(BPatch_loopTreeNode * parent, | friend void dfsCreateLoopHierarchy(BPatch_loopTreeNode * parent, | |||
BPatch_Vector<BPatch_basicBlockL oop *> &loops, | BPatch_Vector<BPatch_basicBlockL oop *> &loops, | |||
std::string level); | std::string level); | |||
private: | private: | |||
std::set<BPatch_edge*> backEdges; | std::set<BPatch_edge*> backEdges; | |||
// the flow graph this loop is part of | // the flow graph this loop is part of | |||
BPatch_flowGraph *flowGraph; | BPatch_flowGraph *flowGraph; | |||
/** set of loops that are contained (nested) in this loop. */ | /** set of loops that are contained (nested) in this loop. */ | |||
BPatch_Set<BPatch_basicBlockLoop*> containedLoops; | std::set<BPatch_basicBlockLoop*> containedLoops; | |||
/** the basic blocks in the loop */ | /** the basic blocks in the loop */ | |||
BPatch_Set<BPatch_basicBlock*> basicBlocks; | std::set<BPatch_basicBlock*> basicBlocks; | |||
/** this func is only invoked by BPatch_flowGraph::createLoops */ | /** this func is only invoked by BPatch_flowGraph::createLoops */ | |||
void addBackEdges(std::vector<BPatch_edge*> &edges); | void addBackEdges(std::vector<BPatch_edge*> &edges); | |||
public: | public: | |||
/** If loop which directly encloses this loop. NULL if no such loop */ | /** If loop which directly encloses this loop. NULL if no such loop */ | |||
BPatch_basicBlockLoop* parent; | BPatch_basicBlockLoop* parent; | |||
/** BPatch_basicBlockLoop::containsAddress */ | /** BPatch_basicBlockLoop::containsAddress */ | |||
/** Return true if the given address is within the range of | /** Return true if the given address is within the range of | |||
this loop's basicBlocks */ | this loop's basicBlocks */ | |||
API_EXPORT(Int, (addr), | ||||
bool,containsAddress,(unsigned long addr)); | bool containsAddress(unsigned long addr); | |||
/** Return true if the given address is within the range of | /** Return true if the given address is within the range of | |||
this loop's basicBlocks or its children */ | this loop's basicBlocks or its children */ | |||
API_EXPORT(Int, (addr), | ||||
bool,containsAddressInclusive,(unsigned long addr)); | bool containsAddressInclusive(unsigned long addr); | |||
/** BPatch_basicBlockLoop::getBackEdge */ | /** BPatch_basicBlockLoop::getBackEdge */ | |||
/** return a back edge that defines this loop */ | /** return a back edge that defines this loop */ | |||
API_EXPORT(Int, (), | ||||
BPatch_edge *,getBackEdge,()); | BPatch_edge * getBackEdge(); | |||
/** BPatch_basicBlockLoop::getBackEdges */ | /** BPatch_basicBlockLoop::getBackEdges */ | |||
/** Sets edges to the set of back edges that define this loop, | /** Sets edges to the set of back edges that define this loop, | |||
returns the number of back edges that define this loop */ | returns the number of back edges that define this loop */ | |||
API_EXPORT(Int, (edges), | int getBackEdges(BPatch_Vector<BPatch_edge*> &edges); | |||
int,getBackEdges,(BPatch_Vector<BPatch_edge*> &edges)); | ||||
/** BPatch_basicBlockLoop::getContainedLoops */ | /** BPatch_basicBlockLoop::getContainedLoops */ | |||
/** returns vector of contained loops */ | /** returns vector of contained loops */ | |||
API_EXPORT(Int, (loops), | ||||
bool,getContainedLoops,(BPatch_Vector<BPatch_basicBlockLoop*> &loop s)); | bool getContainedLoops(BPatch_Vector<BPatch_basicBlockLoop*> &loops ); | |||
/** BPatch_basicBlockLoop::getOuterLoops */ | /** BPatch_basicBlockLoop::getOuterLoops */ | |||
/** returns vector of outer contained loops */ | /** returns vector of outer contained loops */ | |||
API_EXPORT(Int, (loops), | ||||
bool,getOuterLoops,(BPatch_Vector<BPatch_basicBlockLoop*> &loops) ); | bool getOuterLoops(BPatch_Vector<BPatch_basicBlockLoop*> &loops); | |||
/** BPatch_basicBlockLoop::getLoopBasicBlocks */ | /** BPatch_basicBlockLoop::getLoopBasicBlocks */ | |||
/** returns all basic blocks in the loop */ | /** returns all basic blocks in the loop */ | |||
API_EXPORT(Int, (blocks), | ||||
bool,getLoopBasicBlocks,(BPatch_Vector<BPatch_basicBlock*> &blocks) ); | bool getLoopBasicBlocks(BPatch_Vector<BPatch_basicBlock*> &blocks); | |||
/** BPatch_basicBlockLoop::getLoopBasicBlocksExclusive */ | /** BPatch_basicBlockLoop::getLoopBasicBlocksExclusive */ | |||
/** returns all basic blocks in this loop, exluding the blocks | /** returns all basic blocks in this loop, exluding the blocks | |||
of its sub loops. */ | of its sub loops. */ | |||
API_EXPORT(Int, (blocks), | ||||
bool,getLoopBasicBlocksExclusive,(BPatch_Vector<BPatch_basicBlock*> &blocks)); | bool getLoopBasicBlocksExclusive(BPatch_Vector<BPatch_basicBlock*> &blocks); | |||
/** does this loop or its subloops contain the given block? */ | /** does this loop or its subloops contain the given block? */ | |||
API_EXPORT(Int, (b), | ||||
bool,hasBlock,(BPatch_basicBlock *b)); | bool hasBlock(BPatch_basicBlock *b); | |||
/** does this loop contain the given block? */ | /** does this loop contain the given block? */ | |||
API_EXPORT(Int, (b), | ||||
bool,hasBlockExclusive,(BPatch_basicBlock *b)); | bool hasBlockExclusive(BPatch_basicBlock *b); | |||
/** BPatch_basicBlockLoop::hasAncestor */ | /** BPatch_basicBlockLoop::hasAncestor */ | |||
/** returns true if this loop is a descendant of the given loop */ | /** returns true if this loop is a descendant of the given loop */ | |||
API_EXPORT(Int, (loop), | ||||
bool,hasAncestor,(BPatch_basicBlockLoop *loop)); | bool hasAncestor(BPatch_basicBlockLoop *loop); | |||
/** returns the flow graph this loop is in */ | /** returns the flow graph this loop is in */ | |||
API_EXPORT(Int, (), | ||||
BPatch_flowGraph *,getFlowGraph,()); | BPatch_flowGraph * getFlowGraph(); | |||
/** BPatch_basicBlockLoop::getLoopHead */ | /** BPatch_basicBlockLoop::getLoopHead */ | |||
/** returns the head basic block of the loop */ | /** returns the head basic block of the loop */ | |||
API_EXPORT(Int, (), | ||||
BPatch_basicBlock *,getLoopHead,()); | BPatch_basicBlock * getLoopHead(); | |||
/** BPatch_basicBlockLoop::getLoopIterators */ | /** BPatch_basicBlockLoop::getLoopIterators */ | |||
/** method that returns the variables used as iterator */ | /** method that returns the variables used as iterator */ | |||
/** not implemented yet */ | /** not implemented yet */ | |||
API_EXPORT(Int, (), | ||||
BPatch_Set<BPatch_variableExpr*> *,getLoopIterators,()); | std::set<BPatch_variableExpr*> * getLoopIterators(); | |||
/** BPatch_basicBlockLoop::~BPatch_basicBlockLoop */ | /** BPatch_basicBlockLoop::~BPatch_basicBlockLoop */ | |||
/** destructor for the class */ | /** destructor for the class */ | |||
public: ~BPatch_basicBlockLoop() { } | ~BPatch_basicBlockLoop() { } | |||
std::string format() const; | ||||
private: | private: | |||
// internal use only | // internal use only | |||
/** constructor of class */ | /** constructor of class */ | |||
BPatch_basicBlockLoop(BPatch_flowGraph *); | BPatch_basicBlockLoop(BPatch_flowGraph *); | |||
/** constructor of the class */ | /** constructor of the class */ | |||
BPatch_basicBlockLoop(BPatch_edge *, BPatch_flowGraph *); | BPatch_basicBlockLoop(BPatch_edge *, BPatch_flowGraph *); | |||
/** get either contained or outer loops, determined by outerMostOnly */ | /** get either contained or outer loops, determined by outerMostOnly */ | |||
End of changes. 33 change blocks. | ||||
38 lines changed or deleted | 19 lines changed or added | |||
BPatch_binaryEdit.h | BPatch_binaryEdit.h | |||
---|---|---|---|---|
skipping to change at line 38 | skipping to change at line 38 | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | */ | |||
#ifndef _BPatch_binaryEdit_h_ | #ifndef _BPatch_binaryEdit_h_ | |||
#define _BPatch_binaryEdit_h_ | #define _BPatch_binaryEdit_h_ | |||
//#include "BPatch_snippet.h" | //#include "BPatch_snippet.h" | |||
#include "BPatch_dll.h" | #include "BPatch_dll.h" | |||
#include "BPatch_Vector.h" | #include "BPatch_Vector.h" | |||
#include "BPatch_image.h" | #include "BPatch_image.h" | |||
#include "BPatch_eventLock.h" | ||||
#include "BPatch_addressSpace.h" | #include "BPatch_addressSpace.h" | |||
#include "BPatch_callbacks.h" | #include "BPatch_callbacks.h" | |||
#include <vector> | #include <vector> | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <signal.h> | #include <signal.h> | |||
class BinaryEdit; | class BinaryEdit; | |||
skipping to change at line 104 | skipping to change at line 103 | |||
public: | public: | |||
BinaryEdit *lowlevel_edit() const { return origBinEdit; } | BinaryEdit *lowlevel_edit() const { return origBinEdit; } | |||
bool isMultiThreadCapable() const; | bool isMultiThreadCapable() const; | |||
bool getType(); | bool getType(); | |||
bool getTerminated() {return false;} | bool getTerminated() {return false;} | |||
bool getMutationsActive() {return true;} | bool getMutationsActive() {return true;} | |||
// BPatch_binaryEdit::writeFile | // BPatch_binaryEdit::writeFile | |||
API_EXPORT(Int, (outFile), | bool writeFile(const char * outFile); | |||
bool,writeFile,(const char * outFile)); | ||||
// BPatch_binaryEdit::~BPatch_binaryEdit | // BPatch_binaryEdit::~BPatch_binaryEdit | |||
// | // | |||
// Destructor | // Destructor | |||
API_EXPORT_DTOR(_dtor, (), | ~BPatch_binaryEdit(); | |||
~,BPatch_binaryEdit,()); | ||||
API_EXPORT(Int, (), | BPatch_image * getImage(); | |||
BPatch_image *,getImage,()); | ||||
// BPatch_binaryEdit::beginInsertionSet() | // BPatch_binaryEdit::beginInsertionSet() | |||
// | // | |||
// Start the batch insertion of multiple points; all calls to insertSn ippet* | // Start the batch insertion of multiple points; all calls to insertSn ippet* | |||
// after this call will not actually instrument until finalizeInsertio nSet is | // after this call will not actually instrument until finalizeInsertio nSet is | |||
// called | // called | |||
API_EXPORT_V(Int, (), | void beginInsertionSet(); | |||
void, beginInsertionSet, ()); | ||||
// BPatch_binaryEdit::finalizeInsertionSet() | // BPatch_binaryEdit::finalizeInsertionSet() | |||
// | // | |||
// Finalizes all instrumentation logically added since a call to begin InsertionSet. | // Finalizes all instrumentation logically added since a call to begin InsertionSet. | |||
// Returns true if all instrumentation was successfully inserted; othe rwise, none | // Returns true if all instrumentation was successfully inserted; othe rwise, none | |||
// was. Individual instrumentation can be manipulated via the BPatchSn ippetHandles | // was. Individual instrumentation can be manipulated via the BPatchSn ippetHandles | |||
// returned from individual calls to insertSnippet. | // returned from individual calls to insertSnippet. | |||
// | // | |||
// atomic: if true, all instrumentation will be removed if any fails t o go in. | // atomic: if true, all instrumentation will be removed if any fails t o go in. | |||
// modified: if provided, and set to true by finalizeInsertionSet, add itional | // modified: if provided, and set to true by finalizeInsertionSet, add itional | |||
// steps were taken to make the installation work, such as m odifying | // steps were taken to make the installation work, such as m odifying | |||
// process state. Note that such steps will be taken whethe r or not | // process state. Note that such steps will be taken whethe r or not | |||
// a variable is provided. | // a variable is provided. | |||
API_EXPORT(Int, (atomic, modified), | bool finalizeInsertionSet(bool atomic, bool *modified = NULL); | |||
bool, finalizeInsertionSet, (bool atomic, bool *modified = N | ||||
ULL)); | ||||
// BPatch_binaryEdit::loadLibrary | // BPatch_binaryEdit::loadLibrary | |||
// | // | |||
// Load a shared library into the mutatee's address space | // Load a shared library into the mutatee's address space | |||
// Returns true if successful | // Returns true if successful | |||
API_EXPORT_VIRT(Int, (libname, reload), | virtual BPatch_object * loadLibrary(const char *libname, bool reload = | |||
BPatch_object *, loadLibrary,(const char *libname, bool | false); | |||
reload = false)); | ||||
}; | }; | |||
#endif /* BPatch_binaryEdit_h_ */ | #endif /* BPatch_binaryEdit_h_ */ | |||
End of changes. 7 change blocks. | ||||
15 lines changed or deleted | 7 lines changed or added | |||
BPatch_edge.h | BPatch_edge.h | |||
---|---|---|---|---|
skipping to change at line 35 | skipping to change at line 35 | |||
* | * | |||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | */ | |||
#ifndef _BPatch_edge_h_ | #ifndef _BPatch_edge_h_ | |||
#define _BPatch_edge_h_ | #define _BPatch_edge_h_ | |||
#include "BPatch_dll.h" | #include "BPatch_dll.h" | |||
#include "BPatch_eventLock.h" | ||||
class BPatch_flowGraph; | class BPatch_flowGraph; | |||
class BPatch_basicBlock; | class BPatch_basicBlock; | |||
class BPatch_point; | class BPatch_point; | |||
class edge_instance; | class edge_instance; | |||
class BPatch_edge; | class BPatch_edge; | |||
// XXX ignores indirect jumps | // XXX ignores indirect jumps | |||
typedef enum { | typedef enum { | |||
CondJumpTaken, CondJumpNottaken, UncondJump, NonJump | CondJumpTaken, CondJumpNottaken, UncondJump, NonJump | |||
} BPatch_edgeType; | } BPatch_edgeType; | |||
namespace Dyninst { | namespace Dyninst { | |||
namespace ParseAPI { | namespace ParseAPI { | |||
class Edge; | class Edge; | |||
Edge *convert(const BPatch_edge *); | BPATCH_DLL_EXPORT Edge *convert(const BPatch_edge *); | |||
}; | }; | |||
namespace PatchAPI { | namespace PatchAPI { | |||
class PatchEdge; | class PatchEdge; | |||
PatchEdge *convert(const BPatch_edge *); | BPATCH_DLL_EXPORT PatchEdge *convert(const BPatch_edge *); | |||
}; | }; | |||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_edge | ||||
/** An edge between two blocks | /** An edge between two blocks | |||
*/ | */ | |||
class BPATCH_DLL_EXPORT BPatch_edge : public BPatch_eventLock{ | class BPATCH_DLL_EXPORT BPatch_edge { | |||
friend Dyninst::ParseAPI::Edge *Dyninst::ParseAPI::convert(const BPatch_ edge *); | friend Dyninst::ParseAPI::Edge *Dyninst::ParseAPI::convert(const BPatch_ edge *); | |||
friend Dyninst::PatchAPI::PatchEdge *Dyninst::PatchAPI::convert(const BP atch_edge *); | friend Dyninst::PatchAPI::PatchEdge *Dyninst::PatchAPI::convert(const BP atch_edge *); | |||
public: | public: | |||
// BPatch_edge::BPatch_edge | // BPatch_edge::BPatch_edge | |||
// | // | |||
// constructor | // constructor | |||
API_EXPORT_CTOR(Int, (e, fg), | BPatch_edge(edge_instance *e, BPatch_flowGraph *fg); | |||
BPatch_edge,(edge_instance *e, BPatch_flowGraph *fg)); | ||||
// BPatch_edge::~BPatch_edge | // BPatch_edge::~BPatch_edge | |||
// | // | |||
// destructor | // destructor | |||
API_EXPORT_DTOR(_dtor, (), | ~BPatch_edge(); | |||
~,BPatch_edge,()); | ||||
// BPatch_edge::dump | // BPatch_edge::dump | |||
// | // | |||
// print internal data | // print internal data | |||
API_EXPORT_V(Int, (), | void dump(); | |||
void,dump,()); | ||||
API_EXPORT(Int, (), BPatch_basicBlock *, getSource, ()); | BPatch_basicBlock * getSource(); | |||
API_EXPORT(Int, (), BPatch_basicBlock *, getTarget, ()); | BPatch_basicBlock * getTarget(); | |||
API_EXPORT(Int, (), BPatch_point *, getPoint, ()); | BPatch_point * getPoint(); | |||
API_EXPORT(Int, (), BPatch_edgeType, getType, ()); | BPatch_edgeType getType(); | |||
API_EXPORT(Int, (), BPatch_flowGraph *, getFlowGraph, ()); | BPatch_flowGraph * getFlowGraph(); | |||
private: | private: | |||
BPatch_point *createInstPointAtEdge(); | BPatch_point *createInstPointAtEdge(); | |||
BPatch_point *point; | BPatch_point *point; | |||
edge_instance *edge; | edge_instance *edge; | |||
BPatch_flowGraph *fg; | BPatch_flowGraph *fg; | |||
}; | }; | |||
End of changes. 9 change blocks. | ||||
22 lines changed or deleted | 11 lines changed or added | |||
BPatch_flowGraph.h | BPatch_flowGraph.h | |||
---|---|---|---|---|
skipping to change at line 42 | skipping to change at line 42 | |||
#define _BPatch_flowGraph_h_ | #define _BPatch_flowGraph_h_ | |||
#include <string> | #include <string> | |||
#include <set> | #include <set> | |||
#include "Annotatable.h" | #include "Annotatable.h" | |||
#include "BPatch_dll.h" | #include "BPatch_dll.h" | |||
#include "BPatch_Vector.h" | #include "BPatch_Vector.h" | |||
#include "BPatch_Set.h" | #include "BPatch_Set.h" | |||
#include "BPatch_basicBlock.h" | #include "BPatch_basicBlock.h" | |||
#include "BPatch_basicBlockLoop.h" | #include "BPatch_basicBlockLoop.h" | |||
#include "BPatch_eventLock.h" | ||||
#include "BPatch_loopTreeNode.h" | #include "BPatch_loopTreeNode.h" | |||
#include "BPatch_edge.h" | #include "BPatch_edge.h" | |||
class func_instance; | class func_instance; | |||
class AddressSpace; | class AddressSpace; | |||
class BPatch_edge; | class BPatch_edge; | |||
class edge_instance; | class edge_instance; | |||
typedef BPatch_basicBlockLoop BPatch_loop; | typedef BPatch_basicBlockLoop BPatch_loop; | |||
/** class which represents the control flow graph of a function | /** class which represents the control flow graph of a function | |||
* in a executable code. | * in a executable code. | |||
* | * | |||
* @see BPatch_basicBlock | * @see BPatch_basicBlock | |||
* @see BPatch_basicBlockLoop | * @see BPatch_basicBlockLoop | |||
*/ | */ | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_flowGraph | ||||
class BPATCH_DLL_EXPORT BPatch_flowGraph : | class BPATCH_DLL_EXPORT BPatch_flowGraph : | |||
public BPatch_eventLock, | ||||
public Dyninst::AnnotatableSparse | public Dyninst::AnnotatableSparse | |||
{ | { | |||
friend class BPatch_basicBlock; | friend class BPatch_basicBlock; | |||
friend class BPatch_edge; | friend class BPatch_edge; | |||
friend class BPatch_function; | friend class BPatch_function; | |||
friend class dominatorCFG; | friend class dominatorCFG; | |||
friend class func_instance; // This is illegal here... keeps us from havi ng to | friend class func_instance; // This is illegal here... keeps us from havi ng to | |||
// have a public constructor... PDSEP | // have a public constructor... PDSEP | |||
friend std::ostream& operator<<(std::ostream&,BPatch_flowGraph&); | friend std::ostream& operator<<(std::ostream&,BPatch_flowGraph&); | |||
friend void dfsCreateLoopHierarchy(BPatch_loopTreeNode * parent, | friend void dfsCreateLoopHierarchy(BPatch_loopTreeNode * parent, | |||
skipping to change at line 94 | skipping to change at line 88 | |||
std::map<const block_instance *, BPatch_basicBlock *> blockMap_; | std::map<const block_instance *, BPatch_basicBlock *> blockMap_; | |||
std::map<const edge_instance *, BPatch_edge *> edgeMap_; | std::map<const edge_instance *, BPatch_edge *> edgeMap_; | |||
public: | public: | |||
//BPatch_process *getBProcess() const { return bproc; } | //BPatch_process *getBProcess() const { return bproc; } | |||
BPatch_addressSpace *getAddSpace() const { return addSpace; } | BPatch_addressSpace *getAddSpace() const { return addSpace; } | |||
AddressSpace *getllAddSpace() const; | AddressSpace *getllAddSpace() const; | |||
BPatch_function *getFunction() const { return func_; } | BPatch_function *getFunction() const { return func_; } | |||
BPatch_module *getModule() const { return mod; } | BPatch_module *getModule() const { return mod; } | |||
BPatch_basicBlock *findBlockByAddr(Dyninst::Address addr); | ||||
BPatch_basicBlock *findBlock(block_instance *b); | BPatch_basicBlock *findBlock(block_instance *b); | |||
BPatch_edge *findEdge(edge_instance *e); | BPatch_edge *findEdge(edge_instance *e); | |||
void invalidate(); // invoked when additional parsing takes place | void invalidate(); // invoked when additional parsing takes place | |||
// End of deprecated function | // End of deprecated function | |||
// Functions for use by Dyninst users | // Functions for use by Dyninst users | |||
API_EXPORT_DTOR(_dtor, (), | ~BPatch_flowGraph(); | |||
~,BPatch_flowGraph,()); | ||||
/** returns the set of all basic blocks in the CFG */ | /** returns the set of all basic blocks in the CFG */ | |||
API_EXPORT(Int, (blocks), | bool getAllBasicBlocks(BPatch_Set<BPatch_basicBlock*> &blocks); | |||
bool,getAllBasicBlocks,(BPatch_Set<BPatch_basicBlock*> &blocks)); | bool getAllBasicBlocks(std::set<BPatch_basicBlock *> &blocks); | |||
API_EXPORT(STL, (blocks), | ||||
bool, getAllBasicBlocks,(std::set<BPatch_basicBlock *> &blocks)); | ||||
/** returns the vector of entry basic blocks to CFG */ | /** returns the vector of entry basic blocks to CFG */ | |||
API_EXPORT(Int, (blocks), | bool getEntryBasicBlock(BPatch_Vector<BPatch_basicBlock*> &blocks); | |||
bool,getEntryBasicBlock,(BPatch_Vector<BPatch_basicBlock*> &blocks)); | ||||
/** returns the vector of exit basic blocks to CFG */ | /** returns the vector of exit basic blocks to CFG */ | |||
API_EXPORT(Int, (blocks), | bool getExitBasicBlock(BPatch_Vector<BPatch_basicBlock*> &blocks); | |||
bool,getExitBasicBlock,(BPatch_Vector<BPatch_basicBlock*> &blocks)); | ||||
/** Finds the block containing a specific instruction. Warning: | ||||
this method is slow! **/ | ||||
BPatch_basicBlock *findBlockByAddr(Dyninst::Address addr); | ||||
/** returns the vector of loops in CFG */ | /** returns the vector of loops in CFG */ | |||
API_EXPORT(Int, (loops), | bool getLoops(BPatch_Vector<BPatch_basicBlockLoop*> &loops); | |||
bool,getLoops,(BPatch_Vector<BPatch_basicBlockLoop*> &loops)); | ||||
/** returns a vector of outer loops in the CFG */ | /** returns a vector of outer loops in the CFG */ | |||
API_EXPORT(Int, (loops), | bool getOuterLoops(BPatch_Vector<BPatch_basicBlockLoop*> &loops); | |||
bool,getOuterLoops,(BPatch_Vector<BPatch_basicBlockLoop*> &loops)); | ||||
/** creates the source line blocks of all blocks in CFG. | /** creates the source line blocks of all blocks in CFG. | |||
* without calling this method line info is not available | * without calling this method line info is not available | |||
*/ | */ | |||
API_EXPORT(Int, (), | bool createSourceBlocks(); | |||
bool,createSourceBlocks,()); | ||||
/** fills the dominator and immediate-dom information of basic blocks. | /** fills the dominator and immediate-dom information of basic blocks. | |||
* without calling this method dominator info is not available | * without calling this method dominator info is not available | |||
*/ | */ | |||
API_EXPORT_V(Int, (), | void fillDominatorInfo(); | |||
void,fillDominatorInfo,()); | ||||
/** same as above, but for postdominator/immediate-postdom info | /** same as above, but for postdominator/immediate-postdom info | |||
*/ | */ | |||
API_EXPORT_V(Int, (), | void fillPostDominatorInfo(); | |||
void,fillPostDominatorInfo,()); | ||||
/** return root of loop hierarchy */ | /** return root of loop hierarchy */ | |||
API_EXPORT(Int, (), | BPatch_loopTreeNode * getLoopTree(); | |||
BPatch_loopTreeNode *,getLoopTree,()); | ||||
/** returns true if the cfg contains dynamic callsites */ | /** returns true if the cfg contains dynamic callsites */ | |||
API_EXPORT(Int, (), | bool containsDynamicCallsites(); | |||
bool,containsDynamicCallsites,()); | ||||
// for debugging, print loops with line numbers to stderr | // for debugging, print loops with line numbers to stderr | |||
API_EXPORT_V(Int, (), | void printLoops(); | |||
void,printLoops,()); | ||||
API_EXPORT(Int, (name), | BPatch_basicBlockLoop * findLoop(const char *name); | |||
BPatch_basicBlockLoop *,findLoop,(const char *name)); | ||||
// Deprecated - this should not be an API method | // Deprecated - this should not be an API method | |||
//API_EXPORT_V(Int, (), | //void, initLivenessInfo(); | |||
//void, initLivenessInfo,()); | ||||
API_EXPORT(Int, (), | bool isValid(); | |||
bool,isValid,()); | ||||
/* | /* | |||
API_EXPORT(Int, (edge), | BPatch_point * createInstPointAtEdge(BPatch_edge *edge); | |||
BPatch_point *,createInstPointAtEdge,(BPatch_edge *edge)); | ||||
*/ | */ | |||
// Deprecated... use BPatch_edge->point() instead | // Deprecated... use BPatch_edge->point() instead | |||
/** find instrumentation points specified by loc, add to points*/ | /** find instrumentation points specified by loc, add to points*/ | |||
API_EXPORT(Int, (loc, loop), | BPatch_Vector<BPatch_point*> * | |||
BPatch_Vector<BPatch_point*> *, | findLoopInstPoints(const BPatch_procedureLocation loc, | |||
findLoopInstPoints,(CONST_EXPORT BPatch_procedureLocation loc, | BPatch_basicBlockLoop *loop); | |||
BPatch_basicBlockLoop *loop)); | ||||
private: | private: | |||
BPatch_function *func_; | BPatch_function *func_; | |||
BPatch_addressSpace *addSpace; | BPatch_addressSpace *addSpace; | |||
// BPatch_process *bproc; | // BPatch_process *bproc; | |||
BPatch_module *mod; | BPatch_module *mod; | |||
/** set of loops contained in control flow graph */ | /** set of loops contained in control flow graph */ | |||
BPatch_Set<BPatch_basicBlockLoop*> *loops; | std::set<BPatch_basicBlockLoop*> *loops; | |||
/** set of all basic blocks that control flow graph has */ | /** set of all basic blocks that control flow graph has */ | |||
BPatch_Set<BPatch_basicBlock*> allBlocks; | std::set<BPatch_basicBlock*> allBlocks; | |||
/** root of the tree of loops */ | /** root of the tree of loops */ | |||
BPatch_loopTreeNode *loopRoot; | BPatch_loopTreeNode *loopRoot; | |||
/** set of back edges */ | /** set of back edges */ | |||
BPatch_Set<BPatch_edge*> backEdges; | std::set<BPatch_edge*> backEdges; | |||
/** flag that keeps whether dominator info is initialized*/ | /** flag that keeps whether dominator info is initialized*/ | |||
bool isDominatorInfoReady; | bool isDominatorInfoReady; | |||
/** flag that keeps whether postdominator info is initialized*/ | /** flag that keeps whether postdominator info is initialized*/ | |||
bool isPostDominatorInfoReady; | bool isPostDominatorInfoReady; | |||
/** flag that keeps whether source block info is initialized*/ | /** flag that keeps whether source block info is initialized*/ | |||
bool isSourceBlockInfoReady; | bool isSourceBlockInfoReady; | |||
skipping to change at line 219 | skipping to change at line 198 | |||
/** create the tree of loops/callees for this flow graph */ | /** create the tree of loops/callees for this flow graph */ | |||
void createLoopHierarchy(); | void createLoopHierarchy(); | |||
void dfsVisitWithTargets(BPatch_basicBlock*,int*); | void dfsVisitWithTargets(BPatch_basicBlock*,int*); | |||
void dfsVisitWithSources(BPatch_basicBlock*,int*); | void dfsVisitWithSources(BPatch_basicBlock*,int*); | |||
void findAndDeleteUnreachable(); | void findAndDeleteUnreachable(); | |||
static void findBBForBackEdge(BPatch_edge*, | static void findBBForBackEdge(BPatch_edge*, | |||
BPatch_Set<BPatch_basicBlock*>&); | std::set<BPatch_basicBlock*>&); | |||
void getLoopsByNestingLevel(BPatch_Vector<BPatch_basicBlockLoop*>&, | void getLoopsByNestingLevel(BPatch_Vector<BPatch_basicBlockLoop*>&, | |||
bool outerMostOnly); | bool outerMostOnly); | |||
bool dfsInsertCalleeIntoLoopHierarchy(BPatch_loopTreeNode *node, | bool dfsInsertCalleeIntoLoopHierarchy(BPatch_loopTreeNode *node, | |||
func_instance *func, | func_instance *func, | |||
unsigned long addr); | unsigned long addr); | |||
void insertCalleeIntoLoopHierarchy(func_instance * func, unsigned long ad dr); | void insertCalleeIntoLoopHierarchy(func_instance * func, unsigned long ad dr); | |||
End of changes. 25 change blocks. | ||||
50 lines changed or deleted | 29 lines changed or added | |||
BPatch_frame.h | BPatch_frame.h | |||
---|---|---|---|---|
skipping to change at line 48 | skipping to change at line 48 | |||
*/ | */ | |||
typedef enum { | typedef enum { | |||
BPatch_frameNormal, | BPatch_frameNormal, | |||
BPatch_frameSignal, | BPatch_frameSignal, | |||
BPatch_frameTrampoline | BPatch_frameTrampoline | |||
} BPatch_frameType; | } BPatch_frameType; | |||
class BPatch_function; | class BPatch_function; | |||
class BPatch_thread; | class BPatch_thread; | |||
#ifdef DYNINST_CLASS_NAME | class BPATCH_DLL_EXPORT BPatch_frame { | |||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_frame | ||||
class BPATCH_DLL_EXPORT BPatch_frame : public BPatch_eventLock{ | ||||
friend class BPatch_thread; | friend class BPatch_thread; | |||
friend class BPatch_Vector<BPatch_frame>; | friend class BPatch_Vector<BPatch_frame>; | |||
BPatch_thread *thread; | BPatch_thread *thread; | |||
void *pc; | void *pc; | |||
void *fp; | void *fp; | |||
bool isSignalFrame; | bool isSignalFrame; | |||
bool isTrampFrame; | bool isTrampFrame; | |||
// BPatch defines that a trampoline is effectively a "function call" an d | // BPatch defines that a trampoline is effectively a "function call" an d | |||
// puts an extra tramp on the stack. Various people (frex, Paradyn) rea lly | // puts an extra tramp on the stack. Various people (frex, Paradyn) rea lly | |||
skipping to change at line 85 | skipping to change at line 80 | |||
void *_pc, void *_fp, | void *_pc, void *_fp, | |||
bool isf = false, | bool isf = false, | |||
bool istr = false, BPatch_point *point = NULL, | bool istr = false, BPatch_point *point = NULL, | |||
bool isSynth = false); | bool isSynth = false); | |||
// BPatch_frame::getFrameType | // BPatch_frame::getFrameType | |||
// Returns type of frame: BPatch_frameNormal for a stack frame for a | // Returns type of frame: BPatch_frameNormal for a stack frame for a | |||
// function, BPatch_frameSignal for the stack frame created when a sig nal | // function, BPatch_frameSignal for the stack frame created when a sig nal | |||
// is delivered, or BPatch_frameTrampoline for a stack frame created b y | // is delivered, or BPatch_frameTrampoline for a stack frame created b y | |||
// internal Dyninst instrumentation. | // internal Dyninst instrumentation. | |||
API_EXPORT(Int, (), | BPatch_frameType getFrameType(); | |||
BPatch_frameType,getFrameType,()); | ||||
// Only call if you know what you are doing; per-frame method for dete rmining | // Only call if you know what you are doing; per-frame method for dete rmining | |||
// how the frame was created. | // how the frame was created. | |||
API_EXPORT(Int, (), | bool isSynthesized(); | |||
bool, isSynthesized, ()); | ||||
// BPatch_frame::getThread | // BPatch_frame::getThread | |||
// Returns: value of program counter | // Returns: value of program counter | |||
API_EXPORT(Int, (), | ||||
BPatch_thread *,getThread,()); | BPatch_thread * getThread(); | |||
// BPatch_frame::getThread | // BPatch_frame::getThread | |||
// Returns: value of program counter | // Returns: value of program counter | |||
API_EXPORT(Int, (), | ||||
BPatch_point *,getPoint,()); | BPatch_point * getPoint(); | |||
// BPatch_frame::getPC | // BPatch_frame::getPC | |||
// Returns: value of program counter | // Returns: value of program counter | |||
API_EXPORT(Int, (), | ||||
void *,getPC,()); | void * getPC(); | |||
// BPatch_frame::getFP | // BPatch_frame::getFP | |||
API_EXPORT(Int, (), | ||||
void *,getFP,()); | void * getFP(); | |||
// BPatch_frame::findFunction | // BPatch_frame::findFunction | |||
// Returns: the function corresponding to this stack frame, NULL | // Returns: the function corresponding to this stack frame, NULL | |||
// if there is none | // if there is none | |||
API_EXPORT(Int, (), | ||||
BPatch_function *,findFunction,()); | BPatch_function * findFunction(); | |||
// The following are planned but no yet implemented: | // The following are planned but no yet implemented: | |||
// int getSignalNumber(); | // int getSignalNumber(); | |||
API_EXPORT(Int, (), | BPatch_point * findPoint(); | |||
BPatch_point *,findPoint,()); | ||||
friend std::ostream & operator << ( std::ostream & s, BPatch_frame & m ); | friend std::ostream & operator << ( std::ostream & s, BPatch_frame & m ); | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 14 change blocks. | ||||
23 lines changed or deleted | 9 lines changed or added | |||
BPatch_function.h | BPatch_function.h | |||
---|---|---|---|---|
skipping to change at line 41 | skipping to change at line 41 | |||
#ifndef _BPatch_function_h_ | #ifndef _BPatch_function_h_ | |||
#define _BPatch_function_h_ | #define _BPatch_function_h_ | |||
#include "Annotatable.h" | #include "Annotatable.h" | |||
#include "BPatch_dll.h" | #include "BPatch_dll.h" | |||
#include "BPatch_Vector.h" | #include "BPatch_Vector.h" | |||
#include "BPatch_Set.h" | #include "BPatch_Set.h" | |||
#include "BPatch_enums.h" | #include "BPatch_enums.h" | |||
#include "BPatch_type.h" | #include "BPatch_type.h" | |||
#include "BPatch_module.h" | #include "BPatch_module.h" | |||
#include "BPatch_eventLock.h" | ||||
#include "BPatch_memoryAccess_NP.h" | #include "BPatch_memoryAccess_NP.h" | |||
//#include "BPatch_dependenceGraphNode.h" | //#include "BPatch_dependenceGraphNode.h" | |||
// class BPatch_dependenceGraphNode; | // class BPatch_dependenceGraphNode; | |||
class func_instance; | class func_instance; | |||
class InstrucIter; | class InstrucIter; | |||
class BPatch_localVarCollection; | class BPatch_localVarCollection; | |||
class BPatch_function; | class BPatch_function; | |||
class BPatch_point; | class BPatch_point; | |||
class BPatch_flowGraph; | class BPatch_flowGraph; | |||
class BPatchTranslatorBase; | class BPatchTranslatorBase; | |||
class ParameterType; | class ParameterType; | |||
class ReturnParameterType; | class ReturnParameterType; | |||
class BPatch_function; | class BPatch_function; | |||
namespace Dyninst { | namespace Dyninst { | |||
namespace ParseAPI { | namespace ParseAPI { | |||
class Function; | class Function; | |||
PARSER_EXPORT Function *convert(const BPatch_function *); | BPATCH_DLL_EXPORT Function *convert(const BPatch_function *); | |||
}; | }; | |||
namespace PatchAPI { | namespace PatchAPI { | |||
class PatchFunction; | class PatchFunction; | |||
PARSER_EXPORT PatchFunction *convert(const BPatch_function *); | BPATCH_DLL_EXPORT PatchFunction *convert(const BPatch_function *); | |||
}; | }; | |||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_function | ||||
class BPATCH_DLL_EXPORT BPatch_function : | class BPATCH_DLL_EXPORT BPatch_function : | |||
public BPatch_sourceObj, | public BPatch_sourceObj, | |||
public BPatch_eventLock, | ||||
public Dyninst::AnnotatableSparse | public Dyninst::AnnotatableSparse | |||
{ | { | |||
friend class BPatch_flowGraph; | friend class BPatch_flowGraph; | |||
friend class InstrucIter; | friend class InstrucIter; | |||
friend class BPatch_basicBlock; | friend class BPatch_basicBlock; | |||
friend class BPatch_asyncEventHandler; | friend class BPatch_asyncEventHandler; | |||
friend class BPatch_image; | friend class BPatch_image; | |||
friend class BPatch_thread; | friend class BPatch_thread; | |||
friend class BPatch_process; | friend class BPatch_process; | |||
friend class BPatch_binaryEdit; | friend class BPatch_binaryEdit; | |||
skipping to change at line 182 | skipping to change at line 175 | |||
// BPatch_storageClass _sc = BPatch_storageFrameOffset); | // BPatch_storageClass _sc = BPatch_storageFrameOffset); | |||
void fixupUnknown(BPatch_module *); | void fixupUnknown(BPatch_module *); | |||
// This isn't so much for internal use only, but it *should* | // This isn't so much for internal use only, but it *should* | |||
// remain undocumented for now. | // remain undocumented for now. | |||
bool containsSharedBlocks(); | bool containsSharedBlocks(); | |||
// End of functions for internal use only | // End of functions for internal use only | |||
// For users of the library: | // For users of the library: | |||
API_EXPORT(Str, (), std::string, getName, ()); | ||||
API_EXPORT(Str, (), std::string, getDemangledName, ()); | ||||
API_EXPORT(Str, (), std::string, getMangledName, ()); | ||||
API_EXPORT(Str, (), std::string, getTypedName, ()); | ||||
API_EXPORT(Str, (names), bool, getNames, (std::vector<std::string> & | ||||
names)); | ||||
API_EXPORT(Str, (names), bool, getDemangledNames, (std::vector<std:: | ||||
string> &names)); | ||||
API_EXPORT(Str, (names), bool, getMangledNames, (std::vector<std::st | ||||
ring> &names)); | ||||
API_EXPORT(Str, (names), bool, getTypedNames, (std::vector<std::stri | ||||
ng> &names)); | ||||
// BPatch_function::getName | // BPatch_function::getName | |||
// Returns <demangled> name of function | // Returns <demangled> name of function | |||
API_EXPORT(Buffer, (s, len), | ||||
char *,getName,(char *s, int len)); | char * getName(char *s, int len); | |||
// String interface to mangled name | // String interface to mangled name | |||
std::string getName(); | ||||
std::string getMangledName(); | ||||
std::string getDemangledName(); | ||||
std::string getTypedName(); | ||||
bool getNames(std::vector<std::string> &names); | ||||
bool getDemangledNames(std::vector<std::string> &names); | ||||
bool getMangledNames(std::vector<std::string> &names); | ||||
bool getTypedNames(std::vector<std::string> &names); | ||||
// BPatch_function::getMangledName | // BPatch_function::getMangledName | |||
// Returns mangled name of function, same as getName for non-c++ mutat ees | // Returns mangled name of function, same as getName for non-c++ mutat ees | |||
API_EXPORT(Int, (s, len), | ||||
char *,getMangledName,(char *s, int len)); | char * getMangledName(char *s, int len); | |||
// BPatch_function::getTypedName | // BPatch_function::getTypedName | |||
// Returns demanged name of function (with type string), may be empty | // Returns demanged name of function (with type string), may be empty | |||
API_EXPORT(Int, (s, len), | ||||
char *,getTypedName,(char *s, int len)); | char * getTypedName(char *s, int len); | |||
// BPatch_function::getNames | // BPatch_function::getNames | |||
// Adds all names of the function (inc. weak symbols) to the | // Adds all names of the function (inc. weak symbols) to the | |||
// provided vector. Names are represented as const char *s, | // provided vector. Names are represented as const char *s, | |||
// and do not require cleanup by the user. | // and do not require cleanup by the user. | |||
API_EXPORT(Int, (names), | bool getNames(BPatch_Vector<const char *> &names); | |||
bool, getNames, (BPatch_Vector<const char *> &names)); | ||||
// BPatch_function::getMangledNames | // BPatch_function::getMangledNames | |||
// Adds all mangled names of the function (inc. weak symbols) to | // Adds all mangled names of the function (inc. weak symbols) to | |||
// the provided vector. Names are represented as const char *s, | // the provided vector. Names are represented as const char *s, | |||
// and do not require cleanup by the user. | // and do not require cleanup by the user. | |||
API_EXPORT(Int, (names), | bool getMangledNames(BPatch_Vector<const char *> &names); | |||
bool, getMangledNames, (BPatch_Vector<const char *> &names)); | ||||
// BPatch_function::getBaseAddr | // BPatch_function::getBaseAddr | |||
// Returns base address of function | // Returns base address of function | |||
API_EXPORT(Int, (), | ||||
void *,getBaseAddr,(void)); | void * getBaseAddr(void); | |||
// BPatch_function::getReturnType | // BPatch_function::getReturnType | |||
// Returns the <BPatch_type> return type of this function | // Returns the <BPatch_type> return type of this function | |||
API_EXPORT(Int, (), | BPatch_type * getReturnType(); | |||
BPatch_type *,getReturnType,()); | ||||
// BPatch_function::getModule | // BPatch_function::getModule | |||
// Returns the BPatch_module to which this function belongs | // Returns the BPatch_module to which this function belongs | |||
API_EXPORT(Int, (), | BPatch_module * getModule(); | |||
BPatch_module *,getModule,()); | ||||
// BPatch_function::getParams | // BPatch_function::getParams | |||
// Returns a vector of BPatch_localVar, representing this function's p arameters | // Returns a vector of BPatch_localVar, representing this function's p arameters | |||
API_EXPORT(Int, (), | BPatch_Vector<BPatch_localVar *> * getParams(); | |||
BPatch_Vector<BPatch_localVar *> *,getParams,()); | ||||
// BPatch_function::getVars | // BPatch_function::getVars | |||
// Returns a vector of local variables in this functions | // Returns a vector of local variables in this functions | |||
API_EXPORT(Int, (), | BPatch_Vector<BPatch_localVar *> * getVars(); | |||
BPatch_Vector<BPatch_localVar *> *,getVars,()); | ||||
// BPatch_function::findPoint | // BPatch_function::findPoint | |||
// Returns a vector of inst points, corresponding to the given BPatch_ procedureLocation | // Returns a vector of inst points, corresponding to the given BPatch_ procedureLocation | |||
API_EXPORT(Int, (loc), | BPatch_Vector<BPatch_point *> * findPoint(const BPatch_procedureLocatio | |||
n loc); | ||||
BPatch_Vector<BPatch_point *> *,findPoint,(CONST_EXPORT BPatch_procedur | ||||
eLocation loc)); | ||||
// BPatch_function::findPoint | // BPatch_function::findPoint | |||
// Returns a vector of inst points, corresponding to the given set of op codes | // Returns a vector of inst points, corresponding to the given set of op codes | |||
API_EXPORT(ByOp, (ops), | BPatch_Vector<BPatch_point *> * findPoint(const BPatch_Set<BPatch_opCod | |||
e>& ops); | ||||
BPatch_Vector<BPatch_point *> *,findPoint,(const BPatch_Set<BPatch_opCo | BPatch_Vector<BPatch_point *> * findPoint(const std::set<BPatch_opCode> | |||
de>& ops)); | & ops); | |||
// BPatch_function::findPoint | // BPatch_function::findPoint | |||
// | // | |||
// Returns a BPatch_point that corresponds with the provided address. Returns NULL | // Returns a BPatch_point that corresponds with the provided address. Returns NULL | |||
// if the address does not correspond with an instruction. | // if the address does not correspond with an instruction. | |||
API_EXPORT(Int, (addr), | BPatch_point * findPoint(Dyninst::Address addr); | |||
BPatch_point *, findPoint, (Dyninst::Address addr)); | ||||
// BPatch_function::findLocalVar | // BPatch_function::findLocalVar | |||
// Returns a BPatch_localVar, if a match for <name> is found | // Returns a BPatch_localVar, if a match for <name> is found | |||
API_EXPORT(Int, (name), | BPatch_localVar * findLocalVar(const char * name); | |||
BPatch_localVar *,findLocalVar,(const char * name)); | ||||
// BPatch_function::findLocalParam | // BPatch_function::findLocalParam | |||
// Returns a BPatch_localVar, if a match for <name> is found | // Returns a BPatch_localVar, if a match for <name> is found | |||
API_EXPORT(Int, (name), | BPatch_localVar * findLocalParam(const char * name); | |||
BPatch_localVar *,findLocalParam,(const char * name)); | ||||
// BPatch_function::findVariable | // BPatch_function::findVariable | |||
// Returns a set of variables matching <name> at the scope of this fun ction | // Returns a set of variables matching <name> at the scope of this fun ction | |||
// -- or global scope, if nothing found in this scope | // -- or global scope, if nothing found in this scope | |||
API_EXPORT(Int, (name), | BPatch_Vector<BPatch_variableExpr *> * findVariable(const char *name); | |||
BPatch_Vector<BPatch_variableExpr *> *,findVariable,(const char *name)) | ||||
; | ||||
API_EXPORT(Int, (name, vars), | bool findVariable(const char *name, BPatch_Vector<BPatch_variableExpr* | |||
bool, findVariable,(const char *name, BPatch_Vector<BPatch_variableExpr | > &vars); | |||
*> &vars)); | ||||
// BPatch_function::getVariables | // BPatch_function::getVariables | |||
// This returns false, and should probably not exist. See getVars. | // This returns false, and should probably not exist. See getVars. | |||
// is this defined, what variables should be returned?? | // is this defined, what variables should be returned?? | |||
// FIXME (delete me) | // FIXME (delete me) | |||
API_EXPORT(Int, (vect), | bool getVariables(BPatch_Vector<BPatch_variableExpr *> &vect); | |||
bool,getVariables,(BPatch_Vector<BPatch_variableExpr *> &vect)); | ||||
// BPatch_function::getModuleName | // BPatch_function::getModuleName | |||
// Returns name of module this function belongs to | // Returns name of module this function belongs to | |||
API_EXPORT(Int, (name, maxLen), | char * getModuleName(char *name, int maxLen); | |||
char *,getModuleName,(char *name, int maxLen)); | ||||
// BPatch_function::isInstrumentable | // BPatch_function::isInstrumentable | |||
// | // | |||
// Returns true if the function is instrumentable. | // Returns true if the function is instrumentable. | |||
API_EXPORT(Int, (), | bool isInstrumentable(); | |||
bool,isInstrumentable,()); | ||||
// BPatch_function::isSharedLib | // BPatch_function::isSharedLib | |||
// Returns true if this function lives in a shared library | // Returns true if this function lives in a shared library | |||
API_EXPORT(Int, (), | bool isSharedLib(); | |||
bool,isSharedLib,()); | ||||
// BPatch_function::getCFG | // BPatch_function::getCFG | |||
// | // | |||
// method to create the control flow graph for the function | // method to create the control flow graph for the function | |||
API_EXPORT(Int, (), | BPatch_flowGraph* getCFG(); | |||
BPatch_flowGraph*,getCFG,()); | ||||
API_EXPORT(Int, (name, isPrimary, isMangled), | const char * addName(const char *name, bool isPrimary = true, bool isM | |||
const char *, addName, (const char *name, bool isPrimary = true, bool i | angled = false); | |||
sMangled = false)); | ||||
// Return native pointer to the function. | // Return native pointer to the function. | |||
// Allocates and returns a special type of BPatch_variableExpr. | // Allocates and returns a special type of BPatch_variableExpr. | |||
API_EXPORT( Int, (), BPatch_variableExpr *, getFunctionRef, () ); | ||||
// Get all functions that share a block (or any code, but it will | // Get all functions that share a block (or any code, but it will | |||
// always be a block) with this function. | // always be a block) with this function. | |||
API_EXPORT( Int, (funcs), bool, findOverlapping, (BPatch_Vector<BPatch_ function *> &funcs)); | ||||
// Get the underlying ParseAPI Function | // Get the underlying ParseAPI Function | |||
operator Dyninst::ParseAPI::Function *() const; | operator Dyninst::ParseAPI::Function *() const; | |||
// Get the underlying PatchAPI Function | // Get the underlying PatchAPI Function | |||
operator Dyninst::PatchAPI::PatchFunction *() const; | operator Dyninst::PatchAPI::PatchFunction *() const; | |||
API_EXPORT(Int, (start, end), | bool getAddressRange(void * &start, void * &end); | |||
bool,getAddressRange,(void * &start, void * &end)); | ||||
API_EXPORT(Int, (start, end), | bool getAddressRange(Dyninst::Address &start, Dyninst::Addre | |||
bool,getAddressRange,(Dyninst::Address &start, Dyninst::Addr | ss &end); | |||
ess &end)); | ||||
API_EXPORT(Int, (), | unsigned int getFootprint(); | |||
unsigned int,getFootprint,()); | BPatch_variableExpr *getFunctionRef(); | |||
bool findOverlapping(BPatch_Vector<BPatch_function *> &funcs); | ||||
}; | }; | |||
#endif /* _BPatch_function_h_ */ | #endif /* _BPatch_function_h_ */ | |||
End of changes. 39 change blocks. | ||||
94 lines changed or deleted | 45 lines changed or added | |||
BPatch_image.h | BPatch_image.h | |||
---|---|---|---|---|
skipping to change at line 39 | skipping to change at line 39 | |||
*/ | */ | |||
#ifndef _BPatch_image_h_ | #ifndef _BPatch_image_h_ | |||
#define _BPatch_image_h_ | #define _BPatch_image_h_ | |||
#include "BPatch_dll.h" | #include "BPatch_dll.h" | |||
#include "BPatch_sourceObj.h" | #include "BPatch_sourceObj.h" | |||
#include "BPatch_Vector.h" | #include "BPatch_Vector.h" | |||
#include "BPatch_module.h" | #include "BPatch_module.h" | |||
#include "BPatch_type.h" | #include "BPatch_type.h" | |||
#include "BPatch_eventLock.h" | ||||
#include "BPatch_process.h" | #include "BPatch_process.h" | |||
#include "BPatch_binaryEdit.h" | #include "BPatch_binaryEdit.h" | |||
#include "BPatch_parRegion.h" | #include "BPatch_parRegion.h" | |||
#include "dyntypes.h" | #include "dyntypes.h" | |||
#include <vector> | #include <vector> | |||
#include <map> | #include <map> | |||
typedef bool (*BPatchFunctionNameSieve)(const char *test,void *data); | typedef bool (*BPatchFunctionNameSieve)(const char *test,void *data); | |||
class image; | class image; | |||
class int_variable; | class int_variable; | |||
class BPatch_point; | class BPatch_point; | |||
class BPatch_object; | class BPatch_object; | |||
#ifdef IBM_BPATCH_COMPAT | #ifdef IBM_BPATCH_COMPAT | |||
typedef enum BPatch_LpModel { | typedef enum BPatch_LpModel { | |||
LP32, /* 32 bit image */ | LP32, /* 32 bit image */ | |||
LP64, /* 64 bit image */ | LP64, /* 64 bit image */ | |||
UNKNOWN_LP /* cannot be determined */ | UNKNOWN_LP /* cannot be determined */ | |||
}; | }; | |||
#endif | #endif | |||
class BPatch_statement; | class BPatch_statement; | |||
class BPatch_image; | class BPatch_image; | |||
class BPatch_object_getMod; | ||||
namespace Dyninst { | namespace Dyninst { | |||
namespace PatchAPI { | namespace PatchAPI { | |||
class PatchMgr; | class PatchMgr; | |||
typedef boost::shared_ptr<PatchMgr> PatchMgrPtr; | typedef boost::shared_ptr<PatchMgr> PatchMgrPtr; | |||
PatchMgrPtr convert(const BPatch_image *); | BPATCH_DLL_EXPORT PatchMgrPtr convert(const BPatch_image *); | |||
} | } | |||
} | } | |||
#ifdef DYNINST_CLASS_NAME | class BPATCH_DLL_EXPORT BPatch_image: public BPatch_sourceObj { | |||
#undef DYNINST_CLASS_NAME | friend class BPatch; // registerLoaded... callbacks | |||
#endif | friend class BPatch_module; // access to findOrCreate... | |||
#define DYNINST_CLASS_NAME BPatch_image | friend class BPatch_object; // Also access to findOrCreate | |||
friend class BPatch_object_getMod; | ||||
class BPATCH_DLL_EXPORT BPatch_image: public BPatch_sourceObj, public BPatc | friend class BPatch_process; | |||
h_eventLock { | friend class BPatch_addressSpace; | |||
friend class BPatch; // registerLoaded... callbacks | friend class BPatch_binaryEdit; | |||
friend class BPatch_module; // access to findOrCreate... | friend Dyninst::PatchAPI::PatchMgrPtr Dyninst::PatchAPI::convert(const BP | |||
friend class BPatch_process; | atch_image *); | |||
friend class BPatch_addressSpace; | ||||
friend class BPatch_binaryEdit; | ||||
friend Dyninst::PatchAPI::PatchMgrPtr Dyninst::PatchAPI::convert(const | ||||
BPatch_image *); | ||||
friend class BPatch_object; | ||||
BPatch_variableExpr *findOrCreateVariable(int_variable *); | BPatch_variableExpr *findOrCreateVariable(int_variable *); | |||
public: | public: | |||
// The following functions are for internal use by the library only: | // The following functions are for internal use by the library only: | |||
// As such, these functions are not locked. | // As such, these functions are not locked. | |||
//BPatch_image(BPatch_process *_proc); | //BPatch_image(BPatch_process *_proc); | |||
BPatch_image(BPatch_addressSpace *addSpace); | BPatch_image(BPatch_addressSpace *addSpace); | |||
BPatch_image(); | BPatch_image(); | |||
BPatch_module *findModule(mapped_module *base); | BPatch_module *findModule(mapped_module *base); | |||
BPatch_object *findObject(mapped_object *base); | BPatch_object *findObject(mapped_object *base); | |||
virtual ~BPatch_image(); | virtual ~BPatch_image(); | |||
void getNewCodeRegions | void getNewCodeRegions | |||
(std::vector<BPatch_function*>&newFuncs, | (std::vector<BPatch_function*>&newFuncs, | |||
std::vector<BPatch_function*>&modFuncs); | std::vector<BPatch_function*>&modFuncs); | |||
void clearNewCodeRegions(); | void clearNewCodeRegions(); | |||
// End functions for internal use only | // End functions for internal use only | |||
// BPatch_image::getThr | // BPatch_image::getThr | |||
// | // | |||
// return the BPatch_thread associated with this image | // return the BPatch_thread associated with this image | |||
API_EXPORT(Int, (), | BPatch_thread * getThr(); | |||
BPatch_thread *,getThr,()); | ||||
// BPatch_image::getAddressSpace() | ||||
// BPatch_image::getAddressSpace() | // | |||
// | // return the BPatch_addressSpace associated with this image | |||
// return the BPatch_addressSpace associated with this image | BPatch_addressSpace * getAddressSpace(); | |||
API_EXPORT(Int, (), | ||||
BPatch_addressSpace *,getAddressSpace,()); | // BPatch_image::getProcess | |||
// | ||||
// BPatch_image::getProcess | // return the BPatch_process associated with this image | |||
// | BPatch_process * getProcess(); | |||
// return the BPatch_process associated with this image | ||||
API_EXPORT(Int, (), | // BPatch_image::getSourceObj | |||
BPatch_process *,getProcess,()); | // | |||
// fill a vector with children source objects (modules) | ||||
// BPatch_image::getSourceObj | ||||
// | bool getSourceObj(BPatch_Vector<BPatch_sourceObj *> &sources); | |||
// fill a vector with children source objects (modules) | ||||
API_EXPORT(Int, (sources), | // BPatch_image::getObjParent | |||
// | ||||
bool,getSourceObj,(BPatch_Vector<BPatch_sourceObj *> &sources)); | // Return the parent of this image (always NULL since this is the top le | |||
vel) | ||||
// BPatch_image::getObjParent | ||||
// | BPatch_sourceObj * getObjParent(); | |||
// Return the parent of this image (always NULL since this is the top | ||||
level) | // BPatch_image::getVariables | |||
API_EXPORT(Int, (), | // | |||
// Returns the global variables defined in this image | ||||
BPatch_sourceObj *,getObjParent,()); | ||||
bool getVariables(BPatch_Vector<BPatch_variableExpr *> &vars); | ||||
// BPatch_image::getVariables | ||||
// | // BPatch_image::getProcedures | |||
// Returns the global variables defined in this image | // | |||
API_EXPORT(Int, (vars), | // Returns a list of all procedures in the image upon success, | |||
// NULL upon failure | ||||
bool,getVariables,(BPatch_Vector<BPatch_variableExpr *> &vars)); | BPatch_Vector<BPatch_function *> * getProcedures(bool incUninstrumentable | |||
= false); | ||||
// BPatch_image::getProcedures | ||||
// | bool getProcedures(BPatch_Vector<BPatch_function*> &procs, bool incUninst | |||
// Returns a list of all procedures in the image upon success, | rumentable = false); | |||
// NULL upon failure | ||||
API_EXPORT(Int, (incUninstrumentable), | // BPatch_image::getParRegions | |||
BPatch_Vector<BPatch_function *> *,getProcedures,(bool incUninstrumenta | // | |||
ble = false)); | // Returns a list of all procedures in the image upon success, | |||
// NULL upon failure | ||||
API_EXPORT(Int, (procs, incUninstrumentable), | ||||
bool,getProcedures,(BPatch_Vector<BPatch_function*> &procs, bool incUni | BPatch_Vector<BPatch_parRegion *> * | |||
nstrumentable = false)); | getParRegions(bool incUninstrumentable = false); | |||
// BPatch_image::getParRegions | // BPatch_image::getModules | |||
// | // | |||
// Returns a list of all procedures in the image upon success, | // Returns a vector of all modules in this image | |||
// NULL upon failure | BPatch_Vector<BPatch_module *> * getModules(); | |||
API_EXPORT(Int, (incUninstrumentable), | ||||
// BPatch_image::getObjects | ||||
BPatch_Vector<BPatch_parRegion *> *, | // | |||
getParRegions,(bool incUninstrumentable = false)); | // Returns a vector of all objects in this image | |||
void getObjects(std::vector<BPatch_object *> &objs); | ||||
// BPatch_image::getModules | ||||
// | bool getModules(BPatch_Vector<BPatch_module*> &mods); | |||
// Returns a vector of all modules in this image | ||||
API_EXPORT(Int, (), | // BPatch_image::findModule | |||
BPatch_Vector<BPatch_module *> *,getModules,()); | // | |||
// Returns a module matching <name> if present in image, NULL if not fou | ||||
// BPatch_image::getObjects | nd | |||
// | // if <substring_match> is set, the first module that has <name> as a su | |||
// Returns a vector of all objects in this image | bstring | |||
API_EXPORT_V(Int, (objs), | // of its name is returned (eg, to find "libpthread.so.1", search for "l | |||
void, getObjects, (std::vector<BPatch_object *> &objs)); | ibpthread" | |||
// with substring_match set to true) | ||||
API_EXPORT(Int, (mods), | ||||
bool,getModules,(BPatch_Vector<BPatch_module*> &mods)); | BPatch_module * findModule(const char *name, bool substring_match = false | |||
); | ||||
// BPatch_image::findModule | ||||
// | // BPatch_image::getGlobalVariables | |||
// Returns a module matching <name> if present in image, NULL if not f | // | |||
ound | // Returns the global variables defined in this image | |||
// if <substring_match> is set, the first module that has <name> as a | ||||
substring | BPatch_Vector<BPatch_variableExpr *> * getGlobalVariables(); | |||
// of its name is returned (eg, to find "libpthread.so.1", search for | ||||
"libpthread" | // BPatch_image::findFunction | |||
// with substring_match set to true) | // | |||
API_EXPORT(Int, (name, substring_match), | // Returns a vector of functions matching <name>, if <name> is a regular | |||
// expression, a (slower) regex search will be performed. | ||||
BPatch_module *,findModule,(const char *name, bool substring_match = fa | // Returns NULL on failure. | |||
lse)); | ||||
BPatch_Vector<BPatch_function*> * findFunction(const char *name, | ||||
// BPatch_image::getGlobalVariables | BPatch_Vector<BPatch_functi | |||
// | on*> &funcs, | |||
// Returns the global variables defined in this image | bool showError=true, | |||
API_EXPORT(Int, (), | bool regex_case_sensitive=t | |||
rue, | ||||
BPatch_Vector<BPatch_variableExpr *> *,getGlobalVariables,()); | bool incUninstrumentable = | |||
false); | ||||
// BPatch_image::findFunction | ||||
// | // BPatch_image::findFunction | |||
// Returns a vector of functions matching <name>, if <name> is a regul | // | |||
ar | // Returns a vector of functions matching criterion specified by user de | |||
// expression, a (slower) regex search will be performed. | fined | |||
// Returns NULL on failure. | // callback function bpsieve. | |||
API_EXPORT(Int, (name, funcs, showError, regex_case_sensitive, incUnins | ||||
trumentable), | BPatch_Vector<BPatch_function *> * | |||
findFunction(BPatch_Vector<BPatch_function *> &funcs, | ||||
BPatch_Vector<BPatch_function*> *,findFunction,(const char *name, | BPatchFunctionNameSieve bpsieve, | |||
BPatch_Vector<BPatch_fu | void *user_data=NULL, | |||
nction*> &funcs, | int showError=0, | |||
bool showError=true, | bool incUninstrumentable = false); | |||
bool regex_case_sensiti | ||||
ve=true, | // BPatch_image::findFunction(Address) | |||
bool incUninstrumentabl | // | |||
e = false)); | // Returns a function at a specified address | |||
BPatch_function * findFunction(unsigned long addr); | ||||
// BPatch_image::findFunction | ||||
// | bool findFunction(Dyninst::Address addr, | |||
// Returns a vector of functions matching criterion specified by user | BPatch_Vector<BPatch_function *> &funcs); | |||
defined | ||||
// callback function bpsieve. | // BPatch_image::findVariable | |||
API_EXPORT(WithSieve, (funcs, bpsieve, user_data, showError, incUninstr | // | |||
umentable), | // Returns global variable matching <name> in the image. NULL if not fo | |||
und. | ||||
BPatch_Vector<BPatch_function *> *, | ||||
findFunction,(BPatch_Vector<BPatch_function *> &funcs, | BPatch_variableExpr * findVariable(const char *name, bool showError=true) | |||
BPatchFunctionNameSieve bpsieve, | ; | |||
void *user_data=NULL, | ||||
int showError=0, | // BPatch_image::findVariable | |||
bool incUninstrumentable = false)); | // | |||
// Returns local variable matching name <nm> in function scope of | ||||
// BPatch_image::findFunction(Address) | // provided BPatch_point. | |||
// | ||||
// Returns a function at a specified address | BPatch_variableExpr * findVariable(BPatch_point &scp, const char *nm, boo | |||
API_EXPORT(Int, (addr), | l showError=true); | |||
BPatch_function *, findFunction,(unsigned long addr)); | ||||
// BPatch_image::findType | ||||
API_EXPORT(Int, (addr, funcs), | // | |||
bool, findFunction,(Dyninst::Address addr, | // Returns a BPatch_type corresponding to <name>, if exists, NULL if not | |||
BPatch_Vector<BPatch_function *> &funcs) | found | |||
); | ||||
BPatch_type * findType(const char *name); | ||||
// BPatch_image::findVariable | ||||
// | // BPatch_image::findPoints | |||
// Returns global variable matching <name> in the image. NULL if not | // | |||
found. | // Returns a vector of BPatch_points that correspond with the provided a | |||
API_EXPORT(Int, (name, showError), | ddress, one | |||
// per function that includes an instruction at that address. Will have | ||||
BPatch_variableExpr *,findVariable,(const char *name, bool showError=tr | one element | |||
ue)); | // if there is not overlapping code. | |||
bool findPoints(Dyninst::Address addr, std::vector<BPatch_point *> &poin | ||||
// BPatch_image::findVariable | ts); | |||
// | ||||
// Returns local variable matching name <nm> in function scope of | // BPatch_image::getAddressRanges | |||
// provided BPatch_point. | // | |||
API_EXPORT(InScope, (scp, nm, showError), | // method to retrieve addresses corresponding to a line in a file | |||
BPatch_variableExpr *,findVariable,(BPatch_point &scp, const | bool getAddressRanges( const char * fileName, unsigned int lineNo, | |||
char *nm, bool showError=true)); | std::vector<std::pair<unsigned long, unsigned long> | |||
> & ranges ); | ||||
// BPatch_image::findType | ||||
// | bool getSourceLines( unsigned long addr, BPatch_Vector<BPatch_statement> | |||
// Returns a BPatch_type corresponding to <name>, if exists, NULL if n | & lines ); | |||
ot found | ||||
API_EXPORT(Int, (name), | // BPatch_image::getProgramName | |||
// | ||||
BPatch_type *,findType,(const char *name)); | // fills provided buffer <name> with the program's name, up to <len> cha | |||
rs | ||||
// BPatch_image::findPoints | ||||
// | char * getProgramName(char *name, unsigned int len); | |||
// Returns a vector of BPatch_points that correspond with the provided | ||||
address, one | // BPatch_image::getProgramFileName | |||
// per function that includes an instruction at that address. Will hav | // | |||
e one element | // fills provided buffer <name> with the program's file name, | |||
// if there is not overlapping code. | // which may include path information. | |||
API_EXPORT(Int, (addr, points), | ||||
bool, findPoints, (Dyninst::Address addr, std::vector<BPatch_point *> & | char * getProgramFileName(char *name, unsigned int len); | |||
points)); | ||||
/* BPatch_image::parseNewFunctions | ||||
// BPatch_image::getAddressRanges | * | |||
// | * This function uses function entry addresses to find and parse | |||
// method to retrieve addresses corresponding to a line in a file | * new functions using our control-flow traversal parsing. | |||
API_EXPORT(Int, (fileName, lineNo, ranges), | * | |||
* funcEntryAddrs: this is a vector of function start addresses | ||||
bool,getAddressRanges,( const char * fileName, unsigned int lineNo, | * that seed the control-flow-traversal parsing. If they lie in | |||
std::vector<std::pair<unsigned long, unsigned l | * an existing module they are parsed in that module, otherwise a | |||
ong> > & ranges )); | * new module is created. In both cases the modules are added to | |||
* affectedModules | ||||
API_EXPORT(Int, (addr, lines), | * | |||
bool,getSourceLines,( unsigned long addr, BPatch_Vector<BPatch_statemen | * affectedModules: BPatch_modules will be added to this vector if no | |||
t> & lines )); | * existing modules bounded the specified function entry points. | |||
* Unfortunately, new modules will also sometimes have to be created | ||||
// BPatch_image::getProgramName | * for dynamically created code in memory that does not map to the | |||
// | * file version of the binary. | |||
// fills provided buffer <name> with the program's name, up to <len> c | * | |||
hars | * Return value: This value is true if a new module was created or if | |||
API_EXPORT(Int, (name, len), | * new code was parsed in an existing module | |||
*/ | ||||
char *,getProgramName,(char *name, unsigned int len)); | bool parseNewFunctions(BPatch_Vector<BPatch_module*> &affectedModules, | |||
const BPatch_Vector<Dyninst::Address> &funcEntryAdd | ||||
// BPatch_image::getProgramFileName | rs); | |||
// | ||||
// fills provided buffer <name> with the program's file name, | // | |||
// which may include path information. | // Reads a string from the target process | |||
API_EXPORT(Int, (name, len), | bool readString(Dyninst::Address addr, std::string &str, | |||
unsigned size_limit = 0); | ||||
char *,getProgramFileName,(char *name, unsigned int len)); | ||||
/* BPatch_image::parseNewFunctions | ||||
* | ||||
* This function uses function entry addresses to find and parse | ||||
* new functions using our control-flow traversal parsing. | ||||
* | ||||
* funcEntryAddrs: this is a vector of function start addresses | ||||
* that seed the control-flow-traversal parsing. If they lie in | ||||
* an existing module they are parsed in that module, otherwise a | ||||
* new module is created. In both cases the modules are added to | ||||
* affectedModules | ||||
* | ||||
* affectedModules: BPatch_modules will be added to this vector if no | ||||
* existing modules bounded the specified function entry points. | ||||
* Unfortunately, new modules will also sometimes have to be created | ||||
* for dynamically created code in memory that does not map to the | ||||
* file version of the binary. | ||||
* | ||||
* Return value: This value is true if a new module was created or if | ||||
* new code was parsed in an existing module | ||||
*/ | ||||
API_EXPORT(Int, (affectedModules, funcEntryAddrs), | ||||
bool ,parseNewFunctions, | ||||
(BPatch_Vector<BPatch_module*> &affectedModules, | ||||
const BPatch_Vector<Dyninst::Address> &funcEntryAddrs)); | ||||
// | ||||
// Reads a string from the target process | ||||
API_EXPORT(Int, (addr, str, size_limit), | ||||
bool, readString,(Dyninst::Address addr, std::string &str, | ||||
unsigned size_limit = 0)); | ||||
API_EXPORT(Int, (expr, str, size_limit), | ||||
bool, readString,(BPatch_variableExpr *expr, std::string &st | ||||
r, | ||||
unsigned size_limit = 0)); | ||||
#ifdef IBM_BPATCH_COMPAT | bool readString(BPatch_variableExpr *expr, std::string &str, | |||
API_EXPORT(Ptr, (name, funcs, showError, regex_case_sensitive, incUnins | unsigned size_limit = 0); | |||
trumentable), | ||||
BPatch_Vector<BPatch_function*> *, | #ifdef IBM_BPATCH_COMPAT | |||
findFunction,(const char *name, | ||||
BPatch_Vector<BPatch_function*> *funcs, | ||||
bool showError=true, | ||||
bool regex_case_sensitive=true, | ||||
bool incUninstrumentable = false)); | ||||
API_EXPORT(Int, (name, len), | BPatch_Vector<BPatch_function*> * | |||
findFunction(const char *name, | ||||
BPatch_Vector<BPatch_function*> *funcs, | ||||
bool showError=true, | ||||
bool regex_case_sensitive=true, | ||||
bool incUninstrumentable = false); | ||||
char *,programName,(char *name, unsigned int len)); | char * programName(char *name, unsigned int len); | |||
API_EXPORT(Int, (), | int lpType(); | |||
int,lpType,()); | ||||
#endif | #endif | |||
private: | private: | |||
BPatch_addressSpace *addSpace; | BPatch_addressSpace *addSpace; | |||
BPatch_module *defaultModule; | BPatch_module *defaultModule; | |||
BPatch_module *findOrCreateModule(mapped_module *base); | BPatch_module *findOrCreateModule(mapped_module *base); | |||
BPatch_object *findOrCreateObject(mapped_object *base); | BPatch_object *findOrCreateObject(mapped_object *base); | |||
void removeModule(BPatch_module *mod); | void removeModule(BPatch_module *mod); | |||
void removeAllModules(); | void removeAllModules(); | |||
#if defined(_MSC_VER) | #if defined(_MSC_VER) | |||
#pragma warning(push) | #pragma warning(push) | |||
#pragma warning(disable:4251) | #pragma warning(disable:4251) | |||
#endif | #endif | |||
typedef std::map<mapped_module *, BPatch_module *> ModMap; | typedef std::map<mapped_module *, BPatch_module *> ModMap; | |||
typedef std::map<mapped_object *, BPatch_object *> ObjMap; | typedef std::map<mapped_object *, BPatch_object *> ObjMap; | |||
ModMap modmap; | ModMap modmap; | |||
ObjMap objmap; | ObjMap objmap; | |||
// Annoying backwards-compatible return type | // Annoying backwards-compatible return type | |||
std::vector<BPatch_module *> modlist; | std::vector<BPatch_module *> modlist; | |||
BPatch_Vector<BPatch_module *> removed_list; | BPatch_Vector<BPatch_module *> removed_list; | |||
BPatch_Vector<BPatch_point *> unresolvedCF; | BPatch_Vector<BPatch_point *> unresolvedCF; | |||
#if defined(_MSC_VER) | #if defined(_MSC_VER) | |||
#pragma warning(pop) | #pragma warning(pop) | |||
#endif | #endif | |||
// These private "find" functions convert from internal func_instance | // These private "find" functions convert from internal func_instance | |||
// representation to the exported BPatch_Function type | // representation to the exported BPatch_Function type | |||
void findFunctionInImage(const char *name, image *img, | void findFunctionInImage(const char *name, image *img, | |||
BPatch_Vector<BPatch_function*> *funcs, | BPatch_Vector<BPatch_function*> *funcs, | |||
bool incUninstrumentable = false); | ||||
void sieveFunctionsInImage(image *img, | ||||
BPatch_Vector<BPatch_function *> *funcs, | ||||
BPatchFunctionNameSieve bpsieve, | ||||
void *user_data, | ||||
bool incUninstrumentable = false); | bool incUninstrumentable = false); | |||
void sieveFunctionsInImage(image *img, | ||||
BPatch_Vector<BPatch_function *> *funcs, | ||||
BPatchFunctionNameSieve bpsieve, | ||||
void *user_data, | ||||
bool incUninstrumentable = false); | ||||
static bool setFuncModulesCallback(BPatch_function *bpf, void *data); | static bool setFuncModulesCallback(BPatch_function *bpf, void *data); | |||
}; | }; | |||
#endif /* _BPatch_image_h_ */ | #endif /* _BPatch_image_h_ */ | |||
End of changes. 20 change blocks. | ||||
320 lines changed or deleted | 276 lines changed or added | |||
BPatch_instruction.h | BPatch_instruction.h | |||
---|---|---|---|---|
skipping to change at line 35 | skipping to change at line 35 | |||
* | * | |||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | */ | |||
#ifndef _BPatch_instruction_h_ | #ifndef _BPatch_instruction_h_ | |||
#define _BPatch_instruction_h_ | #define _BPatch_instruction_h_ | |||
#include "BPatch_dll.h" | #include "BPatch_dll.h" | |||
#include "BPatch_eventLock.h" | ||||
#include <string> | #include <string> | |||
class InstrucIter; | class InstrucIter; | |||
class BPatch_basicBlock; | class BPatch_basicBlock; | |||
class BPatch_point; | class BPatch_point; | |||
class internal_instruction; | class internal_instruction; | |||
#ifdef DYNINST_CLASS_NAME | #ifdef DYNINST_CLASS_NAME | |||
#undef DYNINST_CLASS_NAME | #undef DYNINST_CLASS_NAME | |||
#endif | #endif | |||
#define DYNINST_CLASS_NAME BPatch_instruction | #define DYNINST_CLASS_NAME BPatch_instruction | |||
class BPATCH_DLL_EXPORT BPatch_instruction : public BPatch_eventLock{ | class BPATCH_DLL_EXPORT BPatch_instruction { | |||
friend class BPatch_basicBlock; | friend class BPatch_basicBlock; | |||
public: | public: | |||
// maximum number of memory accesses per instruction; platform dependent | // maximum number of memory accesses per instruction; platform dependent | |||
static const unsigned int nmaxacc_NP; | static const unsigned int nmaxacc_NP; | |||
protected: | protected: | |||
unsigned int nacc; | unsigned int nacc; | |||
internal_instruction *insn_; | internal_instruction *insn_; | |||
skipping to change at line 83 | skipping to change at line 82 | |||
long unsigned int _addr); | long unsigned int _addr); | |||
virtual ~BPatch_instruction(); | virtual ~BPatch_instruction(); | |||
void getInstruction(const unsigned char *&_buffer, unsigned char &_length ); | void getInstruction(const unsigned char *&_buffer, unsigned char &_length ); | |||
internal_instruction *insn(); | internal_instruction *insn(); | |||
// Not yet implemented | // Not yet implemented | |||
char *getMnemonic() const { return NULL; } | char *getMnemonic() const { return NULL; } | |||
API_EXPORT(Int, (), | BPatch_point * getInstPoint(); | |||
BPatch_point *,getInstPoint,()); | ||||
API_EXPORT(Int, (), | BPatch_basicBlock * getParent(); | |||
BPatch_basicBlock *,getParent,()); | void * getAddress(); | |||
API_EXPORT(Int, (), | ||||
void *,getAddress,()); | ||||
public: | public: | |||
bool equals(const BPatch_instruction* mp) const { return mp ? equals(*mp) : false; } | bool equals(const BPatch_instruction* mp) const { return mp ? equals(*mp) : false; } | |||
bool equals(const BPatch_instruction& rp) const | bool equals(const BPatch_instruction& rp) const | |||
{ | { | |||
bool res; | bool res; | |||
res = | res = | |||
(isLoad == rp.isLoad) && | (isLoad == rp.isLoad) && | |||
skipping to change at line 141 | skipping to change at line 137 | |||
~BPatch_branchInstruction() {}; | ~BPatch_branchInstruction() {}; | |||
void *getTarget() { return target_; } | void *getTarget() { return target_; } | |||
protected: | protected: | |||
void *target_; | void *target_; | |||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_register | ||||
class BPatch_registerExpr; | class BPatch_registerExpr; | |||
class BPatch_addressSpace; | class BPatch_addressSpace; | |||
class BPatch_point; | class BPatch_point; | |||
class BPATCH_DLL_EXPORT BPatch_register : public BPatch_eventLock { | class BPATCH_DLL_EXPORT BPatch_register { | |||
friend class BPatch_registerExpr; | friend class BPatch_registerExpr; | |||
friend class BPatch_addressSpace; | friend class BPatch_addressSpace; | |||
friend class BPatch_point; | friend class BPatch_point; | |||
public: | public: | |||
API_EXPORT(Int, (), std::string, name, ()); | std::string name() const; | |||
private: | private: | |||
BPatch_register(std::string n, | BPatch_register(std::string n, | |||
int e) : | int e) : | |||
name_(n), | name_(n), | |||
number_(e) {}; | number_(e) {}; | |||
std::string name_; | std::string name_; | |||
int number_; | int number_; | |||
}; | }; | |||
End of changes. 7 change blocks. | ||||
15 lines changed or deleted | 6 lines changed or added | |||
BPatch_loopTreeNode.h | BPatch_loopTreeNode.h | |||
---|---|---|---|---|
skipping to change at line 36 | skipping to change at line 36 | |||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | */ | |||
#ifndef _BPatch_loopTreeNode_h_ | #ifndef _BPatch_loopTreeNode_h_ | |||
#define _BPatch_loopTreeNode_h_ | #define _BPatch_loopTreeNode_h_ | |||
#include "BPatch_dll.h" | #include "BPatch_dll.h" | |||
#include "BPatch_Vector.h" | #include "BPatch_Vector.h" | |||
#include "BPatch_eventLock.h" | ||||
#include "BPatch_function.h" | #include "BPatch_function.h" | |||
class BPatch_basicBlockLoop; | class BPatch_basicBlockLoop; | |||
class func_instance; | class func_instance; | |||
/** A class to represent the tree of nested loops and | /** A class to represent the tree of nested loops and | |||
* callees (functions) in the control flow graph. | * callees (functions) in the control flow graph. | |||
* @see BPatch_basicBlockLoop | * @see BPatch_basicBlockLoop | |||
* @see BPatch_flowGraph | * @see BPatch_flowGraph | |||
*/ | */ | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_loopTreeNode | ||||
class BPATCH_DLL_EXPORT BPatch_loopTreeNode : public BPatch_eventLock { | class BPATCH_DLL_EXPORT BPatch_loopTreeNode { | |||
friend class BPatch_flowGraph; | friend class BPatch_flowGraph; | |||
public: | public: | |||
// A loop node contains a single BPatch_basicBlockLoop instance | // A loop node contains a single BPatch_basicBlockLoop instance | |||
BPatch_basicBlockLoop *loop; | BPatch_basicBlockLoop *loop; | |||
// The BPatch_loopTreeNode instances nested within this loop. | // The BPatch_loopTreeNode instances nested within this loop. | |||
BPatch_Vector<BPatch_loopTreeNode *> children; | BPatch_Vector<BPatch_loopTreeNode *> children; | |||
// BPatch_loopTreeNode::BPatch_loopTreeNode | // BPatch_loopTreeNode::BPatch_loopTreeNode | |||
// Create a loop tree node for BPatch_basicBlockLoop with name n | // Create a loop tree node for BPatch_basicBlockLoop with name n | |||
API_EXPORT_CTOR(Ctor, (l,n), | BPatch_loopTreeNode(BPatch_basicBlockLoop *l, const char *n); | |||
BPatch_loopTreeNode,(BPatch_basicBlockLoop *l, const char *n)); | ||||
// BPatch_loopTreeNode::~BPatch_loopTreeNode | // BPatch_loopTreeNode::~BPatch_loopTreeNode | |||
// Destructor | // Destructor | |||
API_EXPORT_DTOR(_dtor, (), | ~BPatch_loopTreeNode(); | |||
~,BPatch_loopTreeNode,()); | ||||
// BPatch_loopTreeNode::name | // BPatch_loopTreeNode::name | |||
// Return the name of this loop. | // Return the name of this loop. | |||
API_EXPORT(Int, (), | const char * name(); | |||
const char *,name,()); | ||||
// BPatch_loopTreeNode::getCalleeName | // BPatch_loopTreeNode::getCalleeName | |||
// Return the function name of the ith callee. | // Return the function name of the ith callee. | |||
API_EXPORT(Int, (i), | const char * getCalleeName(unsigned int i); | |||
const char *,getCalleeName,(unsigned int i)); | ||||
// BPatch_loopTreeNode::numCallees | // BPatch_loopTreeNode::numCallees | |||
// Return the number of callees contained in this loop's body. | // Return the number of callees contained in this loop's body. | |||
API_EXPORT(Int, (), | unsigned int numCallees(); | |||
unsigned int,numCallees,()); | ||||
//Returns a vector of the functions called by this loop. | //Returns a vector of the functions called by this loop. | |||
API_EXPORT(Int, (v, p), | bool getCallees(BPatch_Vector<BPatch_function *> &v, BPatch_addressSpac | |||
bool, getCallees, (BPatch_Vector<BPatch_function *> &v, BPatch_addressS | e *p); | |||
pace *p)) | ||||
// BPatch_loopTreeNode::findLoop | // BPatch_loopTreeNode::findLoop | |||
// find loop by hierarchical name | // find loop by hierarchical name | |||
API_EXPORT(Int, (name), | BPatch_basicBlockLoop * findLoop(const char *name); | |||
BPatch_basicBlockLoop *,findLoop,(const char *name)); | ||||
private: | private: | |||
/** name which indicates this loop's relative nesting */ | /** name which indicates this loop's relative nesting */ | |||
char *hierarchicalName; | char *hierarchicalName; | |||
// A vector of functions called within the body of this loop (and | // A vector of functions called within the body of this loop (and | |||
// not the body of sub loops). | // not the body of sub loops). | |||
BPatch_Vector<func_instance *> callees; | BPatch_Vector<func_instance *> callees; | |||
End of changes. 10 change blocks. | ||||
27 lines changed or deleted | 9 lines changed or added | |||
BPatch_module.h | BPatch_module.h | |||
---|---|---|---|---|
skipping to change at line 36 | skipping to change at line 36 | |||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | */ | |||
#ifndef _BPatch_module_h_ | #ifndef _BPatch_module_h_ | |||
#define _BPatch_module_h_ | #define _BPatch_module_h_ | |||
#include "BPatch_dll.h" | #include "BPatch_dll.h" | |||
#include "BPatch_Vector.h" | #include "BPatch_Vector.h" | |||
#include "BPatch_sourceObj.h" | #include "BPatch_sourceObj.h" | |||
#include "BPatch_eventLock.h" | ||||
#include "BPatch_enums.h" | #include "BPatch_enums.h" | |||
#include "dyntypes.h" | #include "dyntypes.h" | |||
#include <vector> | #include <vector> | |||
#include <map> | #include <map> | |||
#if defined(IBM_BPATCH_COMPAT) | #if defined(IBM_BPATCH_COMPAT) | |||
#include <string> | #include <string> | |||
#endif | #endif | |||
class mapped_module; | class mapped_module; | |||
skipping to change at line 66 | skipping to change at line 65 | |||
class instPoint; | class instPoint; | |||
class AddressSpace; | class AddressSpace; | |||
class BPatch_snippet; | class BPatch_snippet; | |||
class BPatchSnippetHandle; | class BPatchSnippetHandle; | |||
class BPatch_module; | class BPatch_module; | |||
class BPatch_object; | class BPatch_object; | |||
namespace Dyninst { | namespace Dyninst { | |||
namespace SymtabAPI { | namespace SymtabAPI { | |||
class Module; | class Module; | |||
SYMTAB_EXPORT Module *convert(const BPatch_module *); | BPATCH_DLL_EXPORT Module *convert(const BPatch_module *); | |||
} | } | |||
namespace PatchAPI { | namespace PatchAPI { | |||
class PatchFunction; | class PatchFunction; | |||
class Point; | class Point; | |||
} | } | |||
} | } | |||
extern BPatch_builtInTypeCollection * builtInTypes; | extern BPatch_builtInTypeCollection * builtInTypes; | |||
#ifdef DYNINST_CLASS_NAME | class BPATCH_DLL_EXPORT BPatch_module: public BPatch_sourceObj{ | |||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_module | ||||
class BPATCH_DLL_EXPORT BPatch_module: public BPatch_sourceObj, public BPat | ||||
ch_eventLock{ | ||||
friend class BPatch_function; | friend class BPatch_function; | |||
friend class BPatch_flowGraph; | friend class BPatch_flowGraph; | |||
friend class BPatch_image; | friend class BPatch_image; | |||
friend class InstrucIter; | friend class InstrucIter; | |||
friend class BPatch_thread; | friend class BPatch_thread; | |||
friend class BPatch_process; | friend class BPatch_process; | |||
friend class BPatch_binaryEdit; | friend class BPatch_binaryEdit; | |||
friend class BPatch_addressSpace; | friend class BPatch_addressSpace; | |||
friend class BPatch_statement; | friend class BPatch_statement; | |||
skipping to change at line 132 | skipping to change at line 126 | |||
void handleUnload(); | void handleUnload(); | |||
bool isExploratoryModeOn();// true if exploratory or defensive mode is on | bool isExploratoryModeOn();// true if exploratory or defensive mode is on | |||
bool setAnalyzedCodeWriteable(bool writeable);//sets write perm's analy zed code pages | bool setAnalyzedCodeWriteable(bool writeable);//sets write perm's analy zed code pages | |||
bool isSystemLib(); | bool isSystemLib(); | |||
bool remove(BPatch_function*); | bool remove(BPatch_function*); | |||
bool remove(instPoint*); | bool remove(instPoint*); | |||
// End functions for internal use only | // End functions for internal use only | |||
// BPatch_module::getName | // BPatch_module::getName | |||
// Returns file name associated with module | // Returns file name associated with module | |||
API_EXPORT(Int, (buffer, length), | ||||
char *,getName,(char *buffer, int length)); | char * getName(char *buffer, int length); | |||
// BPatch_module::getFullName | // BPatch_module::getFullName | |||
// Returns full path name of module, when available | // Returns full path name of module, when available | |||
API_EXPORT(Int, (buffer, length), | ||||
char *,getFullName,(char *buffer, int length)); | char * getFullName(char *buffer, int length); | |||
// BPatch_module::libraryName | // BPatch_module::libraryName | |||
// Returns name if library, if this module is a shared object | // Returns name if library, if this module is a shared object | |||
API_EXPORT(Int, (), | ||||
const char *,libraryName,()); | const char * libraryName(); | |||
// BPatch_module::getObject | // BPatch_module::getObject | |||
// Returns BPatch_object containing this file | // Returns BPatch_object containing this file | |||
API_EXPORT(Int, (), | BPatch_object * getObject(); | |||
BPatch_object *, getObject, ()); | ||||
// BPatch_module::getAddressWidth | // BPatch_module::getAddressWidth | |||
// Returns the width (in bytes) of an address in this module | // Returns the width (in bytes) of an address in this module | |||
API_EXPORT(Int, (), | ||||
size_t,getAddressWidth,()); | size_t getAddressWidth(); | |||
// BPatch_module::getVariables | // BPatch_module::getVariables | |||
// Fills a vector with the global variables that are specified in this module | // Fills a vector with the global variables that are specified in this module | |||
API_EXPORT(Int, (vars), | ||||
bool,getVariables,(BPatch_Vector<BPatch_variableExpr *> &vars)); | bool getVariables(BPatch_Vector<BPatch_variableExpr *> &vars); | |||
// BPatch_module::findVariable | // BPatch_module::findVariable | |||
// Find and return a global variable (NULL if not found) | // Find and return a global variable (NULL if not found) | |||
API_EXPORT(Int, (name), | ||||
BPatch_variableExpr*,findVariable,(const char* name)); | BPatch_variableExpr* findVariable(const char* name); | |||
// BPatch_module::getProcedures | // BPatch_module::getProcedures | |||
// Returns a vector of all functions in this module | // Returns a vector of all functions in this module | |||
API_EXPORT(Int, (incUninstrumentable), | BPatch_Vector<BPatch_function *> * getProcedures(bool incUninstrumentab | |||
BPatch_Vector<BPatch_function *> *,getProcedures,(bool incUninstrumenta | le = false); | |||
ble = false)); | ||||
API_EXPORT(Int, (procs, incUninstrumentable), | bool getProcedures(BPatch_Vector<BPatch_function*> &procs, | |||
bool, getProcedures,(BPatch_Vector<BPatch_function*> &procs, | bool incUninstrumentable = false); | |||
bool incUninstrumentable = false)); | ||||
// BPatch_module::findFunction | // BPatch_module::findFunction | |||
// Returns a vector of BPatch_function *, matching specified <name> | // Returns a vector of BPatch_function * matching specified <name> | |||
API_EXPORT(Int, (name, funcs, notify_on_failure,regex_case_sensitive,in | ||||
cUninstrumentable,dont_use_regex), | ||||
BPatch_Vector<BPatch_function *> *,findFunction,(const char *name, | BPatch_Vector<BPatch_function *> * findFunction(const char *name, | |||
BPatch_Vector<BPatch_function *> &funcs, | BPatch_Vector<BPatch_function *> &funcs, | |||
bool notify_on_failure =true, | bool notify_on_failure =true, | |||
bool regex_case_sensitive =true, | bool regex_case_sensitive =true, | |||
bool incUninstrumentable =false, | bool incUninstrumentable =false, | |||
bool dont_use_regex = false)); | bool dont_use_regex = false); | |||
// BPatch_addressSpace::findFunctionByEntry | // BPatch_addressSpace::findFunctionByEntry | |||
// Returns the function starting at the given address | // Returns the function starting at the given address | |||
API_EXPORT(Int, (entry), | BPatch_function * findFunctionByEntry(Dyninst::Address entry); | |||
BPatch_function *,findFunctionByEntry,(Dyninst::Address entry)); | ||||
// FIXME: This method is (undocumented) | // FIXME: This method is (undocumented) | |||
API_EXPORT(Int, (addr, funcs, notify_on_failure, incUninstrumentable), | ||||
BPatch_Vector<BPatch_function *> *, | BPatch_Vector<BPatch_function *> * | |||
findFunctionByAddress,(void *addr, | findFunctionByAddress(void *addr, | |||
BPatch_Vector<BPatch_function *> &funcs, | BPatch_Vector<BPatch_function *> &funcs, | |||
bool notify_on_failure = true, | bool notify_on_failure = true, | |||
bool incUninstrumentable = false)); | bool incUninstrumentable = false); | |||
// get the module types member (instead of directly accessing) | // get the module types member (instead of directly accessing) | |||
API_EXPORT(Int, (), BPatch_typeCollection *, getModuleTypes, ()); | BPatch_typeCollection *getModuleTypes(); | |||
// BPatch_module::findFunctionByMangled | // BPatch_module::findFunctionByMangled | |||
// Returns a function, if it exits, that matches the provided mangled n ame | // Returns a function, if it exits, that matches the provided mangled n ame | |||
API_EXPORT(Int, (mangled_name, incUninstrumentable), | ||||
BPatch_function *,findFunctionByMangled,(const char * mangled_name, | BPatch_function * findFunctionByMangled(const char * mangled_name, | |||
bool incUninstrumentable=false | bool incUninstrumentable=false | |||
)); | ); | |||
// BPatch_module::findPoints | // BPatch_module::findPoints | |||
// | // | |||
// Returns a vector of BPatch_points that correspond with the provided address, one | // Returns a vector of BPatch_points that correspond with the provided address, one | |||
// per function that includes an instruction at that address. Will hav e one element | // per function that includes an instruction at that address. Will hav e one element | |||
// if there is not overlapping code. | // if there is not overlapping code. | |||
API_EXPORT(Int, (addr, points), | bool findPoints(Dyninst::Address addr, std::vector<BPatch_point *> &po | |||
bool, findPoints, (Dyninst::Address addr, std::vector<BPatch_point *> & | ints); | |||
points)); | ||||
// BPatch_module::dumpMangled | // BPatch_module::dumpMangled | |||
// Prints all <mangled> function names in this module | // Prints all <mangled> function names in this module | |||
API_EXPORT(Int, (prefix), | ||||
bool,dumpMangled,(char *prefix)); | bool dumpMangled(char *prefix); | |||
// BPatch_module::isSharedLib | // BPatch_module::isSharedLib | |||
// Returns true if this module represents a shared library | // Returns true if this module represents a shared library | |||
API_EXPORT(Int, (), | ||||
bool,isSharedLib,()); | bool isSharedLib(); | |||
// BPatch_module::isNativeCompiler | // BPatch_module::isNativeCompiler | |||
// Returns true if this module was compiled with a native compiler for | // Returns true if this module was compiled with a native compiler for | |||
// the particular platform | // the particular platform | |||
API_EXPORT(Int, (), | ||||
bool,isNativeCompiler,()); | bool isNativeCompiler(); | |||
// BPatch_module::getAddressRanges | // BPatch_module::getAddressRanges | |||
// | // | |||
// function to get addresses for a line of the module | // function to get addresses for a line of the module | |||
// if fileName is NULL, uses the name of the module | // if fileName is NULL, uses the name of the module | |||
API_EXPORT(Int, (fileName, lineNo, ranges), | ||||
bool,getAddressRanges,( const char * fileName, unsigned int lineNo, std ::vector< std::pair< unsigned long, unsigned long > > & ranges )); | bool getAddressRanges( const char * fileName, unsigned int lineNo, std: :vector< std::pair< unsigned long, unsigned long > > & ranges ); | |||
// BPatch_module::getSourceLines | // BPatch_module::getSourceLines | |||
// | // | |||
// function to get source file names and lines | // function to get source file names and lines | |||
// for an address in the module | // for an address in the module | |||
API_EXPORT(Int, (addr, lines), | ||||
bool,getSourceLines,( unsigned long addr, BPatch_Vector<BPatch_statemen t> &lines)); | bool getSourceLines( unsigned long addr, BPatch_Vector<BPatch_statement > &lines); | |||
// BPatch_mode::getStatements | // BPatch_mode::getStatements | |||
// | // | |||
// Fill supplied vector with all BPatch_statements from this module | // Fill supplied vector with all BPatch_statements from this module | |||
API_EXPORT(Int, (statements), | ||||
bool,getStatements,(BPatch_Vector<BPatch_statement> &statements)); | bool getStatements(BPatch_Vector<BPatch_statement> &statements); | |||
// BPatch_module::wgetBaseAddr | // BPatch_module::wgetBaseAddr | |||
// Returns a base address of the module; defined as the start | // Returns a base address of the module; defined as the start | |||
// of the first function. | // of the first function. | |||
API_EXPORT(Int, (), | void * getBaseAddr(void); | |||
void *,getBaseAddr,(void)); | ||||
API_EXPORT(Int, (), | Dyninst::Address getLoadAddr(void); | |||
Dyninst::Address, getLoadAddr, (void)); | ||||
// BPatch_module::getSize | // BPatch_module::getSize | |||
// Returns the size of the module; defined as the end of the last | // Returns the size of the module; defined as the end of the last | |||
// function minus the start of the first function. | // function minus the start of the first function. | |||
API_EXPORT(Int, (), | unsigned long getSize(void); | |||
unsigned long, getSize, (void)); | ||||
API_EXPORT(Int, (), | bool isValid(); | |||
bool, isValid, ()); | ||||
// BPastch_module::getHybridMode | // BPastch_module::getHybridMode | |||
// returns the hybrid Analysis mode: normal, exploratory, defensive | // returns the hybrid Analysis mode: normal, exploratory, defensive | |||
API_EXPORT(Int, (), BPatch_hybridMode, getHybridMode,()); | BPatch_hybridMode getHybridMode(); | |||
API_EXPORT(Int, (callback), | BPatchSnippetHandle* insertInitCallback(BPatch_snippet& callback); | |||
BPatchSnippetHandle*, insertInitCallback, (BPatch_snippet& c | ||||
allback)); | ||||
API_EXPORT(Int, (callback), | BPatchSnippetHandle* insertFiniCallback(BPatch_snippet& callback); | |||
BPatchSnippetHandle*, insertFiniCallback, (BPatch_snippet& c | ||||
allback)); | ||||
#ifdef IBM_BPATCH_COMPAT | #ifdef IBM_BPATCH_COMPAT | |||
API_EXPORT(Int, (start, end), | bool getLineNumbers(unsigned int &start, unsigned int &end); | |||
bool,getLineNumbers,(unsigned int &start, unsigned int &end)); | ||||
API_EXPORT(Int, (start, end), | bool getAddressRange(void * &start, void * &end); | |||
bool,getAddressRange,(void * &start, void * &end)); | ||||
API_EXPORT(Int, (buffer, length), | char * getUniqueString(char *buffer, int length); | |||
char *,getUniqueString,(char *buffer, int length)); | ||||
char *sharedLibraryName(char *buffer, int length) { getFullName(buffer, length); return buffer;} | char *sharedLibraryName(char *buffer, int length) { getFullName(buffer, length); return buffer;} | |||
char *getSharedLibName(char *buffer, int length) { getFullName(buffer, length); return buffer;} | char *getSharedLibName(char *buffer, int length) { getFullName(buffer, length); return buffer;} | |||
API_EXPORT(Int, (), | int getSharedLibType(); | |||
int,getSharedLibType,()); | ||||
API_EXPORT(Int, (), | int getBindingType(); | |||
int,getBindingType,()); | ||||
struct Statement { | struct Statement { | |||
unsigned long begin; // Beginning address for this statement | unsigned long begin; // Beginning address for this statement | |||
unsigned long end; // Ending address for this statement | unsigned long end; // Ending address for this statement | |||
std::string path; // Path name of this statement's source file | std::string path; // Path name of this statement's source file | |||
int line; // Line number of the statement | int line; // Line number of the statement | |||
int column; // Column number of the statement | int column; // Column number of the statement | |||
} Statement; | } Statement; | |||
API_EXPORT(Int, (), | std::vector<struct BPatch_module::Statement> getStatements(); | |||
std::vector<struct BPatch_module::Statement>, getStatements, ()); | ||||
#endif | #endif | |||
private: | private: | |||
// Parse wrapper | // Parse wrapper | |||
bool parseTypesIfNecessary(); | bool parseTypesIfNecessary(); | |||
BPatch_typeCollection *moduleTypes; | BPatch_typeCollection *moduleTypes; | |||
// In particular, we understand the type information | // In particular, we understand the type information | |||
// in both DWARF and STABS format. | // in both DWARF and STABS format. | |||
void parseStabTypes(); | void parseStabTypes(); | |||
End of changes. 54 change blocks. | ||||
87 lines changed or deleted | 45 lines changed or added | |||
BPatch_object.h | BPatch_object.h | |||
---|---|---|---|---|
skipping to change at line 37 | skipping to change at line 37 | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | */ | |||
#ifndef _BPatch_object_h_ | #ifndef _BPatch_object_h_ | |||
#define _BPatch_object_h_ | #define _BPatch_object_h_ | |||
#include <vector> | #include <vector> | |||
#include <string> | #include <string> | |||
#include "dyntypes.h" | #include "dyntypes.h" | |||
#include "BPatch_eventLock.h" | #include "BPatch_dll.h" | |||
class mapped_object; | class mapped_object; | |||
class BPatch_addressSpace; | class BPatch_addressSpace; | |||
class AddressSpace; | class AddressSpace; | |||
class BPatch_image; | class BPatch_image; | |||
class BPatch_module; | class BPatch_module; | |||
class BPatch_object; | class BPatch_object; | |||
class BPatch_function; | class BPatch_function; | |||
class BPatch_point; | class BPatch_point; | |||
namespace Dyninst { | namespace Dyninst { | |||
namespace ParseAPI { | namespace ParseAPI { | |||
class CodeObject; | class CodeObject; | |||
CodeObject *convert(const BPatch_object *); | BPATCH_DLL_EXPORT CodeObject *convert(const BPatch_object *); | |||
} | } | |||
namespace PatchAPI { | namespace PatchAPI { | |||
class PatchObject; | class PatchObject; | |||
PatchObject *convert(const BPatch_object *); | BPATCH_DLL_EXPORT PatchObject *convert(const BPatch_object *); | |||
} | } | |||
namespace SymtabAPI { | namespace SymtabAPI { | |||
class Symtab; | class Symtab; | |||
Symtab *convert(const BPatch_object *); | BPATCH_DLL_EXPORT Symtab *convert(const BPatch_object *); | |||
} | } | |||
} | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_object | ||||
class BPATCH_DLL_EXPORT BPatch_object: public BPatch_eventLock { | class BPATCH_DLL_EXPORT BPatch_object { | |||
friend Dyninst::ParseAPI::CodeObject *Dyninst::ParseAPI::convert(const BPatch_object *); | friend Dyninst::ParseAPI::CodeObject *Dyninst::ParseAPI::convert(const BPatch_object *); | |||
friend Dyninst::PatchAPI::PatchObject *Dyninst::PatchAPI::convert(const BPatch_object *); | friend Dyninst::PatchAPI::PatchObject *Dyninst::PatchAPI::convert(const BPatch_object *); | |||
friend Dyninst::SymtabAPI::Symtab *Dyninst::SymtabAPI::convert(const BP atch_object *); | friend Dyninst::SymtabAPI::Symtab *Dyninst::SymtabAPI::convert(const BP atch_object *); | |||
friend class BPatch_image; | friend class BPatch_image; | |||
friend class BPatch_module; | friend class BPatch_module; | |||
BPatch_image *img; | BPatch_image *img; | |||
mapped_object *obj; | mapped_object *obj; | |||
std::vector<BPatch_module *> mods; | std::vector<BPatch_module *> mods; | |||
skipping to change at line 107 | skipping to change at line 102 | |||
std::string format(); | std::string format(); | |||
Region() : base(0), size(0), type(UNKNOWN) {}; | Region() : base(0), size(0), type(UNKNOWN) {}; | |||
Region(Dyninst::Address b, unsigned long s, type_t t) : base(b), size(s ), type(t) {}; | Region(Dyninst::Address b, unsigned long s, type_t t) : base(b), size(s ), type(t) {}; | |||
}; | }; | |||
static const Dyninst::Address E_OUT_OF_BOUNDS; | static const Dyninst::Address E_OUT_OF_BOUNDS; | |||
// BPatch_object::name | // BPatch_object::name | |||
// Returns the file name of the object | // Returns the file name of the object | |||
API_EXPORT(Int, (), | std::string name(); | |||
std::string, name, ()); | ||||
// BPatch_object::pathName | // BPatch_object::pathName | |||
// Returns the full pathname of the object | // Returns the full pathname of the object | |||
API_EXPORT(Int, (), | std::string pathName(); | |||
std::string, pathName, ()); | ||||
// BPatch_object::offsetToAddr | // BPatch_object::offsetToAddr | |||
// Converts a file offset into an absolute address suitable for use in looking up | // Converts a file offset into an absolute address suitable for use in looking up | |||
// functions or points. | // functions or points. | |||
// For dynamic instrumentation, this is an address in memory. | // For dynamic instrumentation, this is an address in memory. | |||
// For binary rewriting, this is an offset that can be treated as an ad dress. | // For binary rewriting, this is an offset that can be treated as an ad dress. | |||
// Returns E_OUT_OF_BOUNDS (-1) on failure | // Returns E_OUT_OF_BOUNDS (-1) on failure | |||
API_EXPORT(Int, (offset), | Dyninst::Address fileOffsetToAddr(const Dyninst::Offset offset); | |||
Dyninst::Address, fileOffsetToAddr, (const Dyninst::Offset o | ||||
ffset)); | ||||
// BPatch_object::regions | // BPatch_object::regions | |||
// Returns a vector of address ranges occupied by this object | // Returns a vector of address ranges occupied by this object | |||
// May be multiple if there are multiple disjoint ranges, such as | // May be multiple if there are multiple disjoint ranges, such as | |||
// separate code and data or multiple code regions | // separate code and data or multiple code regions | |||
// Ranges are returned as (base, size, type) tuples. | // Ranges are returned as (base, size, type) tuples. | |||
API_EXPORT_V(Int, (regions), | void regions(std::vector<Region> ®ions); | |||
void, regions, (std::vector<Region> ®ions)); | ||||
// BPatch_object::modules | // BPatch_object::modules | |||
// Returns a vector of BPatch_modules logically contained in this | // Returns a vector of BPatch_modules logically contained in this | |||
// object. | // object. | |||
// By design, shared libraries contain a single module; executable file s contain one or more. | // By design, shared libraries contain a single module; executable file s contain one or more. | |||
API_EXPORT_V(Int, (modules), | void modules(std::vector<BPatch_module *> &modules); | |||
void, modules, (std::vector<BPatch_module *> &modules)); | ||||
// BPatch_object::findFunction | // BPatch_object::findFunction | |||
// Returns a vector of functions matching the provided name | // Returns a vector of functions matching the provided name | |||
// Maps this operation over its contained modules | // Maps this operation over its contained modules | |||
// For backwards compatibility, returns a pointer to the vector argumen t. | // For backwards compatibility, returns a pointer to the vector argumen t. | |||
std::vector<BPatch_function *> * findFunction(std::string name, | ||||
API_EXPORT(Int, (name, funcs, notify_on_failure, regex_case_sensitive, | std::vector<BPatch_functio | |||
incUninstrumentable, dont_use_regex), | n *> &funcs, | |||
std::vector<BPatch_function *> *,findFunction,(std::string n | bool notify_on_failure =tr | |||
ame, | ue, | |||
std::vector<B | bool regex_case_sensitive | |||
Patch_function *> &funcs, | =true, | |||
bool notify_o | bool incUninstrumentable = | |||
n_failure =true, | false, | |||
bool regex_ca | bool dont_use_regex = fals | |||
se_sensitive =true, | e); | |||
bool incUnins | ||||
trumentable =false, | ||||
bool dont_use | ||||
_regex = false)); | ||||
// BPatch_object::findPoints | // BPatch_object::findPoints | |||
// | // | |||
// Returns a vector of BPatch_points that correspond with the provided address, one | // Returns a vector of BPatch_points that correspond with the provided address, one | |||
// per function that includes an instruction at that address. Will hav e one element | // per function that includes an instruction at that address. Will hav e one element | |||
// if there is not overlapping code. | // if there is not overlapping code. | |||
API_EXPORT(Int, (addr, points), | bool findPoints(Dyninst::Address addr, std::vector<BPatch_point *> &poi | |||
bool, findPoints, (Dyninst::Address addr, std::vector<BPatch_point *> & | nts); | |||
points)); | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 13 change blocks. | ||||
40 lines changed or deleted | 24 lines changed or added | |||
BPatch_parRegion.h | BPatch_parRegion.h | |||
---|---|---|---|---|
skipping to change at line 36 | skipping to change at line 36 | |||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | */ | |||
#ifndef _BPatch_parRegion_h_ | #ifndef _BPatch_parRegion_h_ | |||
#define _BPatch_parRegion_h_ | #define _BPatch_parRegion_h_ | |||
#include "BPatch_dll.h" | #include "BPatch_dll.h" | |||
#include "BPatch_Vector.h" | #include "BPatch_Vector.h" | |||
#include "BPatch_eventLock.h" | ||||
class int_parRegion; | class int_parRegion; | |||
class InstrucIter; | class InstrucIter; | |||
class BPatch_function; | class BPatch_function; | |||
class BPatch_instruction; | class BPatch_instruction; | |||
#include "Instruction.h" | #include "Instruction.h" | |||
typedef enum{ | typedef enum{ | |||
OMP_NONE, OMP_PARALLEL, OMP_DO_FOR,OMP_DO_FOR_LOOP_BODY, OMP_SECTIONS, OM P_SINGLE, | OMP_NONE, OMP_PARALLEL, OMP_DO_FOR,OMP_DO_FOR_LOOP_BODY, OMP_SECTIONS, OM P_SINGLE, | |||
OMP_PAR_DO, OMP_PAR_SECTIONS, OMP_MASTER, OMP_CRITICAL, | OMP_PAR_DO, OMP_PAR_SECTIONS, OMP_MASTER, OMP_CRITICAL, | |||
OMP_BARRIER, OMP_ATOMIC, OMP_FLUSH, OMP_ORDERED, OMP_ANY | OMP_BARRIER, OMP_ATOMIC, OMP_FLUSH, OMP_ORDERED, OMP_ANY | |||
} parRegType; | } parRegType; | |||
#ifdef DYNINST_CLASS_NAME | class BPATCH_DLL_EXPORT BPatch_parRegion { | |||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_parRegion | ||||
class BPATCH_DLL_EXPORT BPatch_parRegion: public BPatch_eventLock{ | ||||
BPatch_function * func; | BPatch_function * func; | |||
int_parRegion * parReg; | int_parRegion * parReg; | |||
public: | public: | |||
BPatch_parRegion(int_parRegion * _parReg, BPatch_function * _func); | BPatch_parRegion(int_parRegion * _parReg, BPatch_function * _func); | |||
~BPatch_parRegion(); | ~BPatch_parRegion(); | |||
int_parRegion *lowlevel_region() const {return parReg;} | int_parRegion *lowlevel_region() const {return parReg;} | |||
void printDetails(); | void printDetails(); | |||
/** BPatch_basicBlock::getClause */ | /** BPatch_basicBlock::getClause */ | |||
API_EXPORT(Int, (key), | int getClause(const char * key); | |||
int, getClause, (const char * key)); | ||||
/** BPatch_basicBlock::replaceOMPParameter */ | /** BPatch_basicBlock::replaceOMPParameter */ | |||
API_EXPORT(Int, (key, value), | int replaceOMPParameter(const char * key, int value); | |||
int, replaceOMPParameter, (const char * key, int value)); | ||||
/** BPatch_parRegion::getInstructions */ | /** BPatch_parRegion::getInstructions */ | |||
/** return the instructions that belong to the block */ | /** return the instructions that belong to the block */ | |||
API_EXPORT(Int, (), | BPatch_Vector<BPatch_instruction *> * getInstructions(); | |||
BPatch_Vector<BPatch_instruction *> *,getInstructions,()); | ||||
API_EXPORT(Int, (insns), | bool getInstructions(std::vector<Dyninst::InstructionAPI::Instruction::P | |||
bool, getInstructions, (std::vector<Dyninst::InstructionAPI::In | tr>& insns); | |||
struction::Ptr>& insns)); | ||||
/** BPatch_parRegion::size */ | /** BPatch_parRegion::size */ | |||
API_EXPORT(Int, (), | unsigned size() const; | |||
unsigned,size,() CONST_EXPORT); | ||||
/** BPatch_parRegion::getStartAddress */ | /** BPatch_parRegion::getStartAddress */ | |||
//these always return absolute address | //these always return absolute address | |||
API_EXPORT(Int, (), | unsigned long getStartAddress() const; | |||
unsigned long,getStartAddress,() CONST_EXPORT); | ||||
/** BPatch_basicBlock::getEndAddress */ | /** BPatch_basicBlock::getEndAddress */ | |||
API_EXPORT(Int, (), | unsigned long getEndAddress() const; | |||
unsigned long, getEndAddress, () CONST_EXPORT); | ||||
private: | private: | |||
/** the instructions within this region */ | /** the instructions within this region */ | |||
BPatch_Vector<BPatch_instruction*> *instructions; | BPatch_Vector<BPatch_instruction*> *instructions; | |||
}; | }; | |||
#endif | #endif | |||
End of changes. 15 change blocks. | ||||
32 lines changed or deleted | 19 lines changed or added | |||
BPatch_point.h | BPatch_point.h | |||
---|---|---|---|---|
skipping to change at line 36 | skipping to change at line 36 | |||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | */ | |||
#ifndef _BPatch_point_h_ | #ifndef _BPatch_point_h_ | |||
#define _BPatch_point_h_ | #define _BPatch_point_h_ | |||
#include "BPatch_dll.h" | #include "BPatch_dll.h" | |||
#include "BPatch_Vector.h" | #include "BPatch_Vector.h" | |||
#include "BPatch_eventLock.h" | ||||
#include "BPatch_Set.h" | #include "BPatch_Set.h" | |||
#include "BPatch_enums.h" | #include "BPatch_enums.h" | |||
class InstrucIter; | class InstrucIter; | |||
class instPoint; | class instPoint; | |||
class miniTramp; | class miniTramp; | |||
class BPatch_thread; | class BPatch_thread; | |||
class BPatch_image; | class BPatch_image; | |||
class BPatch_function; | class BPatch_function; | |||
class BPatch_memoryAccess; | class BPatch_memoryAccess; | |||
skipping to change at line 93 | skipping to change at line 92 | |||
#define BPatch_locBasicBlockLoopEntry BPatch_locLoopEntry | #define BPatch_locBasicBlockLoopEntry BPatch_locLoopEntry | |||
#define BPatch_locBasicBlockLoopExit BPatch_locLoopExit | #define BPatch_locBasicBlockLoopExit BPatch_locLoopExit | |||
#endif | #endif | |||
/* VG(09/17/01) Added memory access pointer */ | /* VG(09/17/01) Added memory access pointer */ | |||
/* VG(11/06/01) Moved constructor to implementation file because it | /* VG(11/06/01) Moved constructor to implementation file because it | |||
needs to link instPoint back pointer (and we don't want to include | needs to link instPoint back pointer (and we don't want to include | |||
that here) */ | that here) */ | |||
#ifdef DYNINST_CLASS_NAME | class BPATCH_DLL_EXPORT BPatch_point { | |||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_point | ||||
class BPATCH_DLL_EXPORT BPatch_point : public BPatch_eventLock { | ||||
friend class BPatch_process; | friend class BPatch_process; | |||
friend class BPatch_binaryEdit; | friend class BPatch_binaryEdit; | |||
friend class BPatch_addressSpace; | friend class BPatch_addressSpace; | |||
friend class BPatch_image; | friend class BPatch_image; | |||
friend class BPatch_function; | friend class BPatch_function; | |||
friend class BPatch_basicBlock; | friend class BPatch_basicBlock; | |||
friend class BPatch_basicBlockLoop; | friend class BPatch_basicBlockLoop; | |||
friend class BPatch_flowGraph; // Access to setLoop | friend class BPatch_flowGraph; // Access to setLoop | |||
friend class BPatch_asyncEventHandler; | friend class BPatch_asyncEventHandler; | |||
friend class BPatch_edge; | friend class BPatch_edge; | |||
skipping to change at line 130 | skipping to change at line 124 | |||
// (e.g., an instruction) and how the internals represent a point | // (e.g., an instruction) and how the internals represent a point | |||
// (e.g., pre-instruction). We handle this here with a secondary | // (e.g., pre-instruction). We handle this here with a secondary | |||
// instPoint that is defined to be the "after" equivalent. | // instPoint that is defined to be the "after" equivalent. | |||
instPoint *point; | instPoint *point; | |||
instPoint *secondaryPoint; | instPoint *secondaryPoint; | |||
BPatch_procedureLocation pointType; | BPatch_procedureLocation pointType; | |||
BPatch_memoryAccess *memacc; | BPatch_memoryAccess *memacc; | |||
// Instruction constructor... | // Instruction constructor... | |||
BPatch_point(BPatch_addressSpace *_addSpace, BPatch_function *_func, | BPatch_point(BPatch_addressSpace *_addSpace, BPatch_function *_func, | |||
instPoint *_point, instPoint *_secondary, | instPoint *_point, instPoint *_secondary, | |||
BPatch_procedureLocation _pointType, | BPatch_procedureLocation _pointType, | |||
AddressSpace *as); | AddressSpace *as); | |||
// Edge constructor... | // Edge constructor... | |||
BPatch_point(BPatch_addressSpace *_addSpace, BPatch_function *_func, | BPatch_point(BPatch_addressSpace *_addSpace, BPatch_function *_func, | |||
BPatch_edge *_edge, instPoint *_point, AddressSpace *as); | BPatch_edge *_edge, instPoint *_point, AddressSpace *as); | |||
void setLoop(BPatch_basicBlockLoop *l); | void setLoop(BPatch_basicBlockLoop *l); | |||
// We often create a point with the arbitrary point type, | // We often create a point with the arbitrary point type, | |||
skipping to change at line 190 | skipping to change at line 184 | |||
// Hack to get edge information. DO NOT USE. | // Hack to get edge information. DO NOT USE. | |||
BPatch_edge *edge() const { return edge_; } | BPatch_edge *edge() const { return edge_; } | |||
bool isReturnInstruction(); | bool isReturnInstruction(); | |||
static BPatch_procedureLocation convertInstPointType_t(int intType); | static BPatch_procedureLocation convertInstPointType_t(int intType); | |||
instPoint *llpoint() { return point; } | instPoint *llpoint() { return point; } | |||
Dyninst::Address getCallFallThroughAddr(); | Dyninst::Address getCallFallThroughAddr(); | |||
bool patchPostCallArea(); | bool patchPostCallArea(); | |||
// End internal functions | // End internal functions | |||
//Added for DynC... | //Added for DynC... | |||
API_EXPORT(Int, (), | ||||
BPatch_addressSpace *, getAddressSpace, ()); | BPatch_addressSpace * getAddressSpace(); | |||
// Get the loop ID | // Get the loop ID | |||
API_EXPORT(Int, (), | ||||
BPatch_basicBlockLoop *, getLoop, ()); | BPatch_basicBlockLoop * getLoop(); | |||
// BPatch_point::getPointType | // BPatch_point::getPointType | |||
// | // | |||
API_EXPORT(Int, (), | BPatch_procedureLocation getPointType(); | |||
BPatch_procedureLocation,getPointType,()); | ||||
// BPatch_point::getFunction | // BPatch_point::getFunction | |||
// Returns function to which this point belongs | // Returns function to which this point belongs | |||
API_EXPORT(Int, (), | BPatch_function * getFunction(); | |||
BPatch_function *,getFunction,()); | ||||
// BPatch_point::getCalledFunction | // BPatch_point::getCalledFunction | |||
// Returns a BPatch_function representing the function being called at this point. | // Returns a BPatch_function representing the function being called at this point. | |||
// If this point is not a call site, returns NULL. | // If this point is not a call site, returns NULL. | |||
API_EXPORT(Int, (), | BPatch_function * getCalledFunction(); | |||
BPatch_function *,getCalledFunction,()); | ||||
API_EXPORT(Int, (), | std::string getCalledFunctionName(); | |||
std::string,getCalledFunctionName,()); | ||||
// BPatch_point::getBlock | // BPatch_point::getBlock | |||
// Returns block to which this point belongs if such a block exists | // Returns block to which this point belongs if such a block exists | |||
// For example, function entry points do not have blocks associated wi th them. | // For example, function entry points do not have blocks associated wi th them. | |||
API_EXPORT(Int, (), | BPatch_basicBlock * getBlock(); | |||
BPatch_basicBlock *,getBlock,()); | ||||
// BPatch_point::getAddress | // BPatch_point::getAddress | |||
// Returns the address of this point in the mutatee | // Returns the address of this point in the mutatee | |||
API_EXPORT(Int, (), | void * getAddress(); | |||
void *,getAddress,()); | ||||
// BPatch_point::getMemoryAccess | // BPatch_point::getMemoryAccess | |||
// | // | |||
API_EXPORT(Int, (), | const BPatch_memoryAccess * getMemoryAccess(); | |||
const BPatch_memoryAccess *,getMemoryAccess,()); | Dyninst::InstructionAPI::Instruction::Ptr getInsnAtPoint(); | |||
API_EXPORT(Int, (), | ||||
Dyninst::InstructionAPI::Instruction::Ptr, getInsnAtPoint, () | ||||
); | ||||
// BPatch_point::getCurrentSnippets | // BPatch_point::getCurrentSnippets | |||
// | // | |||
// to get all current snippets at this point | // to get all current snippets at this point | |||
API_EXPORT(Int, (), | const BPatch_Vector<BPatchSnippetHandle *> getCurrentSnippets(); | |||
const BPatch_Vector<BPatchSnippetHandle *>,getCurrentSnippets,()); | ||||
// BPatch_point::getCurrentSnippets | // BPatch_point::getCurrentSnippets | |||
// | // | |||
// to get all current snippets as defined by when at this point | // to get all current snippets as defined by when at this point | |||
API_EXPORT(ByWhen, (when), | const BPatch_Vector<BPatchSnippetHandle *> getCurrentSnippets(BPatch_ca | |||
llWhen when); | ||||
const BPatch_Vector<BPatchSnippetHandle *>,getCurrentSnippets,(BPatch_c | ||||
allWhen when)); | ||||
// BPatch_point::getLiveRegisters | // BPatch_point::getLiveRegisters | |||
// | // | |||
// Get Live registers at this point | // Get Live registers at this point | |||
API_EXPORT(Int, (liveRegs), | bool getLiveRegisters(std::vector<BPatch_register> &liveRegs); | |||
bool, getLiveRegisters, (std::vector<BPatch_register> &liveRegs)); | ||||
// BPatch_point::isDynamic | // BPatch_point::isDynamic | |||
// | // | |||
// isDynamic() returns true if this is a dynamic call site | // isDynamic() returns true if this is a dynamic call site | |||
// (eg a call site where a func call is made via func ptr) | // (eg a call site where a func call is made via func ptr) | |||
API_EXPORT(Int, (), | bool isDynamic(); | |||
bool,isDynamic,()); | ||||
// BPatch_point::monitorCalls | // BPatch_point::monitorCalls | |||
// | // | |||
// monitorCalls(BPatch_function *cbFuncInUserLibrary) | // monitorCalls(BPatch_function *cbFuncInUserLibrary) | |||
// Applies only to dynamic call sites (returns false if this BPatch_po int | // Applies only to dynamic call sites (returns false if this BPatch_po int | |||
// is not a dynamic call site). Inserts a call to the user-written fu nction | // is not a dynamic call site). Inserts a call to the user-written fu nction | |||
// cbFuncInUserLibrary(), which must exist in a user defined library, | // cbFuncInUserLibrary(), which must exist in a user defined library, | |||
// at this call site. cbFuncInUserLibrary must adhere to the prototyp e: | // at this call site. cbFuncInUserLibrary must adhere to the prototyp e: | |||
// void cbFuncInUserLibrary(void *callee_address, void *callSite_addre ss). | // void cbFuncInUserLibrary(void *callee_address, void *callSite_addre ss). | |||
// | // | |||
// Returns handle on success, NULL on failure | // Returns handle on success, NULL on failure | |||
API_EXPORT(Int, (f), | void * monitorCalls(BPatch_function *f = NULL); | |||
void *,monitorCalls,(BPatch_function *f = NULL)); | ||||
// BPatch_point::stopMonitoring | // BPatch_point::stopMonitoring | |||
// If this point, as a dynamic call site, was being monitored, turns o ff monitoring | // If this point as a dynamic call site, was being monitored, turns o ff monitoring | |||
// <handle> is the handle returned my monitorCalls() | // <handle> is the handle returned my monitorCalls() | |||
API_EXPORT(Int, (), | bool stopMonitoring(); | |||
bool,stopMonitoring,()); | ||||
// BPatch_point::getDisplacedInstructions | // BPatch_point::getDisplacedInstructions | |||
// Returns the instructions to be relocated when instrumentation is in serted | // Returns the instructions to be relocated when instrumentation is in serted | |||
// at this point. Returns the number of bytes taken up by these instr uctions. | // at this point. Returns the number of bytes taken up by these instr uctions. | |||
API_EXPORT(Int, (maxSize, insns), | int getDisplacedInstructions(int maxSize, void *insns); | |||
int,getDisplacedInstructions,(int maxSize, void *insns)); | ||||
// BPatch_point::usesTrap_NP | // BPatch_point::usesTrap_NP | |||
// Returns true if this point is or would be instrumented with a trap, rather | // Returns true if this point is or would be instrumented with a trap, rather | |||
// than a jump to the base tramp, false otherwise. On platforms that do not | // than a jump to the base tramp, false otherwise. On platforms that do not | |||
// use traps (everything other than x86), it always returns false; | // use traps (everything other than x86), it always returns false; | |||
API_EXPORT(Int, (), | bool usesTrap_NP(); | |||
bool,usesTrap_NP,()); | ||||
#ifdef IBM_BPATCH_COMPAT | #ifdef IBM_BPATCH_COMPAT | |||
void *getPointAddress() { return getAddress(); } | void *getPointAddress() { return getAddress(); } | |||
int getPointLine() { return -1; } | int getPointLine() { return -1; } | |||
BPatch_function *getContainingFunction() { return const_cast<BPatch_fun ction*>(getFunction()); }; | BPatch_function *getContainingFunction() { return const_cast<BPatch_fun ction*>(getFunction()); }; | |||
#endif | #endif | |||
}; | }; | |||
#endif /* _BPatch_point_h_ */ | #endif /* _BPatch_point_h_ */ | |||
End of changes. 24 change blocks. | ||||
60 lines changed or deleted | 22 lines changed or added | |||
BPatch_process.h | BPatch_process.h | |||
---|---|---|---|---|
skipping to change at line 37 | skipping to change at line 37 | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | */ | |||
#ifndef _BPatch_process_h_ | #ifndef _BPatch_process_h_ | |||
#define _BPatch_process_h_ | #define _BPatch_process_h_ | |||
#include "BPatch_snippet.h" | #include "BPatch_snippet.h" | |||
#include "BPatch_dll.h" | #include "BPatch_dll.h" | |||
#include "BPatch_Vector.h" | #include "BPatch_Vector.h" | |||
//#include "BPatch_image.h" | // #include "BPatch_image.h" | |||
#include "BPatch_eventLock.h" | ||||
#include "BPatch_addressSpace.h" | #include "BPatch_addressSpace.h" | |||
#include "BPatch_enums.h" | #include "BPatch_enums.h" | |||
#include "BPatch_callbacks.h" | #include "BPatch_callbacks.h" | |||
#include "PCProcess.h" | ||||
#include <vector> | #include <vector> | |||
#include <stdio.h> | #include <cstdio> | |||
#include <signal.h> | #include <csignal> | |||
class PCProcess; | class PCProcess; | |||
class AddressSpace; | class AddressSpace; | |||
class PCThread; | class PCThread; | |||
class miniTrampHandle; | class miniTrampHandle; | |||
class miniTramp; | class miniTramp; | |||
class BPatch; | class BPatch; | |||
class BPatch_thread; | class BPatch_thread; | |||
class BPatch_process; | class BPatch_process; | |||
class BPatch_point; | class BPatch_point; | |||
skipping to change at line 98 | skipping to change at line 98 | |||
BPatch_thread *thread; | BPatch_thread *thread; | |||
} BPatch_catchupInfo; | } BPatch_catchupInfo; | |||
/* | /* | |||
* class OneTimeCodeInfo | * class OneTimeCodeInfo | |||
* | * | |||
* This is used by the oneTimeCode (inferiorRPC) mechanism to keep per-RPC | * This is used by the oneTimeCode (inferiorRPC) mechanism to keep per-RPC | |||
* information. | * information. | |||
*/ | */ | |||
class OneTimeCodeInfo { | class OneTimeCodeInfo { | |||
bool synchronous; | bool synchronous; | |||
bool completed; | bool completed; | |||
void *userData; | void *userData; | |||
BPatchOneTimeCodeCallback cb; | BPatchOneTimeCodeCallback cb; | |||
void *returnValue; | void *returnValue; | |||
unsigned thrID; | unsigned thrID; | |||
public: | public: | |||
OneTimeCodeInfo(bool _synchronous, void *_userData, BPatchOneTimeCodeCal | OneTimeCodeInfo(bool _synchronous, void *_userData, BPatchOneTimeCodeCallb | |||
lback _cb, unsigned _thrID) : | ack _cb, unsigned _thrID) : | |||
synchronous(_synchronous), completed(false), userData(_userData), cb( | synchronous(_synchronous), completed(false), userData(_userData), cb(_cb) | |||
_cb), | , | |||
thrID(_thrID) { }; | thrID(_thrID) { }; | |||
bool isSynchronous() { return synchronous; } | bool isSynchronous() { return synchronous; } | |||
bool isCompleted() const { return completed; } | bool isCompleted() const { return completed; } | |||
void setCompleted(bool _completed) { completed = _completed; } | void setCompleted(bool _completed) { completed = _completed; } | |||
void *getUserData() { return userData; } | void *getUserData() { return userData; } | |||
void setReturnValue(void *_returnValue) { returnValue = _returnValue; } | void setReturnValue(void *_returnValue) { returnValue = _returnValue; } | |||
void *getReturnValue() { return returnValue; } | void *getReturnValue() { return returnValue; } | |||
unsigned getThreadID() { return thrID; } | unsigned getThreadID() { return thrID; } | |||
BPatchOneTimeCodeCallback getCallback() { return cb;} | BPatchOneTimeCodeCallback getCallback() { return cb;} | |||
}; | }; | |||
/* | /* | |||
* Represents a process | * Represents a process | |||
*/ | */ | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_process | ||||
class BPATCH_DLL_EXPORT BPatch_process : public BPatch_addressSpace { | class BPATCH_DLL_EXPORT BPatch_process : public BPatch_addressSpace { | |||
friend class BPatch; | friend class BPatch; | |||
friend class BPatch_image; | friend class BPatch_image; | |||
friend class BPatch_function; | friend class BPatch_function; | |||
friend class BPatch_frame; | friend class BPatch_frame; | |||
friend class BPatch_thread; | friend class BPatch_thread; | |||
friend class BPatch_asyncEventHandler; | friend class BPatch_asyncEventHandler; | |||
friend class BPatch_module; | friend class BPatch_module; | |||
friend class BPatch_basicBlock; | friend class BPatch_basicBlock; | |||
friend class BPatch_flowGraph; | friend class BPatch_flowGraph; | |||
friend class BPatch_loopTreeNode; | friend class BPatch_loopTreeNode; | |||
friend class BPatch_point; | friend class BPatch_point; | |||
friend class BPatch_funcCallExpr; | friend class BPatch_funcCallExpr; | |||
friend class BPatch_eventMailbox; | friend class BPatch_eventMailbox; | |||
friend class BPatch_instruction; | friend class BPatch_instruction; | |||
friend class BPatch_addressSpace; | friend class BPatch_addressSpace; | |||
friend class AstNode; // AST needs to translate instPoint to | friend class AstNode; // AST needs to translate instPoint to | |||
friend class AstOperatorNode; | friend class AstOperatorNode; | |||
friend class AstMemoryNode; | friend class AstMemoryNode; | |||
friend class PCEventHandler; // to deliver events for callbacks | friend class PCEventHandler; // to deliver events for callbacks | |||
protected: | protected: | |||
void getAS(std::vector<AddressSpace *> &as); | void getAS(std::vector<AddressSpace *> &as); | |||
public: | public: | |||
void PDSEP_updateObservedCostAddr(unsigned long a); | void PDSEP_updateObservedCostAddr(unsigned long a); | |||
private: | private: | |||
//References to lower level objects | //References to lower level objects | |||
PCProcess *llproc; | PCProcess *llproc; | |||
BPatch_Vector<BPatch_thread *> threads; | BPatch_Vector<BPatch_thread *> threads; | |||
int lastSignal; | int lastSignal; | |||
int exitCode; | int exitCode; | |||
int exitSignal; | int exitSignal; | |||
bool exitedNormally; | bool exitedNormally; | |||
bool exitedViaSignal; | bool exitedViaSignal; | |||
bool mutationsActive; | bool mutationsActive; | |||
bool createdViaAttach; | bool createdViaAttach; | |||
bool detached; | bool detached; | |||
// BPatch-level; once the callbacks are sent by the llproc, we're termi | // BPatch-level; once the callbacks are sent by the llproc, we're termina | |||
nated | ted | |||
// Used because callbacks go (and can clean up user code) before the lo | // Used because callbacks go (and can clean up user code) before the low- | |||
w-level process | level process | |||
// sets flags. | // sets flags. | |||
bool terminated; | bool terminated; | |||
bool reportedExit; | bool reportedExit; | |||
void setExitedNormally(); | void setExitedNormally(); | |||
void setExitedViaSignal(int signalnumber); | void setExitedViaSignal(int signalnumber); | |||
void setExitCode(int exitcode) { exitCode = exitcode; } | void setExitCode(int exitcode) { exitCode = exitcode; } | |||
void setExitSignal(int exitsignal) { exitSignal = exitsignal; } | void setExitSignal(int exitsignal) { exitSignal = exitsignal; } | |||
bool statusIsTerminated(); | bool statusIsTerminated(); | |||
void setLastSignal(int signal) { lastSignal = signal; } | void setLastSignal(int signal) { lastSignal = signal; } | |||
bool getType(); | bool getType(); | |||
bool getTerminated() {return terminated;} | bool getTerminated() {return terminated;} | |||
bool getMutationsActive() {return mutationsActive;} | bool getMutationsActive() {return mutationsActive;} | |||
HybridAnalysis *hybridAnalysis_; | HybridAnalysis *hybridAnalysis_; | |||
static int oneTimeCodeCallbackDispatch(PCProcess *theProc, | static int oneTimeCodeCallbackDispatch(PCProcess *theProc, | |||
unsigned /* rpcid */, | unsigned /* rpcid */, | |||
void *userData, | void *userData, | |||
void *returnValue); | void *returnValue); | |||
void *oneTimeCodeInternal(const BPatch_snippet &expr, | void *oneTimeCodeInternal(const BPatch_snippet &expr, | |||
BPatch_thread *thread, // == NULL if proc-wid | BPatch_thread *thread, // == NULL if proc-wide | |||
e | void *userData, | |||
void *userData, | BPatchOneTimeCodeCallback cb = NULL, | |||
BPatchOneTimeCodeCallback cb = NULL, | bool synchronous = true, bool *err = NULL, | |||
bool synchronous = true, bool *err = NULL, | bool userRPC = true); | |||
bool userRPC = true); | ||||
protected: | ||||
protected: | // for creating a process | |||
// for creating a process | BPatch_process(const char *path, const char *argv[], | |||
BPatch_process(const char *path, const char *argv[], | BPatch_hybridMode mode, const char **envp = NULL, | |||
BPatch_hybridMode mode, const char **envp = NULL, | int stdin_fd = 0, int stdout_fd = 1, int stderr_fd = 2); | |||
int stdin_fd = 0, int stdout_fd = 1, int stderr_fd = 2); | // for attaching | |||
// for attaching | BPatch_process(const char *path, int pid, BPatch_hybridMode mode); | |||
BPatch_process(const char *path, int pid, BPatch_hybridMode mode); | ||||
// for forking | ||||
// for forking | BPatch_process(PCProcess *proc); | |||
BPatch_process(PCProcess *proc); | ||||
void triggerThreadCreate(PCThread *thread); | ||||
void triggerThreadCreate(PCThread *thread); | void triggerInitialThreadEvents(); | |||
void triggerInitialThreadEvents(); | void deleteBPThread(BPatch_thread *thrd); | |||
void deleteBPThread(BPatch_thread *thrd); | ||||
public: | ||||
public: | ||||
// Begin internal functions, DO NOT USE | ||||
// Begin internal functions, DO NOT USE | // | |||
// | // this function should go away as soon as Paradyn links against Dyninst | |||
// this function should go away as soon as Paradyn links against Dynins | PCProcess *lowlevel_process() const { return llproc; } | |||
t | // These internal funcs trigger callbacks registered to matching events | |||
PCProcess *lowlevel_process() const { return llproc; } | bool triggerStopThread(instPoint *intPoint, func_instance *intFunc, | |||
// These internal funcs trigger callbacks registered to matching events | int cb_ID, void *retVal); | |||
bool triggerStopThread(instPoint *intPoint, func_instance *intFunc, | bool triggerSignalHandlerCB(instPoint *point, func_instance *func, long s | |||
int cb_ID, void *retVal); | ignum, | |||
bool triggerSignalHandlerCB(instPoint *point, func_instance *func, long | BPatch_Vector<Dyninst::Address> *handlers); | |||
signum, | bool triggerCodeOverwriteCB(instPoint * faultPoint, | |||
BPatch_Vector<Dyninst::Address> *handlers); | Dyninst::Address faultTarget); | |||
bool triggerCodeOverwriteCB(instPoint * faultPoint, | bool setMemoryAccessRights(Dyninst::Address start, size_t size, | |||
Dyninst::Address faultTarget); | Dyninst::ProcControlAPI::Process::mem_perm righ | |||
bool setMemoryAccessRights(Dyninst::Address start, Dyninst::Address siz | ts); | |||
e, | unsigned char *makeShadowPage(Dyninst::Address pageAddress); | |||
int rights); | void overwriteAnalysisUpdate | |||
unsigned char *makeShadowPage(Dyninst::Address pageAddress); | ( std::map<Dyninst::Address,unsigned char*>& owPages, //input | |||
void overwriteAnalysisUpdate | std::vector<std::pair<Dyninst::Address,int> >& deadBlocks, //output | |||
( std::map<Dyninst::Address,unsigned char*>& owPages, //input | std::vector<BPatch_function*>& owFuncs, //output | |||
std::vector<std::pair<Dyninst::Address,int> >& deadBlocks, //outp | std::set<BPatch_function *> &monitorFuncs, //output | |||
ut | bool &changedPages, bool &changedCode ); //output | |||
std::vector<BPatch_function*>& owFuncs, //output | HybridAnalysis *getHybridAnalysis() { return hybridAnalysis_; } | |||
std::set<BPatch_function *> &monitorFuncs, //output | bool protectAnalyzedCode(); | |||
bool &changedPages, bool &changedCode ); //output | // DO NOT USE | |||
HybridAnalysis *getHybridAnalysis() { return hybridAnalysis_; } | // This is an internal debugging function | |||
bool protectAnalyzedCode(); | void debugSuicide(); | |||
// DO NOT USE | // | |||
// This is an internal debugging function | // End internal functions | |||
API_EXPORT_V(Int, (), | ||||
void, debugSuicide,()); | // BPatch_process::~BPatch_process | |||
// | // | |||
// End internal functions | // Destructor | |||
~BPatch_process(); | ||||
// BPatch_process::~BPatch_process | ||||
// | // BPatch_process::getPid | |||
// Destructor | // | |||
API_EXPORT_DTOR(_dtor, (), | // Get id of mutatee process | |||
~,BPatch_process,()); | ||||
int getPid(); | ||||
// BPatch_process::getPid | ||||
// | // BPatch_process::getAddressWidth | |||
// Get id of mutatee process | // | |||
// Get the address width (4 or 8) of the process | ||||
API_EXPORT(Int, (), | ||||
int,getPid,()); | int getAddressWidth(); | |||
// BPatch_process::getAddressWidth | // BPatch_process::stopExecution | |||
// | // | |||
// Get the address width (4 or 8) of the process | // Stop the mutatee process | |||
API_EXPORT(Int, (), | bool stopExecution(); | |||
int,getAddressWidth,()); | ||||
// BPatch_process::continueExecution | ||||
// BPatch_process::stopExecution | // | |||
// | // Resume execution of mutatee process | |||
// Stop the mutatee process | ||||
bool continueExecution(); | ||||
API_EXPORT(Int, (), | ||||
bool,stopExecution,()); | // BPatch_process::terminateExecution | |||
// | ||||
// BPatch_process::continueExecution | // Terminate mutatee process | |||
// | ||||
// Resume execution of mutatee process | bool terminateExecution(); | |||
API_EXPORT(Int, (), | // BPatch_process::isStopped | |||
bool,continueExecution,()); | // | |||
// Returns true if mutatee process is currently stopped | ||||
// BPatch_process::terminateExecution | ||||
// | bool isStopped(); | |||
// Terminate mutatee process | ||||
// BPatch_process::stopSignal | ||||
API_EXPORT(Int, (), | // | |||
bool,terminateExecution,()); | // Returns signal number of signal that stopped mutatee process | |||
// BPatch_process::isStopped | int stopSignal(); | |||
// | ||||
// Returns true if mutatee process is currently stopped | // BPatch_process::isTerminated | |||
// | ||||
API_EXPORT(Int, (), | // Returns true if mutatee process is terminated | |||
bool,isStopped,()); | ||||
bool isTerminated(); | ||||
// BPatch_process::stopSignal | ||||
// | // BPatch_process::terminationStatus | |||
// Returns signal number of signal that stopped mutatee process | // | |||
// Returns information on how mutatee process was terminated | ||||
API_EXPORT(Int, (), | ||||
int,stopSignal,()); | BPatch_exitType terminationStatus(); | |||
// BPatch_process::isTerminated | // BPatch_process::getExitCode | |||
// | // | |||
// Returns true if mutatee process is terminated | // Returns integer exit code of (exited) mutatee process | |||
API_EXPORT(Int, (), | int getExitCode(); | |||
bool,isTerminated,()); | ||||
// BPatch_process::getExitSignal | ||||
// BPatch_process::terminationStatus | // | |||
// | // Returns integer signal number of signal that caused mutatee to exit | |||
// Returns information on how mutatee process was terminated | ||||
int getExitSignal(); | ||||
API_EXPORT(Int, (), | ||||
BPatch_exitType,terminationStatus,()); | // BPatch_process::detach | |||
// | ||||
// BPatch_process::getExitCode | // Detach from the mutatee process, optionally leaving it running | |||
// | ||||
// Returns integer exit code of (exited) mutatee process | bool wasRunningWhenAttached(); | |||
API_EXPORT(Int, (), | // BPatch_process::detach | |||
int,getExitCode,()); | // | |||
// Detach from the mutatee process, optionally leaving it running | ||||
// BPatch_process::getExitSignal | ||||
// | bool detach(bool cont); | |||
// Returns integer signal number of signal that caused mutatee to exit | ||||
// BPatch_process::isDetached | ||||
API_EXPORT(Int, (), | // | |||
int,getExitSignal,()); | // Returns true if DyninstAPI is detached from this mutatee | |||
// BPatch_process::detach | bool isDetached(); | |||
// | ||||
// Detach from the mutatee process, optionally leaving it running | // BPatch_process::getThreads | |||
// | ||||
API_EXPORT(Int, (), | // Fills a vector with the BPatch_thread objects that belong to | |||
bool,wasRunningWhenAttached,()); | // this process | |||
void getThreads(BPatch_Vector<BPatch_thread *> &thrds); | ||||
// BPatch_process::detach | ||||
// | // BPatch_prOcess::isMultithreaded | |||
// Detach from the mutatee process, optionally leaving it running | // | |||
// Returns true if this process has more than one thread | ||||
API_EXPORT(Int, (cont), | bool isMultithreaded(); | |||
bool,detach,(bool cont)); | ||||
// BPatch_prOcess::isMultithreadCapable | ||||
// BPatch_process::isDetached | // | |||
// | // Returns true if this process is linked against a thread library | |||
// Returns true if DyninstAPI is detached from this mutatee | // (and thus might be multithreaded) | |||
bool isMultithreadCapable(); | ||||
API_EXPORT(Int, (), | ||||
bool,isDetached,()); | // BPatch_process::getThread | |||
// | ||||
// BPatch_process::getThreads | // Returns one of this process's threads, given a tid | |||
// | BPatch_thread * getThread(dynthread_t tid); | |||
// Fills a vector with the BPatch_thread objects that belong to | ||||
// this process | // BPatch_process::getThread | |||
API_EXPORT_V(Int, (thrds), | // | |||
void, getThreads, (BPatch_Vector<BPatch_thread *> &thrds)); | // Returns one of this process's threads, given an index | |||
BPatch_thread * getThreadByIndex(unsigned index); | ||||
// BPatch_prOcess::isMultithreaded | ||||
// | // BPatch_process::dumpCore | |||
// Returns true if this process has more than one thread | // | |||
API_EXPORT(Int, (), | // Produce a core dump file <file> for the mutatee process | |||
bool, isMultithreaded, ()); | ||||
bool dumpCore(const char *file, bool terminate); | ||||
// BPatch_prOcess::isMultithreadCapable | ||||
// | // BPatch_process::dumpImage | |||
// Returns true if this process is linked against a thread library | // | |||
// (and thus might be multithreaded) | // Write contents of memory to <file> | |||
API_EXPORT(Int, (), | ||||
bool, isMultithreadCapable, ()); | bool dumpImage(const char *file); | |||
// BPatch_process::getThread | // BPatch_process::getInheritedVariable | |||
// | // | |||
// Returns one of this process's threads, given a tid | // | |||
API_EXPORT(Int, (tid), | ||||
BPatch_thread *, getThread, (dynthread_t tid)); | BPatch_variableExpr * getInheritedVariable(BPatch_variableExpr &pVar); | |||
// BPatch_process::getThread | // BPatch_process::getInheritedSnippet | |||
// | // | |||
// Returns one of this process's threads, given an index | // | |||
API_EXPORT(Int, (index), | ||||
BPatch_thread *, getThreadByIndex, (unsigned index)); | BPatchSnippetHandle * getInheritedSnippet(BPatchSnippetHandle &parentSnip | |||
pet); | ||||
// BPatch_process::dumpCore | ||||
// | // BPatch_binaryEdit::beginInsertionSet() | |||
// Produce a core dump file <file> for the mutatee process | // | |||
// Start the batch insertion of multiple points; all calls to insertSnip | ||||
API_EXPORT(Int, (file, terminate), | pet* | |||
bool,dumpCore,(const char *file, bool terminate)); | // after this call will not actually instrument until finalizeInsertionS | |||
et is | ||||
// BPatch_process::dumpImage | // called | |||
// | ||||
// Write contents of memory to <file> | void beginInsertionSet(); | |||
API_EXPORT(Int, (file), | //BPatch_process::finalizeInsertionSet() | |||
bool,dumpImage,(const char *file)); | ||||
// Finalizes all instrumentation logically added since a call to beginIns | ||||
// BPatch_process::getInheritedVariable | ertionSet. | |||
// | // Returns true if all instrumentation was successfully inserted; otherw | |||
// | ise, none | |||
// was. Individual instrumentation can be manipulated via the BPatchSnip | ||||
API_EXPORT(Int, (pVar), | petHandles | |||
BPatch_variableExpr *,getInheritedVariable,(BPatch_variableExpr &pVar)) | // returned from individual calls to insertSnippet. | |||
; | // | |||
// atomic: if true, all instrumentation will be removed if any fails to | ||||
// BPatch_process::getInheritedSnippet | go in. | |||
// | // modified: if provided, and set to true by finalizeInsertionSet, addit | |||
// | ional | |||
// steps were taken to make the installation work, such as mod | ||||
API_EXPORT(Int, (parentSnippet), | ifying | |||
BPatchSnippetHandle *,getInheritedSnippet,(BPatchSnippetHandle &parentS | // process state. Note that such steps will be taken whether | |||
nippet)); | or not | |||
// a variable is provided. | ||||
// BPatch_binaryEdit::beginInsertionSet() | ||||
// | bool finalizeInsertionSet(bool atomic, bool *modified = NULL); | |||
// Start the batch insertion of multiple points; all calls to insertSn | ||||
ippet* | bool finalizeInsertionSetWithCatchup(bool atomic, bool *modified, | |||
// after this call will not actually instrument until finalizeInsertio | BPatch_Vector<BPatch_catchupInfo> &c | |||
nSet is | atchup_handles); | |||
// called | ||||
// BPatch_process::oneTimeCode | ||||
API_EXPORT_V(Int, (), | // | |||
void, beginInsertionSet, ()); | // Have the specified code be executed by the mutatee once. Wait until | |||
done. | ||||
//BPatch_process::finalizeInsertionSet() | ||||
void* oneTimeCode(const BPatch_snippet &expr, bool *err = NULL); | ||||
// Finalizes all instrumentation logically added since a call to beg | ||||
inInsertionSet. | // BPatch_process::oneTimeCodeAsync | |||
// Returns true if all instrumentation was successfully inserted; othe | // | |||
rwise, none | // Have the specified code be executed by the mutatee once. Dont wait u | |||
// was. Individual instrumentation can be manipulated via the BPatchSn | ntil done. | |||
ippetHandles | ||||
// returned from individual calls to insertSnippet. | bool oneTimeCodeAsync(const BPatch_snippet &expr, void *userData = NULL, | |||
// | BPatchOneTimeCodeCallback cb = NULL); | |||
// atomic: if true, all instrumentation will be removed if any fails t | ||||
o go in. | // BPatch_process::hideDebugger() | |||
// modified: if provided, and set to true by finalizeInsertionSet, add | // | |||
itional | // This is a Windows only function that removes debugging artifacts that | |||
// steps were taken to make the installation work, such as m | // are added to user-space datastructures and the heap of the debugged | |||
odifying | // process, by CreateProcess and DebugActiveProcess. Removing the artifa | |||
// process state. Note that such steps will be taken whethe | cts | |||
r or not | // doesn't have any effect on the process, as the kernel still knows that | |||
// a variable is provided. | // the process is being debugged. Three of the artifacts are flags that | |||
can | ||||
API_EXPORT(Int, (atomic, modified), | // be reached through the Process Environment Block of the debuggee (PEB) | |||
bool, finalizeInsertionSet, (bool atomic, bool *modified = N | : | |||
ULL)); | // 1. BeingDebugged, one byte at offset 2 in the PEB. | |||
// 2. NtGlobalFlags, at offset 0x68 in the PEB | ||||
API_EXPORT(Int, (atomic, modified, catchup_handles), | // 3. There are two consecutive words of heap flags which are at offset | |||
bool, finalizeInsertionSetWithCatchup, (bool atomic, bool *m | 0x0c | |||
odified, | // from the beginning of the heap. The heap base address is at offs | |||
BPatch_Vector<BPatch_catchupInf | et | |||
o> &catchup_handles)); | // 0x18 from the beginning of the PEB. | |||
// The other thing this method does is clear the 0xabababababababab value | ||||
// BPatch_process::oneTimeCode | that | |||
// | // it CreateProcess adds to the end of the heap section when creating a d | |||
// Have the specified code be executed by the mutatee once. Wait unti | ebugged | |||
l done. | // process, in response to the heap flag: HEAP_TAIL_CHECKING_ENABLED, whi | |||
ch it | ||||
API_EXPORT(Int, (expr, err), | // sets to true for debugged processes. We are clearing that flag, but b | |||
void *,oneTimeCode,(const BPatch_snippet &expr, bool *err = NULL)); | y the | |||
// time we do, the value is already written to disk. | ||||
// BPatch_process::oneTimeCodeAsync | // | |||
// | // Various system calls can still be used by the debuggee to recognize th | |||
// Have the specified code be executed by the mutatee once. Dont wait | at | |||
until done. | // it is being debugged, so this is not a complete solution. | |||
bool hideDebugger(); | ||||
API_EXPORT(Int, (expr, userData, cb), | ||||
bool,oneTimeCodeAsync,(const BPatch_snippet &expr, void *userData = NUL | ||||
L, | ||||
BPatchOneTimeCodeCallback cb = NULL)); | ||||
// BPatch_process::hideDebugger() | ||||
// | ||||
// This is a Windows only function that removes debugging artifacts tha | ||||
t | ||||
// are added to user-space datastructures and the heap of the debugged | ||||
// process, by CreateProcess and DebugActiveProcess. Removing the arti | ||||
facts | ||||
// doesn't have any effect on the process, as the kernel still knows th | ||||
at | ||||
// the process is being debugged. Three of the artifacts are flags tha | ||||
t can | ||||
// be reached through the Process Environment Block of the debuggee (PE | ||||
B): | ||||
// 1. BeingDebugged, one byte at offset 2 in the PEB. | ||||
// 2. NtGlobalFlags, at offset 0x68 in the PEB | ||||
// 3. There are two consecutive words of heap flags which are at offs | ||||
et 0x0c | ||||
// from the beginning of the heap. The heap base address is at of | ||||
fset | ||||
// 0x18 from the beginning of the PEB. | ||||
// The other thing this method does is clear the 0xabababababababab val | ||||
ue that | ||||
// it CreateProcess adds to the end of the heap section when creating a | ||||
debugged | ||||
// process, in response to the heap flag: HEAP_TAIL_CHECKING_ENABLED, w | ||||
hich it | ||||
// sets to true for debugged processes. We are clearing that flag, but | ||||
by the | ||||
// time we do, the value is already written to disk. | ||||
// | ||||
// Various system calls can still be used by the debuggee to recognize | ||||
that | ||||
// it is being debugged, so this is not a complete solution. | ||||
API_EXPORT(Int, (), | ||||
bool,hideDebugger,()); | ||||
#if 0 | #if 0 | |||
API_EXPORT_V(Int, (), | void printDefensiveStats(); | |||
void, printDefensiveStats, ()); | ||||
#endif | #endif | |||
// BPatch_process::enableDumpPatchedImage | // BPatch_process::enableDumpPatchedImage | |||
// | // | |||
// | // | |||
API_EXPORT_V(Int, (), | void enableDumpPatchedImage(); | |||
void,enableDumpPatchedImage,()); | ||||
#ifdef IBM_BPATCH_COMPAT | #ifdef IBM_BPATCH_COMPAT | |||
API_EXPORT(Int, (name, loadaddr), | bool addSharedObject(const char *name, const unsigned long loadaddr); | |||
bool,addSharedObject,(const char *name, const unsigned long loadaddr)); | ||||
#endif | #endif | |||
// BPatch_process::loadLibrary | // BPatch_process::loadLibrary | |||
// | // | |||
// Load a shared library into the mutatee's address space | // Load a shared library into the mutatee's address space | |||
// Returns true if successful | // Returns true if successful | |||
API_EXPORT_VIRT(Int, (libname, reload), | virtual BPatch_object * loadLibrary(const char *libname, bool reload = fa | |||
BPatch_object *, loadLibrary,(const char *libname, bool reload = false) | lse); | |||
); | ||||
}; | }; | |||
#endif /* BPatch_process_h_ */ | #endif /* BPatch_process_h_ */ | |||
End of changes. 15 change blocks. | ||||
434 lines changed or deleted | 386 lines changed or added | |||
BPatch_snippet.h | BPatch_snippet.h | |||
---|---|---|---|---|
skipping to change at line 41 | skipping to change at line 41 | |||
#ifndef _BPatch_snippet_h_ | #ifndef _BPatch_snippet_h_ | |||
#define _BPatch_snippet_h_ | #define _BPatch_snippet_h_ | |||
#include "BPatch_dll.h" | #include "BPatch_dll.h" | |||
#include "BPatch_Vector.h" | #include "BPatch_Vector.h" | |||
#include "BPatch_sourceObj.h" | #include "BPatch_sourceObj.h" | |||
#include "BPatch_type.h" | #include "BPatch_type.h" | |||
#include "BPatch_module.h" | #include "BPatch_module.h" | |||
//#include "BPatch_addressSpace.h" | //#include "BPatch_addressSpace.h" | |||
//#include "BPatch_function.h" | //#include "BPatch_function.h" | |||
#include "BPatch_eventLock.h" | ||||
#include "BPatch_callbacks.h" | #include "BPatch_callbacks.h" | |||
#include "BPatch_instruction.h" // for register type | #include "BPatch_instruction.h" // for register type | |||
#include "BPatch_enums.h" | #include "BPatch_enums.h" | |||
#include "boost/shared_ptr.hpp" | #include "boost/shared_ptr.hpp" | |||
class AstNode; | class AstNode; | |||
// Don't include the boost shared_ptr library | // Don't include the boost shared_ptr library | |||
class BPatch_snippet; | class BPatch_snippet; | |||
typedef boost::shared_ptr<AstNode> AstNodePtr; | typedef boost::shared_ptr<AstNode> AstNodePtr; | |||
skipping to change at line 115 | skipping to change at line 114 | |||
BPatch_negate, | BPatch_negate, | |||
BPatch_address, | BPatch_address, | |||
#ifdef IBM_BPATCH_COMPAT | #ifdef IBM_BPATCH_COMPAT | |||
BPatch_deref, | BPatch_deref, | |||
BPatch_bit_compl // not supported yet | BPatch_bit_compl // not supported yet | |||
#else | #else | |||
BPatch_deref | BPatch_deref | |||
#endif | #endif | |||
} BPatch_unOp; | } BPatch_unOp; | |||
#ifdef DYNINST_CLASS_NAME | class BPATCH_DLL_EXPORT BPatch_snippet { | |||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_snippet | ||||
class BPATCH_DLL_EXPORT BPatch_snippet : public BPatch_eventLock { | ||||
friend class BPatch_process; | friend class BPatch_process; | |||
friend class BPatch_binaryEdit; | friend class BPatch_binaryEdit; | |||
friend class BPatch_addressSpace; | friend class BPatch_addressSpace; | |||
friend class BPatch_thread; | friend class BPatch_thread; | |||
friend class BPatch_arithExpr; | friend class BPatch_arithExpr; | |||
friend class BPatch_boolExpr; | friend class BPatch_boolExpr; | |||
friend class BPatch_funcCallExpr; | friend class BPatch_funcCallExpr; | |||
friend class BPatch_variableExpr; | friend class BPatch_variableExpr; | |||
friend class BPatch_ifExpr; | friend class BPatch_ifExpr; | |||
skipping to change at line 152 | skipping to change at line 146 | |||
friend Dyninst::PatchAPI::SnippetPtr convert(const BPatch_snippet *snip ); | friend Dyninst::PatchAPI::SnippetPtr convert(const BPatch_snippet *snip ); | |||
public: | public: | |||
int PDSEP_astMinCost(); // This will go away too | int PDSEP_astMinCost(); // This will go away too | |||
// BPatch_snippet::BPatch_snippet | // BPatch_snippet::BPatch_snippet | |||
// Default constructor | // Default constructor | |||
BPatch_snippet(); | BPatch_snippet(); | |||
BPatch_snippet(AstNodePtr ast) {BPatch_snippet(); ast_wrapper = ast;} | BPatch_snippet(const AstNodePtr& ast); | |||
// BPatch_snippet::BPatch_snippet | // BPatch_snippet::BPatch_snippet | |||
// Copy constructor | // Copy constructor | |||
public: BPatch_snippet(const BPatch_snippet &src) : BPatch_eventLock(s | public: BPatch_snippet(const BPatch_snippet &src); | |||
rc) | ||||
{ LOCK_FUNCTION_V(BPatch_snippetInt,(src)); } | ||||
public: | public: | |||
//DynC internal use only | //DynC internal use only | |||
// BPatch_snippet::getType | // BPatch_snippet::getType | |||
// Returns the type of the underlying AST | // Returns the type of the underlying AST | |||
API_EXPORT(Int, (), | BPatch_type * getType(); | |||
BPatch_type *,getType,()); | ||||
private: | public: | |||
void BPatch_snippetInt(const BPatch_snippet &src); | ||||
void BPatch_snippetInt(const AstNodePtr &node); | ||||
// BPatch_snippet:operator= | // BPatch_snippet:operator= | |||
// Assign one BPatch_snippet to another | // Assign one BPatch_snippet to another | |||
API_EXPORT_OPER(_equals, (src), | ||||
BPatch_snippet &,operator=,(const BPatch_snippet &src)); | BPatch_snippet & operator=(const BPatch_snippet &src); | |||
// BPatch_snippet::~BPatch_snippet | // BPatch_snippet::~BPatch_snippet | |||
// Destructor, decrements reference count to snippet, deleting when no ne are left | // Destructor, decrements reference count to snippet, deleting when no ne are left | |||
API_EXPORT_DTOR(_dtor, (), | ||||
~,BPatch_snippet,()); | virtual ~BPatch_snippet(); | |||
// BPatch_snippet::getCost | // BPatch_snippet::getCost | |||
// Returns an estimated cost of executing the snippet, in seconds. | // Returns an estimated cost of executing the snippet, in seconds. | |||
API_EXPORT(Int, (), | ||||
float,getCost,()); | float getCost(); | |||
// BPatch_snippet::getCostAtPoint | // BPatch_snippet::getCostAtPoint | |||
// Returns an estimated cost of executing the snippet at a specified p oint, in seconds. | // Returns an estimated cost of executing the snippet at a specified p oint, in seconds. | |||
API_EXPORT(Int, (pt), | ||||
float,getCostAtPoint,(BPatch_point *pt)); | float getCostAtPoint(BPatch_point *pt); | |||
// BPatch_snippet::is_trivial | // BPatch_snippet::is_trivial | |||
// allows users to check to see if | // allows users to check to see if | |||
// a snippet operation failed (leaving ast NULL) | // a snippet operation failed (leaving ast NULL) | |||
API_EXPORT(Int, (), | ||||
bool,is_trivial,()); | bool is_trivial(); | |||
// protected: | // protected: | |||
//AstNodePtr *ast_wrapper; | //AstNodePtr *ast_wrapper; | |||
AstNodePtr ast_wrapper; | AstNodePtr ast_wrapper; | |||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_arithExpr | ||||
class BPATCH_DLL_EXPORT BPatch_arithExpr: public BPatch_snippet { | class BPATCH_DLL_EXPORT BPatch_arithExpr: public BPatch_snippet { | |||
public: | ||||
// BPatch_arithExpr::BPatch_arithExpr (Binary Arithmetic Operation) | // BPatch_arithExpr::BPatch_arithExpr (Binary Arithmetic Operation) | |||
// | // | |||
API_EXPORT_CTOR(Bin, (op, lOperand, rOperand), | BPatch_arithExpr(BPatch_binOp op, | |||
BPatch_arithExpr,(BPatch_binOp op, | ||||
const BPatch_snippet &lOperand, | const BPatch_snippet &lOperand, | |||
const BPatch_snippet &rOperand)); | const BPatch_snippet &rOperand); | |||
// BPatch_arithExpr::BPatch_arithExpr (Unary Arithmetic Operation) | // BPatch_arithExpr::BPatch_arithExpr (Unary Arithmetic Operation) | |||
// | // | |||
API_EXPORT_CTOR(Un, (op, lOperand), | BPatch_arithExpr(BPatch_unOp op, const BPatch_snippet &lOperand); | |||
BPatch_arithExpr,(BPatch_unOp op, const BPatch_snippet &lOperand)); | ||||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_boolExpr | ||||
class BPATCH_DLL_EXPORT BPatch_boolExpr : public BPatch_snippet { | class BPATCH_DLL_EXPORT BPatch_boolExpr : public BPatch_snippet { | |||
public: | ||||
// BPatch_boolExpr::BPatch_boolExpr | // BPatch_boolExpr::BPatch_boolExpr | |||
// Creates a representation of boolean operation | // Creates a representation of boolean operation | |||
API_EXPORT_CTOR(Int, (op, lOperand, rOperand), | BPatch_boolExpr(BPatch_relOp op, const BPatch_snippet &lOperand, | |||
BPatch_boolExpr,(BPatch_relOp op, const BPatch_snippet &lOperand, | const BPatch_snippet &rOperand); | |||
const BPatch_snippet &rOperand)); | ||||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_constExpr | ||||
class BPATCH_DLL_EXPORT BPatch_constExpr : public BPatch_snippet { | class BPATCH_DLL_EXPORT BPatch_constExpr : public BPatch_snippet { | |||
public: | ||||
// BPatch_constExpr::BPatch_constExpr | // BPatch_constExpr::BPatch_constExpr | |||
// Creates a representation of a (signed int) value | // Creates a representation of a (signed int) value | |||
API_EXPORT_CTOR(SignedInt, (value), | BPatch_constExpr(signed int value); | |||
BPatch_constExpr,(signed int value)); | ||||
// Creates a representation of an (unsigned int) value | // Creates a representation of an (unsigned int) value | |||
API_EXPORT_CTOR(UnsignedInt, (value), | BPatch_constExpr(unsigned int value); | |||
BPatch_constExpr,(unsigned int value)); | ||||
// Creates a representation of a (signed long) value | // Creates a representation of a (signed long) value | |||
API_EXPORT_CTOR(SignedLong, (value), | BPatch_constExpr(signed long value); | |||
BPatch_constExpr,(signed long value)); | ||||
// Creates a representation of an (unsigned long) value | // Creates a representation of an (unsigned long) value | |||
API_EXPORT_CTOR(UnsignedLong, (value), | BPatch_constExpr(unsigned long value); | |||
BPatch_constExpr,(unsigned long value)); | ||||
// BPatch_constExpr::BPatch_constExpr | // BPatch_constExpr::BPatch_constExpr | |||
// Creates a representation of a (char *) value | // Creates a representation of a (char *) value | |||
API_EXPORT_CTOR(CharStar, (value), | BPatch_constExpr(const char *value); | |||
BPatch_constExpr,(const char *value)); | ||||
// BPatch_constExpr::BPatch_constExpr | // BPatch_constExpr::BPatch_constExpr | |||
// Creates a representation of a (void *) value | // Creates a representation of a (void *) value | |||
API_EXPORT_CTOR(VoidStar, (value), | BPatch_constExpr(const void *value); | |||
BPatch_constExpr,(const void *value)); | ||||
// BPatch_constExpr::BPatch_constExpr | // BPatch_constExpr::BPatch_constExpr | |||
// Creates a representation of a (long long) value | // Creates a representation of a (long long) value | |||
API_EXPORT_CTOR(LongLong, (value), | BPatch_constExpr(long long value); | |||
BPatch_constExpr,(long long value)); | ||||
#ifdef IBM_BPATCH_COMPAT | #ifdef IBM_BPATCH_COMPAT | |||
// BPatch_constExpr::BPatch_constExpr | // BPatch_constExpr::BPatch_constExpr | |||
// Creates a representation of a (float) value | // Creates a representation of a (float) value | |||
API_EXPORT_CTOR(Float, (value), | BPatch_constExpr(float value); | |||
BPatch_constExpr,(float value)); | ||||
#endif | #endif | |||
// Should _always_ have a default constructor. This | // Should _always_ have a default constructor. This | |||
// one produces a 0 | // one produces a 0 | |||
BPatch_constExpr() : BPatch_snippet() {}; | BPatch_constExpr() : BPatch_snippet() {}; | |||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | class BPATCH_DLL_EXPORT BPatch_whileExpr : public BPatch_snippet { | |||
#undef DYNINST_CLASS_NAME | public: | |||
#endif | // BPatch_whileExpr::BPatch_whileExpr (while loop) | |||
#define DYNINST_CLASS_NAME BPatch_regExpr | BPatch_whileExpr(const BPatch_snippet &condition, | |||
const BPatch_snippet &body); | ||||
}; | ||||
class BPATCH_DLL_EXPORT BPatch_regExpr : public BPatch_snippet { | class BPATCH_DLL_EXPORT BPatch_regExpr : public BPatch_snippet { | |||
public: | ||||
// DEPRECATED!!! | // DEPRECATED!!! | |||
// BPatch_regExpr::BPatch_regExpr | // BPatch_regExpr::BPatch_regExpr | |||
// Creates a representation of the contents of a particular register | // Creates a representation of the contents of a particular register | |||
// specified by <value> | // specified by <value> | |||
API_EXPORT_CTOR(Int, (value), | BPatch_regExpr(unsigned int value); | |||
BPatch_regExpr,(unsigned int value)); | ||||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_funcCallExpr | ||||
class BPATCH_DLL_EXPORT BPatch_funcCallExpr : public BPatch_snippet { | class BPATCH_DLL_EXPORT BPatch_funcCallExpr : public BPatch_snippet { | |||
public: | ||||
// BPatch_funcCallExpr::BPatch_funcCallExpr | // BPatch_funcCallExpr::BPatch_funcCallExpr | |||
// Creates a representation of a function call | // Creates a representation of a function call | |||
API_EXPORT_CTOR(Int, (func, args), | BPatch_funcCallExpr(const BPatch_function& func, | |||
BPatch_funcCallExpr,(const BPatch_function& func, | const BPatch_Vector<BPatch_snippet *> &args); | |||
const BPatch_Vector<BPatch_snippet *> &args)); | ||||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_ifExpr | ||||
class BPATCH_DLL_EXPORT BPatch_ifExpr : public BPatch_snippet { | class BPATCH_DLL_EXPORT BPatch_ifExpr : public BPatch_snippet { | |||
public: | ||||
// BPatch_ifExpr::BPatch_ifExpr | // BPatch_ifExpr::BPatch_ifExpr | |||
// Creates a conditional expression "if <conditional> tClause;" | // Creates a conditional expression "if <conditional> tClause;" | |||
API_EXPORT_CTOR(Int, (conditional, tClause), | BPatch_ifExpr(const BPatch_boolExpr &conditional, | |||
BPatch_ifExpr,(const BPatch_boolExpr &conditional, | const BPatch_snippet &tClause); | |||
const BPatch_snippet &tClause)); | ||||
// BPatch_ifExpr::BPatch_ifExpr | // BPatch_ifExpr::BPatch_ifExpr | |||
// Creates a conditional expression | // Creates a conditional expression | |||
// "if <conditional> tClause; else fClause;" | // "if <conditional> tClause; else fClause;" | |||
API_EXPORT_CTOR(WithElse, (conditional, tClause, fClause), | BPatch_ifExpr(const BPatch_boolExpr &conditional, | |||
BPatch_ifExpr,(const BPatch_boolExpr &conditional, | ||||
const BPatch_snippet &tClause, | const BPatch_snippet &tClause, | |||
const BPatch_snippet &fClause)); | const BPatch_snippet &fClause); | |||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_nullExpr | ||||
class BPATCH_DLL_EXPORT BPatch_nullExpr : public BPatch_snippet { | class BPATCH_DLL_EXPORT BPatch_nullExpr : public BPatch_snippet { | |||
public: | ||||
// BPatch_nullExpr::BPatch_nullExpr | // BPatch_nullExpr::BPatch_nullExpr | |||
// Creates a null snippet that can be used as a placeholder. | // Creates a null snippet that can be used as a placeholder. | |||
API_EXPORT_CTOR(Int, (), | BPatch_nullExpr(); | |||
BPatch_nullExpr,()); | ||||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_paramExpr | ||||
class BPATCH_DLL_EXPORT BPatch_paramExpr : public BPatch_snippet { | class BPATCH_DLL_EXPORT BPatch_paramExpr : public BPatch_snippet { | |||
public: | ||||
// BPatch_paramExpr::BPatch_paramExpr | // BPatch_paramExpr::BPatch_paramExpr | |||
// Represents a parameter of a function (used in creating funcCallExpr ) | // Represents a parameter of a function (used in creating funcCallExpr ) | |||
// n is the index of the parameter that should be retrieved | // n is the index of the parameter that should be retrieved | |||
// loc indicates whether the parameter lookup will be added at the ca ll, | // loc indicates whether the parameter lookup will be added at the ca ll, | |||
// at the function's entry point, or whether Dyninst should guess | // at the function's entry point, or whether Dyninst should guess | |||
// based on the instPoint type, which is error-prone and deprecat ed | // based on the instPoint type, which is error-prone and deprecat ed | |||
API_EXPORT_CTOR(Int, (n,loc), | BPatch_paramExpr(int n, BPatch_ploc loc=BPatch_ploc_guess); | |||
BPatch_paramExpr,(int n, BPatch_ploc loc=BPatch_ploc_guess)); | ||||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_retExpr | ||||
class BPATCH_DLL_EXPORT BPatch_retExpr : public BPatch_snippet { | class BPATCH_DLL_EXPORT BPatch_retExpr : public BPatch_snippet { | |||
public: | ||||
// BPatch_retExpr::BPatch_retExpr | // BPatch_retExpr::BPatch_retExpr | |||
// Represents the return value from the function in which the | // Represents the return value from the function in which the | |||
// snippet is inserted | // snippet is inserted | |||
API_EXPORT_CTOR(Int, (), | BPatch_retExpr(); | |||
BPatch_retExpr,()); | ||||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_retAddrExpr | ||||
class BPATCH_DLL_EXPORT BPatch_retAddrExpr : public BPatch_snippet { | class BPATCH_DLL_EXPORT BPatch_retAddrExpr : public BPatch_snippet { | |||
public: | ||||
// BPatch_retAddrExpr::BPatch_retAddrExpr | // BPatch_retAddrExpr::BPatch_retAddrExpr | |||
// Represents the return address from the function in which the | // Represents the return address from the function in which the | |||
// snippet is inserted | // snippet is inserted | |||
API_EXPORT_CTOR(Int, (), | BPatch_retAddrExpr(); | |||
BPatch_retAddrExpr,()); | ||||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_registerExpr | ||||
class BPATCH_DLL_EXPORT BPatch_registerExpr : public BPatch_snippet { | class BPATCH_DLL_EXPORT BPatch_registerExpr : public BPatch_snippet { | |||
public: | ||||
friend class BPatch_addressSpace; | friend class BPatch_addressSpace; | |||
// BPatch_registerExpr::BPatch_registerExpr | // BPatch_registerExpr::BPatch_registerExpr | |||
// Represents the return value from the function in which the | // Represents the return value from the function in which the | |||
// snippet is inserted | // snippet is inserted | |||
API_EXPORT_CTOR(Int, (reg), | BPatch_registerExpr(BPatch_register reg); | |||
BPatch_registerExpr, (BPatch_register reg)); | BPatch_registerExpr(Dyninst::MachRegister reg); | |||
API_EXPORT_CTOR(Int, (reg), | ||||
BPatch_registerExpr, (Dyninst::MachRegister reg)); | ||||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_sequence | ||||
class BPATCH_DLL_EXPORT BPatch_sequence : public BPatch_snippet { | class BPATCH_DLL_EXPORT BPatch_sequence : public BPatch_snippet { | |||
public: | ||||
// BPatch_sequence::BPatch_sequence | // BPatch_sequence::BPatch_sequence | |||
// Represents a sequence of statements | // Represents a sequence of statements | |||
API_EXPORT_CTOR(Int, (items), | BPatch_sequence(const BPatch_Vector<BPatch_snippet *> &items); | |||
BPatch_sequence,(const BPatch_Vector<BPatch_snippet *> &items)); | ||||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_variableExpr | ||||
class BPATCH_DLL_EXPORT BPatch_variableExpr : public BPatch_snippet | class BPATCH_DLL_EXPORT BPatch_variableExpr : public BPatch_snippet | |||
{ | { | |||
friend class BPatch_process; | friend class BPatch_process; | |||
friend class BPatch_addressSpace; | friend class BPatch_addressSpace; | |||
friend class BPatch_binaryEdit; | friend class BPatch_binaryEdit; | |||
friend class BPatch_image; | friend class BPatch_image; | |||
friend class BPatch_function; | friend class BPatch_function; | |||
const char *name; | const char *name; | |||
BPatch_addressSpace *appAddSpace; | BPatch_addressSpace *appAddSpace; | |||
AddressSpace *lladdrSpace; | AddressSpace *lladdrSpace; | |||
void *address; | void *address; | |||
int size; | int size; | |||
BPatch_point *scope; | BPatch_point *scope; | |||
bool isLocal; | bool isLocal; | |||
BPatch_type *type; | BPatch_type *type; | |||
int_variable *intvar; | int_variable *intvar; | |||
AddressSpace *getAS(); | AddressSpace *getAS(); | |||
private: | ||||
// Used to get expressions for the components of a structure | // Used to get expressions for the components of a structure | |||
// Used to get function pointers | // Used to get function pointers | |||
BPatch_variableExpr(char *in_name, | BPatch_variableExpr(char *in_name, | |||
BPatch_addressSpace *in_addSpace, | BPatch_addressSpace *in_addSpace, | |||
AddressSpace *as, | AddressSpace *as, | |||
AstNodePtr ast_wrapper_, | AstNodePtr ast_wrapper_, | |||
BPatch_type *type, void* in_address); | BPatch_type *type, void* in_address); | |||
// Used to get forked copies of variable expressions | // Used to get forked copies of variable expressions | |||
// Used by malloc & malloc_by_type | // Used by malloc & malloc_by_type | |||
BPatch_variableExpr(BPatch_addressSpace *in_addSpace, | BPatch_variableExpr(BPatch_addressSpace *in_addSpace, | |||
skipping to change at line 488 | skipping to change at line 394 | |||
BPatch_localVar *lv, BPatch_type *type, | BPatch_localVar *lv, BPatch_type *type, | |||
BPatch_point *scp); | BPatch_point *scp); | |||
// BPatch_variableExpr(const char *name, BPatch_addressSpace *in_add Space, | // BPatch_variableExpr(const char *name, BPatch_addressSpace *in_add Space, | |||
// AddressSpace *ll_addSpace, void *in_address, | // AddressSpace *ll_addSpace, void *in_address, | |||
// BPatch_type *type); | // BPatch_type *type); | |||
// Used by findOrCreateVariable | // Used by findOrCreateVariable | |||
BPatch_variableExpr(BPatch_addressSpace *in_addSpace, | BPatch_variableExpr(BPatch_addressSpace *in_addSpace, | |||
AddressSpace *ll_addSpace, int_variable *iv, | AddressSpace *ll_addSpace, int_variable *iv, | |||
BPatch_type *type); | BPatch_type *type); | |||
public: | ||||
static BPatch_variableExpr* makeVariableExpr(BPatch_addressSpace* in_ad dSpace, | static BPatch_variableExpr* makeVariableExpr(BPatch_addressSpace* in_ad dSpace, | |||
int_variable* v, | int_variable* v, | |||
BPatch_type* type); | BPatch_type* type); | |||
static BPatch_variableExpr* makeVariableExpr(BPatch_addressSpace* in_ad dSpace, | static BPatch_variableExpr* makeVariableExpr(BPatch_addressSpace* in_ad dSpace, | |||
AddressSpace* in_llAddSpace , | AddressSpace* in_llAddSpace , | |||
std::string name, | std::string name, | |||
void* offset, | void* offset, | |||
BPatch_type* type); | BPatch_type* type); | |||
public: | public: | |||
// Public functions for use by users of the library: | // Public functions for use by users of the library: | |||
// BPatch_variableExpr::getSize | // BPatch_variableExpr::getSize | |||
// Returns the size (in bytes) of this variable | // Returns the size (in bytes) of this variable | |||
API_EXPORT(Int, (), | unsigned int getSize() const; | |||
unsigned int,getSize,() CONST_EXPORT); | ||||
// BPatch_variableExpr::getType | // BPatch_variableExpr::getType | |||
// Returns the type of this variable | // Returns the type of this variable | |||
API_EXPORT(Int, (), | const BPatch_type * getType(); | |||
const BPatch_type *,getType,()); | ||||
// BPatch_variableExpr::setType | // BPatch_variableExpr::setType | |||
// Sets the type of this variable | // Sets the type of this variable | |||
// XXX -- should this really be public? | // XXX -- should this really be public? | |||
API_EXPORT(Int, (t), | bool setType(BPatch_type *t); | |||
bool,setType,(BPatch_type *t)); | ||||
// BPatch_variableExpr::setSize | // BPatch_variableExpr::setSize | |||
// Sets the size of this variable | // Sets the size of this variable | |||
// XXX -- should this really be public? | // XXX -- should this really be public? | |||
API_EXPORT(Int, (sz), | bool setSize(int sz); | |||
bool,setSize,(int sz)); | ||||
// BPatch_variableExpr::readValue | // BPatch_variableExpr::readValue | |||
// Read the value of a variable in a thread's address space. | // Read the value of a variable in a thread's address space. | |||
// <dst> is assumed to be the same size as the variable. | // <dst> is assumed to be the same size as the variable. | |||
API_EXPORT(Int, (dst), | bool readValue(void *dst); | |||
bool,readValue,(void *dst)); | ||||
// BPatch_variableExpr::readValue | // BPatch_variableExpr::readValue | |||
// Read the value of a variable in a thread's address space. | // Read the value of a variable in a thread's address space. | |||
// Will read <len> bytes into <dst> | // Will read <len> bytes into <dst> | |||
API_EXPORT(WithLength, (dst, len), | bool readValue(void *dst, int len); | |||
bool,readValue,(void *dst, int len)); | ||||
// BPatch_variableExpr::writeValue | // BPatch_variableExpr::writeValue | |||
// Write a value into a variable in a thread's address space. | // Write a value into a variable in a thread's address space. | |||
// variable is assumed to be the same size as the <dst>. | // variable is assumed to be the same size as the <dst>. | |||
// returns false if the type info isn't available (i.e. we don't know the size) | // returns false if the type info isn't available (i.e. we don't know the size) | |||
API_EXPORT(Int, (src, saveWorld), | bool writeValue(const void *src, bool saveWorld=false); | |||
bool,writeValue,(const void *src, bool saveWorld=false)); | ||||
// BPatch_variableExpr::writeValue | // BPatch_variableExpr::writeValue | |||
// Write a value into a variable in a thread's address space. | // Write a value into a variable in a thread's address space. | |||
// Will write <len> bytes from <src> into variable | // Will write <len> bytes from <src> into variable | |||
API_EXPORT(WithLength, (src, len, saveWorld), | bool writeValue(const void *src, int len,bool saveWorld=false); | |||
bool,writeValue,(const void *src, int len,bool saveWorld=false)); | ||||
// BPatch_variableExpr::getName | // BPatch_variableExpr::getName | |||
// Returns the symbol table name for this variable | // Returns the symbol table name for this variable | |||
API_EXPORT(Int, (), | const char * getName(); | |||
const char *,getName,()); | ||||
// BPatch_variableExpr::getBaseAddr | // BPatch_variableExpr::getBaseAddr | |||
// Returns base address of this variable in the target's address space | // Returns base address of this variable in the target's address space | |||
API_EXPORT(Int, (), | void * getBaseAddr(); | |||
void *,getBaseAddr,()); | ||||
// BPatch_variableExpr::getComponents | // BPatch_variableExpr::getComponents | |||
// return variable expressions for all of the fields in a struct/union | // return variable expressions for all of the fields in a struct/union | |||
API_EXPORT(Int, (), | BPatch_Vector<BPatch_variableExpr *> * getComponents(); | |||
BPatch_Vector<BPatch_variableExpr *> *,getComponents,()); | ||||
#ifdef IBM_BPATCH_COMPAT | #ifdef IBM_BPATCH_COMPAT | |||
API_EXPORT(WithLength, (buffer, max), | char * getName(char *buffer, int max); | |||
char *,getName,(char *buffer, int max)); | ||||
API_EXPORT(Int, (), | void * getAddress(); | |||
void *,getAddress,()); | ||||
#endif | #endif | |||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_breakPointExpr | ||||
class BPATCH_DLL_EXPORT BPatch_breakPointExpr : public BPatch_snippet { | class BPATCH_DLL_EXPORT BPatch_breakPointExpr : public BPatch_snippet { | |||
public: | ||||
// BPatch_breakPointExpr::BPatch_breakPointExpr | // BPatch_breakPointExpr::BPatch_breakPointExpr | |||
// Creates a representation of a break point in the target process | // Creates a representation of a break point in the target process | |||
API_EXPORT_CTOR(Int, (), | BPatch_breakPointExpr(); | |||
BPatch_breakPointExpr,()); | ||||
}; | }; | |||
// VG(11/05/01): This nullary snippet will return the effective | // VG(11/05/01): This nullary snippet will return the effective | |||
// address of a memory access when inserted at an instrumentation | // address of a memory access when inserted at an instrumentation | |||
// point that is a memory access. In other words, the instruction at | // point that is a memory access. In other words, the instruction at | |||
// the point where it is inserted is the one to get effective address | // the point where it is inserted is the one to get effective address | |||
// for. Furthermore, there must be memory access information about | // for. Furthermore, there must be memory access information about | |||
// the inst. point; this basically means that the point must have been | // the inst. point; this basically means that the point must have been | |||
// created using a method that attaches that info to the point - | // created using a method that attaches that info to the point - | |||
// e.g. using findPoint(const BPatch_Set<BPatch_opCode>& ops) from | // e.g. using findPoint(const std::set<BPatch_opCode>& ops) from | |||
// BPatch_function. | // BPatch_function. | |||
// VG(7/31/02): Since x86 can have 2 addresses per instruction, there is | // VG(7/31/02): Since x86 can have 2 addresses per instruction, there is | |||
// now parameter for the constructor indicating which of these you want. | // now parameter for the constructor indicating which of these you want. | |||
// It defaults to the 1st access (#0). | // It defaults to the 1st access (#0). | |||
// VG(8/14/02): added conditional parameter | // VG(8/14/02): added conditional parameter | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_effectiveAddressExpr | ||||
class BPATCH_DLL_EXPORT BPatch_effectiveAddressExpr : public BPatch_snippet | class BPATCH_DLL_EXPORT BPatch_effectiveAddressExpr : public BPatch_snippet | |||
{ | { | |||
public: | ||||
// BPatch_effectiveAddressExpr:: BPatch_effectiveAddressExpr | // BPatch_effectiveAddressExpr:: BPatch_effectiveAddressExpr | |||
// Construct a snippet representing an effective address. | // Construct a snippet representing an effective address. | |||
API_EXPORT_CTOR(Int, (_which), | BPatch_effectiveAddressExpr(int _which = 0); | |||
BPatch_effectiveAddressExpr,(int _which = 0)); | ||||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_bytesAccessedExpr | ||||
// Number of bytes moved | // Number of bytes moved | |||
class BPATCH_DLL_EXPORT BPatch_bytesAccessedExpr : public BPatch_snippet | class BPATCH_DLL_EXPORT BPatch_bytesAccessedExpr : public BPatch_snippet | |||
{ | { | |||
public: | ||||
// BPatch_bytesAccessedExpr::BPatch_bytesAccessedExpr | // BPatch_bytesAccessedExpr::BPatch_bytesAccessedExpr | |||
// Construct a snippet representing the number of bytes accessed. | // Construct a snippet representing the number of bytes accessed. | |||
API_EXPORT_CTOR(Int, (_which), | BPatch_bytesAccessedExpr(int _which = 0); | |||
BPatch_bytesAccessedExpr,(int _which = 0)); | ||||
}; | }; | |||
// VG(8/11/2): It is possible to have a more general expression, say | // VG(8/11/2): It is possible to have a more general expression, say | |||
// machineConditionExpr, then have this reimplemented as ifExpr(machineCond itionExpr, ...), | // machineConditionExpr, then have this reimplemented as ifExpr(machineCond itionExpr, ...), | |||
// and have an optimization (fast path) for that case using the specialized | // and have an optimization (fast path) for that case using the specialized | |||
// AST that supports this class. Memory instrumentation has no need for a s tandalone | // AST that supports this class. Memory instrumentation has no need for a s tandalone | |||
// machineConditionExpr, so that remains TBD... | // machineConditionExpr, so that remains TBD... | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_ifMachineConditionExpr | ||||
class BPATCH_DLL_EXPORT BPatch_ifMachineConditionExpr : public BPatch_snipp et { | class BPATCH_DLL_EXPORT BPatch_ifMachineConditionExpr : public BPatch_snipp et { | |||
public: | ||||
// BPatch_ifMachineConditionExpr::BPatch_ifMachineConditionExpr | // BPatch_ifMachineConditionExpr::BPatch_ifMachineConditionExpr | |||
// | // | |||
API_EXPORT_CTOR(Int, (tClause), | BPatch_ifMachineConditionExpr(const BPatch_snippet &tClause); | |||
BPatch_ifMachineConditionExpr,(const BPatch_snippet &tClause)); | ||||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_threadIndexExpr | ||||
class BPATCH_DLL_EXPORT BPatch_threadIndexExpr : public BPatch_snippet { | class BPATCH_DLL_EXPORT BPatch_threadIndexExpr : public BPatch_snippet { | |||
public: | ||||
// | // | |||
// BPatch_threadIndexExpr::BPatch_threadIndexExpr | // BPatch_threadIndexExpr::BPatch_threadIndexExpr | |||
API_EXPORT_CTOR(Int, (), | BPatch_threadIndexExpr(); | |||
BPatch_threadIndexExpr,()); | ||||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_tidExpr | ||||
class BPATCH_DLL_EXPORT BPatch_tidExpr : public BPatch_snippet { | class BPATCH_DLL_EXPORT BPatch_tidExpr : public BPatch_snippet { | |||
public: | ||||
// | // | |||
// BPatch_tidExpr::BPatch_tidExpr | // BPatch_tidExpr::BPatch_tidExpr | |||
API_EXPORT_CTOR(Int, (proc), | BPatch_tidExpr(BPatch_process *proc); | |||
BPatch_tidExpr,(BPatch_process *proc)); | ||||
}; | }; | |||
class BPatch_instruction; | class BPatch_instruction; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_insnExpr | ||||
class BPATCH_DLL_EXPORT BPatch_insnExpr : public BPatch_snippet { | class BPATCH_DLL_EXPORT BPatch_insnExpr : public BPatch_snippet { | |||
public: | ||||
// | // | |||
// BPatch_insnExpr::BPatch_insnExpr | // BPatch_insnExpr::BPatch_insnExpr | |||
API_EXPORT_CTOR(Int, (insn), | BPatch_insnExpr(BPatch_instruction *insn); | |||
BPatch_insnExpr,(BPatch_instruction *insn)); | ||||
// Replace the effective address of a load with the provided snippet | // Replace the effective address of a load with the provided snippet | |||
API_EXPORT(Int, (l), | bool overrideLoadAddress(BPatch_snippet &l); | |||
bool, overrideLoadAddress, (BPatch_snippet &l)); | ||||
// Replace the effective address of a store with the provided snippet | // Replace the effective address of a store with the provided snippet | |||
API_EXPORT(Int, (s), | bool overrideStoreAddress(BPatch_snippet &s); | |||
bool, overrideStoreAddress, (BPatch_snippet &s)); | ||||
}; | }; | |||
typedef enum { | typedef enum { | |||
BPatch_noInterp, | BPatch_noInterp, | |||
BPatch_interpAsTarget, | BPatch_interpAsTarget, | |||
BPatch_interpAsReturnAddr, | BPatch_interpAsReturnAddr, | |||
} BPatch_stInterpret; | } BPatch_stInterpret; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_shadowExpr | ||||
class BPATCH_DLL_EXPORT BPatch_shadowExpr : public BPatch_snippet { | class BPATCH_DLL_EXPORT BPatch_shadowExpr : public BPatch_snippet { | |||
public: | ||||
// BPatch_stopThreadExpr | // BPatch_stopThreadExpr | |||
// This snippet type stops the thread that executes it. It | // This snippet type stops the thread that executes it. It | |||
// evaluates a calculation snippet and triggers a callback to the | // evaluates a calculation snippet and triggers a callback to the | |||
// user program with the result of the calculation and a pointer to | // user program with the result of the calculation and a pointer to | |||
// the BPatch_point at which the snippet was inserted | // the BPatch_point at which the snippet was inserted | |||
API_EXPORT_CTOR(Int, (entry, cb, calculation, useCache, interp), | BPatch_shadowExpr(bool entry, | |||
BPatch_shadowExpr, | const BPatchStopThreadCallback &cb, | |||
(bool entry, | const BPatch_snippet &calculation, | |||
const BPatchStopThreadCallback &cb, | bool useCache = false, | |||
const BPatch_snippet &calculation, | BPatch_stInterpret interp = BPatch_noInterp); | |||
bool useCache = false, | ||||
BPatch_stInterpret interp = BPatch_noInterp)); | ||||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_stopThreadExpr | ||||
class BPATCH_DLL_EXPORT BPatch_stopThreadExpr : public BPatch_snippet { | class BPATCH_DLL_EXPORT BPatch_stopThreadExpr : public BPatch_snippet { | |||
public: | ||||
// BPatch_stopThreadExpr | // BPatch_stopThreadExpr | |||
// This snippet type stops the thread that executes it. It | // This snippet type stops the thread that executes it. It | |||
// evaluates a calculation snippet and triggers a callback to the | // evaluates a calculation snippet and triggers a callback to the | |||
// user program with the result of the calculation and a pointer to | // user program with the result of the calculation and a pointer to | |||
// the BPatch_point at which the snippet was inserted | // the BPatch_point at which the snippet was inserted | |||
API_EXPORT_CTOR(Int, (cb, calculation, useCache, interp), | BPatch_stopThreadExpr(const BPatchStopThreadCallback &cb, | |||
BPatch_stopThreadExpr, | const BPatch_snippet &calculation, | |||
(const BPatchStopThreadCallback &cb, | bool useCache = false, | |||
const BPatch_snippet &calculation, | BPatch_stInterpret interp = BPatch_noInterp); | |||
bool useCache = false, | ||||
BPatch_stInterpret interp = BPatch_noInterp)); | ||||
// for internal use in conjunction with memory emulation and defensive | // for internal use in conjunction with memory emulation and defensive | |||
// mode analysis | // mode analysis | |||
BPatch_stopThreadExpr( | BPatch_stopThreadExpr( | |||
const BPatchStopThreadCallback &cb, | const BPatchStopThreadCallback &cb, | |||
const BPatch_snippet &calculation, | const BPatch_snippet &calculation, | |||
const mapped_object &obj, | const mapped_object &obj, | |||
bool useCache = false, | bool useCache = false, | |||
BPatch_stInterpret interp = BPatch_noInterp); | BPatch_stInterpret interp = BPatch_noInterp); | |||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_originalAddressExpr | ||||
class BPATCH_DLL_EXPORT BPatch_originalAddressExpr : public BPatch_snippet | class BPATCH_DLL_EXPORT BPatch_originalAddressExpr : public BPatch_snippet | |||
{ | { | |||
public: | ||||
// BPatch_originalAddressExpr | // BPatch_originalAddressExpr | |||
// Construct a snippet representing the original address of an | // Construct a snippet representing the original address of an | |||
// instruction | // instruction | |||
API_EXPORT_CTOR(Int, (), | BPatch_originalAddressExpr(); | |||
BPatch_originalAddressExpr, ()); | ||||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_actualAddressExpr | ||||
class BPATCH_DLL_EXPORT BPatch_actualAddressExpr : public BPatch_snippet | class BPATCH_DLL_EXPORT BPatch_actualAddressExpr : public BPatch_snippet | |||
{ | { | |||
public: | ||||
// BPatch_actualAddressExpr | // BPatch_actualAddressExpr | |||
// Construct a snippet representing the actual (relocated) address | // Construct a snippet representing the actual (relocated) address | |||
// where the snippet was executed. | // where the snippet was executed. | |||
API_EXPORT_CTOR(Int, (), | BPatch_actualAddressExpr(); | |||
BPatch_actualAddressExpr, ()); | ||||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_dynamicTargetExpr | ||||
class BPATCH_DLL_EXPORT BPatch_dynamicTargetExpr : public BPatch_snippet | class BPATCH_DLL_EXPORT BPatch_dynamicTargetExpr : public BPatch_snippet | |||
{ | { | |||
public: | ||||
// BPatch_dynamicTargetExpr | // BPatch_dynamicTargetExpr | |||
// Construct a snippet to calculate the target of a | // Construct a snippet to calculate the target of a | |||
// dynamic control transfer instruction | // dynamic control transfer instruction | |||
API_EXPORT_CTOR(Int, (), | BPatch_dynamicTargetExpr(); | |||
BPatch_dynamicTargetExpr, ()); | ||||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_scrambleRegistersExpr | ||||
class BPATCH_DLL_EXPORT BPatch_scrambleRegistersExpr : public BPatch_snippe t | class BPATCH_DLL_EXPORT BPatch_scrambleRegistersExpr : public BPatch_snippe t | |||
{ | { | |||
// BPatch_scrambleRegistersExpr | // BPatch_scrambleRegistersExpr | |||
// Set all GPR to flag value. | // Set all GPR to flag value. | |||
API_EXPORT_CTOR(Int, (), | BPatch_scrambleRegistersExpr(); | |||
BPatch_scrambleRegistersExpr, ()); | ||||
}; | }; | |||
#endif /* _BPatch_snippet_h_ */ | #endif /* _BPatch_snippet_h_ */ | |||
End of changes. 121 change blocks. | ||||
291 lines changed or deleted | 104 lines changed or added | |||
BPatch_sourceBlock.h | BPatch_sourceBlock.h | |||
---|---|---|---|---|
skipping to change at line 36 | skipping to change at line 36 | |||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | */ | |||
#ifndef _BPatch_sourceBlock_h_ | #ifndef _BPatch_sourceBlock_h_ | |||
#define _BPatch_sourceBlock_h_ | #define _BPatch_sourceBlock_h_ | |||
#include "BPatch_dll.h" | #include "BPatch_dll.h" | |||
#include "BPatch_Vector.h" | #include "BPatch_Vector.h" | |||
#include "BPatch_Set.h" | #include <set> | |||
#include "BPatch_eventLock.h" | ||||
#ifdef IBM_BPATCH_COMPAT | #ifdef IBM_BPATCH_COMPAT | |||
class BPatch_point; | class BPatch_point; | |||
#endif | #endif | |||
/** this class represents the basic blocks in the source | /** this class represents the basic blocks in the source | |||
* code. The source code basic blocks are calculated according to the | * code. The source code basic blocks are calculated according to the | |||
* machine code basic blocks. The constructors can be called by only | * machine code basic blocks. The constructors can be called by only | |||
* BPatch_flowGraph class since we do not want to make the user | * BPatch_flowGraph class since we do not want to make the user | |||
* create source blocks that does not exist and we do not want the user | * create source blocks that does not exist and we do not want the user | |||
* to change the start and end line numbers of the source block | * to change the start and end line numbers of the source block | |||
* | * | |||
* @see BPatch_flowGraph | * @see BPatch_flowGraph | |||
* @see BPatch_basicBlock | * @see BPatch_basicBlock | |||
*/ | */ | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_sourceBlock | ||||
class BPATCH_DLL_EXPORT BPatch_sourceBlock : public BPatch_eventLock { | class BPATCH_DLL_EXPORT BPatch_sourceBlock { | |||
friend class BPatch_flowGraph; | friend class BPatch_flowGraph; | |||
friend std::ostream& operator<<(std::ostream&,BPatch_sourceBlock&); | friend std::ostream& operator<<(std::ostream&,BPatch_sourceBlock&); | |||
private: | private: | |||
const char* sourceFile; | const char* sourceFile; | |||
BPatch_Set<unsigned short>* sourceLines; | std::set<unsigned short> sourceLines; | |||
public: | public: | |||
/** method to return source file name | /** method to return source file name | |||
* @param i the number of source file requested */ | * @param i the number of source file requested */ | |||
API_EXPORT(Int, (), | const char* getSourceFile(); | |||
const char *,getSourceFile,()); | ||||
/** method to return source lines in the | /** method to return source lines in the | |||
* corresponding source file | * corresponding source file | |||
* @param i the number of source file requested */ | * @param i the number of source file requested */ | |||
API_EXPORT_V(Int, (lines), | void getSourceLines(BPatch_Vector<unsigned short> &lines); | |||
void,getSourceLines,(BPatch_Vector<unsigned short> &lines)); | ||||
/** destructor for the sourceBlock class */ | /** destructor for the sourceBlock class */ | |||
virtual ~BPatch_sourceBlock() {} | virtual ~BPatch_sourceBlock() {} | |||
#ifdef IBM_BPATCH_COMPAT | #ifdef IBM_BPATCH_COMPAT | |||
API_EXPORT(Int, (_startAddress, _endAddress), | bool getAddressRange(void*& _startAddress, void*& _endAddress); | |||
bool,getAddressRange,(void*& _startAddress, void*& _endAddress)); | ||||
API_EXPORT(Int, (_startLine, _endLine), | bool getLineNumbers(unsigned int &_startLine, unsigned int &_endLi | |||
bool,getLineNumbers,(unsigned int &_startLine, unsigned int &_endL | ne); | |||
ine)); | ||||
API_EXPORT_V(Int, (vect), | void getExcPoints(BPatch_Vector<BPatch_point *> &vect); | |||
void,getExcPoints,(BPatch_Vector<BPatch_point *> &vect)); | ||||
API_EXPORT_V(Int, (vect), | void getIncPoints(BPatch_Vector<BPatch_point *> &vect); | |||
void,getIncPoints,(BPatch_Vector<BPatch_point *> &vect)); | ||||
API_EXPORT(Int, (buf, buflen), | char * getName(char *buf, int buflen); | |||
char *,getName,(char *buf, int buflen)); | ||||
#endif | #endif | |||
private: | private: | |||
/** constructor of the class */ | /** constructor of the class */ | |||
BPatch_sourceBlock(); | BPatch_sourceBlock(); | |||
BPatch_sourceBlock(const char*,BPatch_Set<unsigned short>&); | BPatch_sourceBlock(const char*,std::set<unsigned short>&); | |||
}; | }; | |||
#endif /* _BPatch_sourceBlock_h_ */ | #endif /* _BPatch_sourceBlock_h_ */ | |||
End of changes. 12 change blocks. | ||||
24 lines changed or deleted | 12 lines changed or added | |||
BPatch_statement.h | BPatch_statement.h | |||
---|---|---|---|---|
skipping to change at line 35 | skipping to change at line 35 | |||
* | * | |||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | */ | |||
#ifndef _BPATCH_STATEMENT_H_ | #ifndef _BPATCH_STATEMENT_H_ | |||
#define _BPATCH_STATEMENT_H_ | #define _BPATCH_STATEMENT_H_ | |||
#include "BPatch_dll.h" | #include "BPatch_dll.h" | |||
#include "BPatch_eventLock.h" | ||||
class BPatch_module; | class BPatch_module; | |||
namespace Dyninst { | namespace Dyninst { | |||
namespace SymtabAPI { | namespace SymtabAPI { | |||
class Statement; | class Statement; | |||
} | } | |||
} | } | |||
class BPATCH_DLL_EXPORT BPatch_statement : public BPatch_eventLock | class BPATCH_DLL_EXPORT BPatch_statement | |||
{ | { | |||
friend class BPatch_module; | friend class BPatch_module; | |||
friend class BPatch_image; | friend class BPatch_image; | |||
public: | public: | |||
// BPatch_module * getModule() | // BPatch_module * getModule() | |||
// Return the BPatch_module that contains this statement | // Return the BPatch_module that contains this statement | |||
BPatch_module * module(); | BPatch_module * module(); | |||
// int getLineNumber() | // int getLineNumber() | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 1 lines changed or added | |||
BPatch_thread.h | BPatch_thread.h | |||
---|---|---|---|---|
skipping to change at line 40 | skipping to change at line 40 | |||
#ifndef _BPatch_thread_h_ | #ifndef _BPatch_thread_h_ | |||
#define _BPatch_thread_h_ | #define _BPatch_thread_h_ | |||
#include <stdio.h> | #include <stdio.h> | |||
#include "BPatch_dll.h" | #include "BPatch_dll.h" | |||
#include "BPatch_Vector.h" | #include "BPatch_Vector.h" | |||
#include "BPatch_image.h" | #include "BPatch_image.h" | |||
#include "BPatch_snippet.h" | #include "BPatch_snippet.h" | |||
#include "BPatch_eventLock.h" | ||||
#include "BPatch_addressSpace.h" | #include "BPatch_addressSpace.h" | |||
#include "BPatch_process.h" | #include "BPatch_process.h" | |||
#include "BPatch_frame.h" | #include "BPatch_frame.h" | |||
class PCProcess; | class PCProcess; | |||
class BPatch; | class BPatch; | |||
class BPatch_thread; | class BPatch_thread; | |||
class BPatch_process; | class BPatch_process; | |||
class BPatch_statement; | class BPatch_statement; | |||
class PCThread; | class PCThread; | |||
typedef Dyninst::THR_ID dynthread_t; | typedef Dyninst::THR_ID dynthread_t; | |||
/* | /* | |||
* Represents a thread of execution. | * Represents a thread of execution. | |||
*/ | */ | |||
#ifdef DYNINST_CLASS_NAME | ||||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_thread | ||||
class BPATCH_DLL_EXPORT BPatch_thread : public BPatch_eventLock { | class BPATCH_DLL_EXPORT BPatch_thread { | |||
friend class BPatch_frame; | friend class BPatch_frame; | |||
friend class BPatch_process; | friend class BPatch_process; | |||
friend class BPatch_addressSpace; | friend class BPatch_addressSpace; | |||
friend class BPatch; | friend class BPatch; | |||
BPatch_process *proc; | BPatch_process *proc; | |||
PCThread *llthread; | PCThread *llthread; | |||
// Sometimes we get per-thread exit notifications, sometimes we | // Sometimes we get per-thread exit notifications, sometimes we | |||
// just get whole-process. So keep track of whether we've notified | // just get whole-process. So keep track of whether we've notified | |||
// the user of an exit so we don't duplicate when the process exits. | // the user of an exit so we don't duplicate when the process exits. | |||
skipping to change at line 91 | skipping to change at line 86 | |||
// Currently only used on an exec to replace the underlying PCThread | // Currently only used on an exec to replace the underlying PCThread | |||
void updateThread(PCThread *newThr); | void updateThread(PCThread *newThr); | |||
bool madeExitCallback() { return madeExitCallback_; } | bool madeExitCallback() { return madeExitCallback_; } | |||
void setMadeExitCallback() { madeExitCallback_ = true; } | void setMadeExitCallback() { madeExitCallback_ = true; } | |||
public: | public: | |||
// BPatch_thread::getCallStack | // BPatch_thread::getCallStack | |||
// Returns a vector of BPatch_frame, representing the current call sta ck | // Returns a vector of BPatch_frame, representing the current call sta ck | |||
API_EXPORT(Int, (stack), | bool getCallStack(BPatch_Vector<BPatch_frame>& stack); | |||
bool,getCallStack,(BPatch_Vector<BPatch_frame>& stack)); | ||||
// BPatch_thread::getProcess | // BPatch_thread::getProcess | |||
// Returns a pointer to the process that owns this thread | // Returns a pointer to the process that owns this thread | |||
API_EXPORT(Int, (), | BPatch_process * getProcess(); | |||
BPatch_process *, getProcess, ()); | ||||
API_EXPORT(Int, (), | dynthread_t getTid(); | |||
dynthread_t, getTid, ()); | ||||
API_EXPORT(Int, (), | Dyninst::LWP getLWP(); | |||
Dyninst::LWP, getLWP, ()); | ||||
API_EXPORT(Int, (), | unsigned getBPatchID(); | |||
unsigned, getBPatchID, ()); | ||||
API_EXPORT(Int, (), | BPatch_function * getInitialFunc(); | |||
BPatch_function *, getInitialFunc, ()); | ||||
API_EXPORT(Int, (), | unsigned long getStackTopAddr(); | |||
unsigned long, getStackTopAddr, ()); | ||||
API_EXPORT(Int, (), | bool isDeadOnArrival(); | |||
bool, isDeadOnArrival, ()); | ||||
API_EXPORT_DTOR(_dtor, (), | ~BPatch_thread(); | |||
~,BPatch_thread,()); | ||||
API_EXPORT(Int, (), | unsigned long os_handle(); | |||
unsigned long, os_handle, ()); | ||||
// BPatch_thread::oneTimeCode | // BPatch_thread::oneTimeCode | |||
// Have mutatee execute specified code expr once. Wait until done. | // Have mutatee execute specified code expr once. Wait until done. | |||
API_EXPORT(Int, (expr, err), | void * oneTimeCode(const BPatch_snippet &expr, bool *err = NULL); | |||
void *,oneTimeCode,(const BPatch_snippet &expr, bool *err = NULL)); | ||||
// BPatch_thread::oneTimeCodeAsync | // BPatch_thread::oneTimeCodeAsync | |||
// Have mutatee execute specified code expr once. Dont wait until don e. | // Have mutatee execute specified code expr once. Dont wait until don e. | |||
API_EXPORT(Int, (expr, userData, cb), | bool oneTimeCodeAsync(const BPatch_snippet &expr, void *userData = NULL | |||
bool,oneTimeCodeAsync,(const BPatch_snippet &expr, void *userData = NUL | , BPatchOneTimeCodeCallback cb = NULL); | |||
L, BPatchOneTimeCodeCallback cb = NULL)); | ||||
}; | }; | |||
#endif /* BPatch_thread_h_ */ | #endif /* BPatch_thread_h_ */ | |||
End of changes. 15 change blocks. | ||||
31 lines changed or deleted | 14 lines changed or added | |||
BPatch_type.h | BPatch_type.h | |||
---|---|---|---|---|
skipping to change at line 36 | skipping to change at line 36 | |||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | */ | |||
#ifndef _BPatch_type_h_ | #ifndef _BPatch_type_h_ | |||
#define _BPatch_type_h_ | #define _BPatch_type_h_ | |||
#include "BPatch_dll.h" | #include "BPatch_dll.h" | |||
#include "BPatch_Vector.h" | #include "BPatch_Vector.h" | |||
#include "BPatch_eventLock.h" | ||||
#include <string.h> | #include <string.h> | |||
#include "Type.h" | #include "Type.h" | |||
#include "Variable.h" | #include "Variable.h" | |||
class BPatch_type; | class BPatch_type; | |||
namespace Dyninst { | namespace Dyninst { | |||
namespace SymtabAPI { | namespace SymtabAPI { | |||
class Type; | class Type; | |||
Type *convert(const BPatch_type *); | BPATCH_DLL_EXPORT Type *convert(const BPatch_type *); | |||
} | } | |||
} | } | |||
typedef enum {BPatchSymLocalVar, BPatchSymGlobalVar, BPatchSymRegisterVar, | typedef enum {BPatchSymLocalVar, BPatchSymGlobalVar, BPatchSymRegisterVar, | |||
BPatchSymStaticLocalVar, BPatchSymStaticGlobal, | BPatchSymStaticLocalVar, BPatchSymStaticGlobal, | |||
BPatchSymLocalFunc, BPatchSymGlobalFunc, BPatchSymFuncParam, | BPatchSymLocalFunc, BPatchSymGlobalFunc, BPatchSymFuncParam, | |||
BPatchSymTypeName, BPatchSymAggType, BPatchSymTypeTag}symDescr _t; | BPatchSymTypeName, BPatchSymAggType, BPatchSymTypeTag}symDescr _t; | |||
/* | /* | |||
* Symbol Descriptors: | * Symbol Descriptors: | |||
skipping to change at line 163 | skipping to change at line 162 | |||
* BPatch_storageRegOffset - Address of variable = $reg + address. | * BPatch_storageRegOffset - Address of variable = $reg + address. | |||
* BPatch_storageFrameOffset - Address of variable = $fp + address. | * BPatch_storageFrameOffset - Address of variable = $fp + address. | |||
*/ | */ | |||
class BPatch_type; | class BPatch_type; | |||
class BPatch_function; | class BPatch_function; | |||
class BPatch_module; | class BPatch_module; | |||
/* | /* | |||
* A BPatch_field is equivalent to a field in a enum, struct, or union. | * A BPatch_field is equivalent to a field in a enum, struct, or union. | |||
* A field can be an atomic type, i.e, int, char, or more complex like a | * A field can be an atomic type, i.e, int char, or more complex like a | |||
* union or struct. | * union or struct. | |||
*/ | */ | |||
#ifdef DYNINST_CLASS_NAME | class BPATCH_DLL_EXPORT BPatch_field { | |||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_field | ||||
class BPATCH_DLL_EXPORT BPatch_field : public BPatch_eventLock{ | ||||
friend class BPatch_variableExpr; | friend class BPatch_variableExpr; | |||
friend class BPatch_cblock; | friend class BPatch_cblock; | |||
BPatch_dataClass typeDes; | BPatch_dataClass typeDes; | |||
/* For Enums */ | /* For Enums */ | |||
int value; | int value; | |||
/* For structs and unions */ | /* For structs and unions */ | |||
int size; | int size; | |||
//Symtab field | //Symtab field | |||
Dyninst::SymtabAPI::Field *fld; | Dyninst::SymtabAPI::Field *fld; | |||
protected: | protected: | |||
void copy(BPatch_field &); | void copy(BPatch_field &); | |||
void fixupUnknown(BPatch_module *); | void fixupUnknown(BPatch_module *); | |||
public: | public: | |||
/* | ||||
// Enum constructor | ||||
API_EXPORT_CTOR(Enum, (fName, _typeDes, eValue), | ||||
BPatch_field,(const char * fName, BPatch_dataClass _typeDes, int eValue) | ||||
); | ||||
// C++ version for Enum constructor | ||||
API_EXPORT_CTOR(EnumCpp, (fName, _typeDes, eValue, _vis), | ||||
BPatch_field, (const char * fName, BPatch_dataClass _typeDes, int eValue | ||||
, | ||||
BPatch_visibility _vis)); | ||||
// Struct or Union construct | ||||
API_EXPORT_CTOR(SU, (fName, _typeDes, suType, suOffset, suSize), | ||||
BPatch_field,(const char * fName, BPatch_dataClass _typeDes, | ||||
BPatch_type *suType, int suOffset, int suSize)); | ||||
// C++ version for Struct or Union construct | ||||
API_EXPORT_CTOR(SUCpp, (fName, _typeDes, suType, suOffset, suSize, _vis), | ||||
BPatch_field,(const char * fName, BPatch_dataClass _typeDes, | ||||
BPatch_type *suType, int suOffset, int suSize, | ||||
BPatch_visibility _vis)); | ||||
*/ | ||||
// Copy constructor | // Copy constructor | |||
BPatch_field(BPatch_field &f); | BPatch_field(BPatch_field &f); | |||
BPatch_field(Dyninst::SymtabAPI::Field *fld_ = NULL, BPatch_dataClass typ | BPatch_field(Dyninst::SymtabAPI::Field *fld_ = NULL, | |||
eDescriptor = BPatch_dataUnknownType, int value_ = 0, int size_ = 0); | BPatch_dataClass typeDescriptor = BPatch_dataUnknownType, | |||
int value_ = 0, | ||||
API_EXPORT_DTOR(_dtor,(), | int size_ = 0); | |||
~,BPatch_field,()); | ||||
API_EXPORT_OPER(_equals, (src), | ~BPatch_field(); | |||
BPatch_field &,operator=,(BPatch_field &src)); | ||||
#ifdef NOTDEF | BPatch_field & operator=(BPatch_field &src); | |||
API_EXPORT_OPER(_equals_equals, (src), | ||||
bool ,operator==,(const BPatch_field &src)); | ||||
#endif | ||||
API_EXPORT(Int, (), | const char * getName(); | |||
const char *,getName,()); | ||||
API_EXPORT(Int, (), | BPatch_type * getType(); | |||
BPatch_type *,getType,()); | ||||
API_EXPORT(Int, (), | int getValue(); | |||
int,getValue,()); | ||||
API_EXPORT(Int, (), | BPatch_visibility getVisibility(); | |||
BPatch_visibility,getVisibility,()); | ||||
API_EXPORT(Int, (), | BPatch_dataClass getTypeDesc(); | |||
BPatch_dataClass,getTypeDesc,()); | ||||
API_EXPORT(Int, (), | int getSize(); | |||
int,getSize,()); | ||||
API_EXPORT(Int, (), | int getOffset(); | |||
int,getOffset,()); | ||||
}; | }; | |||
// | // | |||
// Define an instance of a Common block. Each subroutine can have its own | // Define an instance of a Common block. Each subroutine can have its own | |||
// version of the common block. | // version of the common block. | |||
// | // | |||
#ifdef DYNINST_CLASS_NAME | #ifdef DYNINST_CLASS_NAME | |||
#undef DYNINST_CLASS_NAME | #undef DYNINST_CLASS_NAME | |||
#endif | #endif | |||
#define DYNINST_CLASS_NAME BPatch_cblock | #define DYNINST_CLASS_NAME BPatch_cblock | |||
class BPATCH_DLL_EXPORT BPatch_cblock : public BPatch_eventLock{ | class BPATCH_DLL_EXPORT BPatch_cblock { | |||
private: | private: | |||
// the list of fields | // the list of fields | |||
BPatch_Vector<BPatch_field *> fieldList; | BPatch_Vector<BPatch_field *> fieldList; | |||
// which functions use this list | // which functions use this list | |||
BPatch_Vector<BPatch_function *> functions; | BPatch_Vector<BPatch_function *> functions; | |||
Dyninst::SymtabAPI::CBlock *cBlk; | Dyninst::SymtabAPI::CBlock *cBlk; | |||
void fixupUnknowns(BPatch_module *); | void fixupUnknowns(BPatch_module *); | |||
public: | public: | |||
BPatch_cblock(Dyninst::SymtabAPI::CBlock *cBlk_); | BPatch_cblock(Dyninst::SymtabAPI::CBlock *cBlk_); | |||
BPatch_cblock() {} | BPatch_cblock() {} | |||
API_EXPORT(Int, (), | BPatch_Vector<BPatch_field *> * getComponents(); | |||
BPatch_Vector<BPatch_field *> *,getComponents,()); | BPatch_Vector<BPatch_function *> * getFunctions(); | |||
API_EXPORT(Int, (), | ||||
BPatch_Vector<BPatch_function *> *,getFunctions,()); | ||||
}; | }; | |||
#ifdef DYNINST_CLASS_NAME | class BPATCH_DLL_EXPORT BPatch_type{ | |||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_type | ||||
class BPATCH_DLL_EXPORT BPatch_type : public BPatch_eventLock{ | ||||
friend class BPatch; | friend class BPatch; | |||
friend class BPatch_module; | friend class BPatch_module; | |||
friend class BPatch_function; | friend class BPatch_function; | |||
friend class BPatch_typeCollection; | friend class BPatch_typeCollection; | |||
friend class BPatch_localVar; | friend class BPatch_localVar; | |||
friend class BPatch_field; | friend class BPatch_field; | |||
friend class BPatch_addressSpace; | friend class BPatch_addressSpace; | |||
protected: | protected: | |||
int ID; /* unique ID of type */ | int ID; /* unique ID of type */ | |||
static std::map<Dyninst::SymtabAPI::Type*, BPatch_type *> type_map; | static std::map<Dyninst::SymtabAPI::Type*, BPatch_type *> type_map; | |||
BPatch_dataClass type_; | BPatch_dataClass type_; | |||
//Symtab type | //Symtab type | |||
Dyninst::SymtabAPI::Type *typ; | Dyninst::SymtabAPI::Type *typ; | |||
/* For common blocks */ | /* For common blocks */ | |||
static int USER_BPATCH_TYPE_ID; | static int USER_BPATCH_TYPE_ID; | |||
// INTERNAL DATA MEMBERS | // INTERNAL DATA MEMBERS | |||
skipping to change at line 326 | skipping to change at line 285 | |||
static BPatch_type *createPlaceholder(int _ID, const char *_name = NULL) | static BPatch_type *createPlaceholder(int _ID, const char *_name = NULL) | |||
{ return new BPatch_type(_name, _ID, BPatch_dataUnknownType); } | { return new BPatch_type(_name, _ID, BPatch_dataUnknownType); } | |||
public: | public: | |||
BPatch_type(const char *name = NULL, int _ID = 0, BPatch_dataClass = BPat ch_dataNullType); | BPatch_type(const char *name = NULL, int _ID = 0, BPatch_dataClass = BPat ch_dataNullType); | |||
BPatch_type(Dyninst::SymtabAPI::Type *typ_); | BPatch_type(Dyninst::SymtabAPI::Type *typ_); | |||
virtual bool operator==(const BPatch_type &) const; | virtual bool operator==(const BPatch_type &) const; | |||
int getID() const { return ID;} | int getID() const { return ID;} | |||
API_EXPORT(Int, (), | unsigned int getSize(); | |||
unsigned int,getSize,()); | ||||
Dyninst::SymtabAPI::Type *getSymtabType() const; | Dyninst::SymtabAPI::Type *getSymtabType() const; | |||
//Define all of these in .C | //Define all of these in .C | |||
const char *getName() const; | const char *getName() const; | |||
#ifdef IBM_BPATCH_COMPAT | #ifdef IBM_BPATCH_COMPAT | |||
char *getName(char *buffer, int max) const; | char *getName(char *buffer, int max) const; | |||
BPatch_dataClass type() const { return type_; } | BPatch_dataClass type() const { return type_; } | |||
#endif | #endif | |||
BPatch_dataClass getDataClass() const { return type_; } | BPatch_dataClass getDataClass() const { return type_; } | |||
unsigned long getLow() const; | unsigned long getLow() const; | |||
unsigned long getHigh() const; | unsigned long getHigh() const; | |||
BPatch_Vector<BPatch_field *> * getComponents() const; | BPatch_Vector<BPatch_field *> * getComponents() const; | |||
API_EXPORT(Int, (otype), | bool isCompatible(BPatch_type * otype); | |||
bool, isCompatible, (BPatch_type * otype)); | ||||
BPatch_type *getConstituentType() const; | BPatch_type *getConstituentType() const; | |||
BPatch_Vector<BPatch_cblock *> *getCblocks() const; | BPatch_Vector<BPatch_cblock *> *getCblocks() const; | |||
// INTERNAL METHODS | // INTERNAL METHODS | |||
void incrRefCount() { ++refCount; } | void incrRefCount() { ++refCount; } | |||
void decrRefCount() { assert(refCount > 0); if (!--refCount) delete this; } | void decrRefCount() { assert(refCount > 0); if (!--refCount) delete this; } | |||
void fixupUnknowns(BPatch_module *) { } | void fixupUnknowns(BPatch_module *) { } | |||
}; | }; | |||
// | // | |||
// This class stores information about local variables. | // This class stores information about local variables. | |||
// It is desgined store information about a variable in a function. | // It is desgined store information about a variable in a function. | |||
// Scope needs to be addressed in this class. | // Scope needs to be addressed in this class. | |||
#ifdef DYNINST_CLASS_NAME | class BPATCH_DLL_EXPORT BPatch_localVar{ | |||
#undef DYNINST_CLASS_NAME | ||||
#endif | ||||
#define DYNINST_CLASS_NAME BPatch_localVar | ||||
class BPATCH_DLL_EXPORT BPatch_localVar : public BPatch_eventLock{ | ||||
friend class BPatch; | friend class BPatch; | |||
friend class BPatch_function; | friend class BPatch_function; | |||
BPatch_type *type; | BPatch_type *type; | |||
BPatch_storageClass storageClass; | BPatch_storageClass storageClass; | |||
// scope_t scope; | // scope_t scope; | |||
Dyninst::SymtabAPI::localVar *lVar; | Dyninst::SymtabAPI::localVar *lVar; | |||
public: | public: | |||
End of changes. 22 change blocks. | ||||
74 lines changed or deleted | 24 lines changed or added | |||
Buffer.h | Buffer.h | |||
---|---|---|---|---|
skipping to change at line 30 | skipping to change at line 30 | |||
* | * | |||
* This library is distributed in the hope that it will be useful, | * This library is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | * Lesser General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | */ | |||
#if !defined(PATCHAPI_H_BUFFER_H_) | #if !defined(_BUFFER_H_) | |||
#define PATCHAPI_H_BUFFER_H_ | #define _BUFFER_H_ | |||
#include <assert.h> | #include <assert.h> | |||
#include <string.h> | #include <string.h> | |||
#include "dyntypes.h" | #include "dyntypes.h" | |||
namespace Dyninst { | namespace Dyninst { | |||
namespace PatchAPI { | ||||
// A class to support multiple forms of code generation. The design of this class is as | // A class to support multiple forms of code generation. The design of this class is as | |||
// a tiered model: | // a tiered model: | |||
// Tier 1: A buffer of bytes that represent position-dependent executable c ode | // Tier 1: A buffer of bytes that represent position-dependent executable c ode | |||
// Tier 2: A buffer that supports linker-style relocations of raw instructi ons | // Tier 2: A buffer that supports linker-style relocations of raw instructi ons | |||
// Tier 3: A buffer that supports relocatable and optimizer-friendly instru ction objects | // Tier 3: A buffer that supports relocatable and optimizer-friendly instru ction objects | |||
// The current implementation supports tier 1. In that, it is a cut-down ve rsion of the | // The current implementation supports tier 1. In that, it is a cut-down ve rsion of the | |||
// Dyninst internal codeGen structure that aims to be more user-friendly. T iers 2 and 3 | // Dyninst internal codeGen structure that aims to be more user-friendly. T iers 2 and 3 | |||
// are TODO. | // are TODO. | |||
class PATCHAPI_EXPORT Buffer { | class COMMON_EXPORT Buffer { | |||
public: | public: | |||
Buffer(Address addr, unsigned initial_size); | Buffer(Address addr, unsigned initial_size); | |||
Buffer(); | ||||
void initialize(Address addr, unsigned initial_size); | ||||
~Buffer(); | ~Buffer(); | |||
static const int ALLOCATION_UNIT; | static const int ALLOCATION_UNIT; | |||
template <class InputIterator> | template <class InputIterator> | |||
void copy(InputIterator begin, InputIterator end); | void copy(InputIterator begin, InputIterator end); | |||
void copy(void *buffer, unsigned size); | ||||
unsigned size() const; | unsigned size() const; | |||
unsigned max_size() const; | unsigned max_size() const; | |||
bool empty() const; | bool empty() const; | |||
template <class Input> | template <class Input> | |||
void push_back(const Input &); | void push_back(const Input &); | |||
template <class storage> | template <class storage> | |||
class iterator { | class iterator { | |||
skipping to change at line 120 | skipping to change at line 122 | |||
byte_iterator end() const; | byte_iterator end() const; | |||
word_iterator w_begin() const; | word_iterator w_begin() const; | |||
word_iterator w_end() const; | word_iterator w_end() const; | |||
long_iterator l_begin() const; | long_iterator l_begin() const; | |||
long_iterator l_end() const; | long_iterator l_end() const; | |||
unsigned char *start_ptr() const { return buffer_; } | unsigned char *start_ptr() const { return buffer_; } | |||
Address startAddr() const { return start_; } | ||||
Address curAddr() const { return start_ + size_; } | Address curAddr() const { return start_ + size_; } | |||
private: | private: | |||
// May call realloc(); | // May call realloc(); | |||
void increase_allocation(int added); | void increase_allocation(int added); | |||
unsigned char * cur_ptr() const; | unsigned char * cur_ptr() const; | |||
unsigned char * buffer_; | unsigned char * buffer_; | |||
unsigned size_; | unsigned size_; | |||
unsigned max_; | unsigned max_; | |||
skipping to change at line 153 | skipping to change at line 156 | |||
void Buffer::push_back(const Input &i) { | void Buffer::push_back(const Input &i) { | |||
if (size_ + sizeof(i) >= max_) { | if (size_ + sizeof(i) >= max_) { | |||
increase_allocation(sizeof(i)); | increase_allocation(sizeof(i)); | |||
} | } | |||
Input *ptr = (Input *)cur_ptr(); | Input *ptr = (Input *)cur_ptr(); | |||
*ptr = i; | *ptr = i; | |||
size_ += sizeof(i); | size_ += sizeof(i); | |||
}; | }; | |||
} | } | |||
} | ||||
#endif | #endif | |||
End of changes. 7 change blocks. | ||||
5 lines changed or deleted | 7 lines changed or added | |||
CFG.h | CFG.h | |||
---|---|---|---|---|
skipping to change at line 46 | skipping to change at line 46 | |||
#include <string> | #include <string> | |||
#include "dyntypes.h" | #include "dyntypes.h" | |||
#include "IBSTree.h" | #include "IBSTree.h" | |||
#include "InstructionSource.h" | #include "InstructionSource.h" | |||
#include "ParseContainers.h" | #include "ParseContainers.h" | |||
#include "Annotatable.h" | #include "Annotatable.h" | |||
#include <iostream> | #include <iostream> | |||
namespace Dyninst { | namespace Dyninst { | |||
namespace InstructionAPI { | ||||
class Instruction; | ||||
typedef boost::shared_ptr<Instruction> InstructionPtr; | ||||
} | ||||
namespace ParseAPI { | namespace ParseAPI { | |||
class CodeObject; | class CodeObject; | |||
class CFGModifier; | class CFGModifier; | |||
enum EdgeTypeEnum { | enum EdgeTypeEnum { | |||
CALL = 0, | CALL = 0, | |||
COND_TAKEN, | COND_TAKEN, | |||
COND_NOT_TAKEN, | COND_NOT_TAKEN, | |||
INDIRECT, | INDIRECT, | |||
skipping to change at line 278 | skipping to change at line 284 | |||
{ | { | |||
return pred_impl(e); | return pred_impl(e); | |||
} | } | |||
}; | }; | |||
class CodeRegion; | class CodeRegion; | |||
class Block : public Dyninst::interval<Address>, | class Block : public Dyninst::interval<Address>, | |||
public allocatable { | public allocatable { | |||
friend class CFGModifier; | friend class CFGModifier; | |||
public: | public: | |||
typedef std::map<Offset, InstructionAPI::InstructionPtr> Insns; | ||||
typedef std::vector<Edge*> edgelist; | typedef std::vector<Edge*> edgelist; | |||
PARSER_EXPORT Block(CodeObject * o, CodeRegion * r, Address start); | PARSER_EXPORT Block(CodeObject * o, CodeRegion * r, Address start); | |||
PARSER_EXPORT virtual ~Block(); | PARSER_EXPORT virtual ~Block(); | |||
PARSER_EXPORT Address start() const { return _start; } | PARSER_EXPORT Address start() const { return _start; } | |||
PARSER_EXPORT Address end() const { return _end; } | PARSER_EXPORT Address end() const { return _end; } | |||
PARSER_EXPORT Address lastInsnAddr() const { return _lastInsn; } | PARSER_EXPORT Address lastInsnAddr() const { return _lastInsn; } | |||
PARSER_EXPORT Address last() const { return lastInsnAddr(); } | PARSER_EXPORT Address last() const { return lastInsnAddr(); } | |||
PARSER_EXPORT Address size() const { return _end - _start; } | PARSER_EXPORT Address size() const { return _end - _start; } | |||
skipping to change at line 304 | skipping to change at line 311 | |||
/* Edge access */ | /* Edge access */ | |||
PARSER_EXPORT const edgelist & sources() const { return _srclist; } | PARSER_EXPORT const edgelist & sources() const { return _srclist; } | |||
PARSER_EXPORT const edgelist & targets() const { return _trglist; } | PARSER_EXPORT const edgelist & targets() const { return _trglist; } | |||
PARSER_EXPORT bool consistent(Address addr, Address & prev_insn); | PARSER_EXPORT bool consistent(Address addr, Address & prev_insn); | |||
PARSER_EXPORT int containingFuncs() const; | PARSER_EXPORT int containingFuncs() const; | |||
PARSER_EXPORT void getFuncs(std::vector<Function *> & funcs); | PARSER_EXPORT void getFuncs(std::vector<Function *> & funcs); | |||
template<class OutputIterator> void getFuncs(OutputIterator result); | template<class OutputIterator> void getFuncs(OutputIterator result); | |||
PARSER_EXPORT void getInsns(Insns &insns) const; | ||||
PARSER_EXPORT InstructionAPI::InstructionPtr getInsn(Offset o) const; | ||||
PARSER_EXPORT bool wasUserAdded() const; | PARSER_EXPORT bool wasUserAdded() const; | |||
/* interval implementation */ | /* interval implementation */ | |||
Address low() const { return start(); } | Address low() const { return start(); } | |||
Address high() const { return end(); } | Address high() const { return end(); } | |||
struct compare { | struct compare { | |||
bool operator()(Block * const & b1, Block * const & b2) const { | bool operator()(Block * const & b1, Block * const & b2) const { | |||
if(b1->start() < b2->start()) return true; | if(b1->start() < b2->start()) return true; | |||
if(b1->start() > b2->start()) return false; | if(b1->start() > b2->start()) return false; | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 10 lines changed or added | |||
CodeObject.h | CodeObject.h | |||
---|---|---|---|---|
skipping to change at line 36 | skipping to change at line 36 | |||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | */ | |||
#ifndef CODE_OBJECT_H | #ifndef CODE_OBJECT_H | |||
#define CODE_OBJECT_H | #define CODE_OBJECT_H | |||
#include <map> | #include <map> | |||
#include <Symtab.h> | #include "Symtab.h" | |||
#include "IBSTree.h" | #include "IBSTree.h" | |||
#include "CodeSource.h" | #include "CodeSource.h" | |||
#include "CFGFactory.h" | #include "CFGFactory.h" | |||
#include "CFG.h" | #include "CFG.h" | |||
#include "ParseContainers.h" | #include "ParseContainers.h" | |||
namespace Dyninst { | namespace Dyninst { | |||
namespace ParseAPI { | namespace ParseAPI { | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
Event.h | Event.h | |||
---|---|---|---|---|
skipping to change at line 87 | skipping to change at line 87 | |||
class EventLibrary; | class EventLibrary; | |||
class EventRPCLaunch; | class EventRPCLaunch; | |||
class EventAsync; | class EventAsync; | |||
class EventChangePCStop; | class EventChangePCStop; | |||
class EventPreBootstrap; | class EventPreBootstrap; | |||
class EventDetach; | class EventDetach; | |||
class EventIntBootstrap; | class EventIntBootstrap; | |||
class EventNop; | class EventNop; | |||
class EventThreadDB; | class EventThreadDB; | |||
class EventWinStopThreadDestroy; | class EventWinStopThreadDestroy; | |||
class EventControlAuthority; | ||||
class EventAsyncIO; | ||||
class EventAsyncRead; | ||||
class EventAsyncWrite; | ||||
class EventAsyncReadAllRegs; | ||||
class EventAsyncSetAllRegs; | ||||
class PC_EXPORT Event : public boost::enable_shared_from_this<Event> | class PC_EXPORT Event : public boost::enable_shared_from_this<Event> | |||
{ | { | |||
friend void boost::checked_delete<Event>(Event *); | friend void boost::checked_delete<Event>(Event *); | |||
friend void boost::checked_delete<const Event>(const Event *); | friend void boost::checked_delete<const Event>(const Event *); | |||
friend class ::HandlerPool; | friend class ::HandlerPool; | |||
friend class ::int_process; | friend class ::int_process; | |||
friend class ::HandleCallbacks; | friend class ::HandleCallbacks; | |||
public: | public: | |||
typedef boost::shared_ptr<Event> ptr; | typedef boost::shared_ptr<Event> ptr; | |||
skipping to change at line 221 | skipping to change at line 227 | |||
boost::shared_ptr<EventNop> getEventNop(); | boost::shared_ptr<EventNop> getEventNop(); | |||
boost::shared_ptr<const EventNop> getEventNop() const; | boost::shared_ptr<const EventNop> getEventNop() const; | |||
boost::shared_ptr<EventThreadDB> getEventThreadDB(); | boost::shared_ptr<EventThreadDB> getEventThreadDB(); | |||
boost::shared_ptr<const EventThreadDB> getEventThreadDB() const; | boost::shared_ptr<const EventThreadDB> getEventThreadDB() const; | |||
boost::shared_ptr<EventWinStopThreadDestroy> getEventWinStopThreadDestro y(); | boost::shared_ptr<EventWinStopThreadDestroy> getEventWinStopThreadDestro y(); | |||
boost::shared_ptr<const EventWinStopThreadDestroy> getEventWinStopThread Destroy() const; | boost::shared_ptr<const EventWinStopThreadDestroy> getEventWinStopThread Destroy() const; | |||
boost::shared_ptr<EventControlAuthority> getEventControlAuthority(); | ||||
boost::shared_ptr<const EventControlAuthority> getEventControlAuthority( | ||||
) const; | ||||
boost::shared_ptr<EventAsyncIO> getEventAsyncIO(); | ||||
boost::shared_ptr<const EventAsyncIO> getEventAsyncIO() const; | ||||
boost::shared_ptr<EventAsyncRead> getEventAsyncRead(); | ||||
boost::shared_ptr<const EventAsyncRead> getEventAsyncRead() const; | ||||
boost::shared_ptr<EventAsyncWrite> getEventAsyncWrite(); | ||||
boost::shared_ptr<const EventAsyncWrite> getEventAsyncWrite() const; | ||||
boost::shared_ptr<EventAsyncReadAllRegs> getEventAsyncReadAllRegs(); | ||||
boost::shared_ptr<const EventAsyncReadAllRegs> getEventAsyncReadAllRegs( | ||||
) const; | ||||
boost::shared_ptr<EventAsyncSetAllRegs> getEventAsyncSetAllRegs(); | ||||
boost::shared_ptr<const EventAsyncSetAllRegs> getEventAsyncSetAllRegs() | ||||
const; | ||||
//Not meant for public consumption | //Not meant for public consumption | |||
void setLastError(err_t ec, const char *es); | void setLastError(err_t ec, const char *es); | |||
protected: | protected: | |||
EventType etype; | EventType etype; | |||
Thread::const_ptr thread; | Thread::const_ptr thread; | |||
Process::const_ptr proc; | Process::const_ptr proc; | |||
SyncType stype; | SyncType stype; | |||
std::vector<Event::ptr> subservient_events; | std::vector<Event::ptr> subservient_events; | |||
Event::weak_ptr master_event; | Event::weak_ptr master_event; | |||
std::set<Handler *> handled_by; | std::set<Handler *> handled_by; | |||
skipping to change at line 375 | skipping to change at line 399 | |||
typedef boost::shared_ptr<const EventNewUserThread> const_ptr; | typedef boost::shared_ptr<const EventNewUserThread> const_ptr; | |||
EventNewUserThread(); | EventNewUserThread(); | |||
virtual ~EventNewUserThread(); | virtual ~EventNewUserThread(); | |||
int_eventNewUserThread *getInternalEvent() const; | int_eventNewUserThread *getInternalEvent() const; | |||
virtual Dyninst::LWP getLWP() const; | virtual Dyninst::LWP getLWP() const; | |||
virtual Thread::const_ptr getNewThread() const; | virtual Thread::const_ptr getNewThread() const; | |||
}; | }; | |||
class int_eventNewLWP; | ||||
class PC_EXPORT EventNewLWP : public EventNewThread | class PC_EXPORT EventNewLWP : public EventNewThread | |||
{ | { | |||
friend void boost::checked_delete<EventNewLWP>(EventNewLWP *); | friend void boost::checked_delete<EventNewLWP>(EventNewLWP *); | |||
friend void boost::checked_delete<const EventNewLWP>(const EventNewLWP * ); | friend void boost::checked_delete<const EventNewLWP>(const EventNewLWP * ); | |||
private: | private: | |||
int_eventNewLWP *iev; | ||||
Dyninst::LWP lwp; | Dyninst::LWP lwp; | |||
public: | public: | |||
int_eventNewLWP *getInternalEvent(); | ||||
typedef boost::shared_ptr<EventNewLWP> ptr; | typedef boost::shared_ptr<EventNewLWP> ptr; | |||
typedef boost::shared_ptr<const EventNewLWP> const_ptr; | typedef boost::shared_ptr<const EventNewLWP> const_ptr; | |||
EventNewLWP(Dyninst::LWP lwp_); | EventNewLWP(Dyninst::LWP lwp_, int status = 0); | |||
virtual ~EventNewLWP(); | virtual ~EventNewLWP(); | |||
virtual Dyninst::LWP getLWP() const; | virtual Dyninst::LWP getLWP() const; | |||
virtual Thread::const_ptr getNewThread() const; | virtual Thread::const_ptr getNewThread() const; | |||
}; | }; | |||
class PC_EXPORT EventThreadDestroy : public Event | class PC_EXPORT EventThreadDestroy : public Event | |||
{ | { | |||
friend void boost::checked_delete<EventThreadDestroy>(EventThreadDestroy *); | friend void boost::checked_delete<EventThreadDestroy>(EventThreadDestroy *); | |||
friend void boost::checked_delete<const EventThreadDestroy>(const EventT hreadDestroy *); | friend void boost::checked_delete<const EventThreadDestroy>(const EventT hreadDestroy *); | |||
skipping to change at line 697 | skipping to change at line 724 | |||
{ | { | |||
friend void boost::checked_delete<EventWinStopThreadDestroy>(EventWinSto pThreadDestroy *); | friend void boost::checked_delete<EventWinStopThreadDestroy>(EventWinSto pThreadDestroy *); | |||
friend void boost::checked_delete<const EventWinStopThreadDestroy>(const EventWinStopThreadDestroy *); | friend void boost::checked_delete<const EventWinStopThreadDestroy>(const EventWinStopThreadDestroy *); | |||
public: | public: | |||
typedef boost::shared_ptr<EventWinStopThreadDestroy> ptr; | typedef boost::shared_ptr<EventWinStopThreadDestroy> ptr; | |||
typedef boost::shared_ptr<const EventWinStopThreadDestroy> const_ptr; | typedef boost::shared_ptr<const EventWinStopThreadDestroy> const_ptr; | |||
EventWinStopThreadDestroy(EventType::Time time_); | EventWinStopThreadDestroy(EventType::Time time_); | |||
virtual ~EventWinStopThreadDestroy(); | virtual ~EventWinStopThreadDestroy(); | |||
}; | }; | |||
class int_eventControlAuthority; | ||||
class PC_EXPORT EventControlAuthority : public Event | ||||
{ | ||||
friend void boost::checked_delete<EventControlAuthority>(EventControlAut | ||||
hority *); | ||||
friend void boost::checked_delete<const EventControlAuthority>(const Eve | ||||
ntControlAuthority *); | ||||
int_eventControlAuthority *iev; | ||||
public: | ||||
typedef boost::shared_ptr<EventControlAuthority> ptr; | ||||
typedef boost::shared_ptr<const EventControlAuthority> const_ptr; | ||||
int_eventControlAuthority *getInternalEvent() const; | ||||
EventControlAuthority(EventType::Time t, int_eventControlAuthority *iev_ | ||||
); | ||||
virtual ~EventControlAuthority(); | ||||
virtual bool procStopper() const; | ||||
std::string otherToolName() const; | ||||
unsigned int otherToolID() const; | ||||
int otherToolPriority() const; | ||||
typedef enum { | ||||
ControlUnset, | ||||
ControlLost, | ||||
ControlGained, | ||||
ControlNoChange | ||||
} Trigger; | ||||
Trigger eventTrigger() const; | ||||
}; | ||||
class int_eventAsyncIO; | ||||
class PC_EXPORT EventAsyncIO : public Event { | ||||
friend void boost::checked_delete<EventAsyncIO>(EventAsyncIO *); | ||||
friend void boost::checked_delete<const EventAsyncIO>(const EventAsyncIO | ||||
*); | ||||
protected: | ||||
int_eventAsyncIO *iev; | ||||
public: | ||||
typedef boost::shared_ptr<EventAsyncIO> ptr; | ||||
typedef boost::shared_ptr<const EventAsyncIO> const_ptr; | ||||
int_eventAsyncIO *getInternalEvent() const; | ||||
EventAsyncIO(EventType et, int_eventAsyncIO *iev_); | ||||
~EventAsyncIO(); | ||||
bool hadError() const; | ||||
void *getOpaqueVal() const; | ||||
}; | ||||
class PC_EXPORT EventAsyncRead : public EventAsyncIO { | ||||
friend void boost::checked_delete<EventAsyncRead>(EventAsyncRead *); | ||||
friend void boost::checked_delete<const EventAsyncRead>(const EventAsync | ||||
Read *); | ||||
public: | ||||
typedef boost::shared_ptr<EventAsyncRead> ptr; | ||||
typedef boost::shared_ptr<const EventAsyncRead> const_ptr; | ||||
EventAsyncRead(int_eventAsyncIO *iev_); | ||||
~EventAsyncRead(); | ||||
void *getMemory() const; | ||||
size_t getSize() const; | ||||
Dyninst::Address getAddress() const; | ||||
}; | ||||
class PC_EXPORT EventAsyncWrite : public EventAsyncIO { | ||||
friend void boost::checked_delete<EventAsyncWrite>(EventAsyncWrite *); | ||||
friend void boost::checked_delete<const EventAsyncWrite>(const EventAsyn | ||||
cWrite *); | ||||
public: | ||||
typedef boost::shared_ptr<EventAsyncWrite> ptr; | ||||
typedef boost::shared_ptr<const EventAsyncWrite> const_ptr; | ||||
EventAsyncWrite(int_eventAsyncIO *iev_); | ||||
~EventAsyncWrite(); | ||||
size_t getSize() const; | ||||
Dyninst::Address getAddress() const; | ||||
}; | ||||
class PC_EXPORT EventAsyncReadAllRegs : public EventAsyncIO { | ||||
friend void boost::checked_delete<EventAsyncReadAllRegs>(EventAsyncReadA | ||||
llRegs *); | ||||
friend void boost::checked_delete<const EventAsyncReadAllRegs>(const Eve | ||||
ntAsyncReadAllRegs *); | ||||
public: | ||||
typedef boost::shared_ptr<EventAsyncReadAllRegs> ptr; | ||||
typedef boost::shared_ptr<const EventAsyncReadAllRegs> const_ptr; | ||||
EventAsyncReadAllRegs(int_eventAsyncIO *iev_); | ||||
~EventAsyncReadAllRegs(); | ||||
const RegisterPool &getRegisters() const; | ||||
}; | ||||
class PC_EXPORT EventAsyncSetAllRegs : public EventAsyncIO { | ||||
friend void boost::checked_delete<EventAsyncSetAllRegs>(EventAsyncSetAll | ||||
Regs *); | ||||
friend void boost::checked_delete<const EventAsyncSetAllRegs>(const Even | ||||
tAsyncSetAllRegs *); | ||||
public: | ||||
typedef boost::shared_ptr<EventAsyncSetAllRegs> ptr; | ||||
typedef boost::shared_ptr<const EventAsyncSetAllRegs> const_ptr; | ||||
EventAsyncSetAllRegs(int_eventAsyncIO *iev_); | ||||
~EventAsyncSetAllRegs(); | ||||
}; | ||||
} | } | |||
} | } | |||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
1 lines changed or deleted | 141 lines changed or added | |||
EventType.h | EventType.h | |||
---|---|---|---|---|
skipping to change at line 61 | skipping to change at line 61 | |||
static const int Stop = 9; | static const int Stop = 9; | |||
static const int Signal = 10; | static const int Signal = 10; | |||
static const int LibraryLoad = 11; | static const int LibraryLoad = 11; | |||
static const int LibraryUnload = 12; | static const int LibraryUnload = 12; | |||
static const int Bootstrap = 13; | static const int Bootstrap = 13; | |||
static const int Breakpoint = 14; | static const int Breakpoint = 14; | |||
static const int RPC = 15; | static const int RPC = 15; | |||
static const int SingleStep = 16; | static const int SingleStep = 16; | |||
static const int Library = 17; | static const int Library = 17; | |||
static const int ForceTerminate = 18; | static const int ForceTerminate = 18; | |||
static const int PreBootstrap = 19; | static const int ControlAuthority = 20; | |||
static const int Continue = 20; | static const int AsyncRead = 21; | |||
static const int AsyncWrite = 22; | ||||
static const int AsyncReadAllRegs = 23; | ||||
static const int AsyncSetAllRegs = 24; | ||||
//These aren't completely real events. They can have callbacks register ed, but won't be delivered. | //These aren't completely real events. They can have callbacks register ed, but won't be delivered. | |||
// Instead, a real event will be delivered to their callback. E.g, a ca llback registered for | // Instead, a real event will be delivered to their callback. E.g, a ca llback registered for | |||
// Terminate will actually get Exit or Crash events. | // Terminate will actually get Exit or Crash events. | |||
static const int Terminate = 400; | static const int Terminate = 400; | |||
static const int ThreadCreate = 401; | static const int ThreadCreate = 401; | |||
static const int ThreadDestroy = 402; | static const int ThreadDestroy = 402; | |||
static const int AsyncIO = 403; | ||||
//Users do not recieve CBs for the below event types--ProcControlAPI int ernal | //Users do not recieve CBs for the below event types--ProcControlAPI int ernal | |||
static const int InternalEvents = 500; | static const int InternalEvents = 500; | |||
static const int BreakpointClear = 500; | static const int BreakpointClear = 500; | |||
static const int BreakpointRestore = 501; | static const int BreakpointRestore = 501; | |||
static const int Async = 502; | static const int Async = 502; | |||
static const int ChangePCStop = 503; // Used for bug_freebsd_chan ge_pc | static const int ChangePCStop = 503; // Used for bug_freebsd_chan ge_pc | |||
static const int Detach = 504; | static const int Detach = 504; | |||
static const int Detached = 505; | static const int Detached = 505; | |||
static const int IntBootstrap = 506; | static const int IntBootstrap = 506; | |||
static const int Nop = 507; | static const int Nop = 507; | |||
static const int ThreadDB = 508; | static const int ThreadDB = 508; | |||
static const int RPCLaunch = 509; | static const int RPCLaunch = 509; | |||
static const int ThreadInfo = 510; | static const int ThreadInfo = 510; | |||
static const int WinStopThreadDestroy = 511; | static const int WinStopThreadDestroy = 511; | |||
static const int PreBootstrap = 512; | ||||
static const int Continue = 513; | ||||
//Users should define their own events at this value or higher. | //Users should define their own events at this value or higher. | |||
static const int MaxProcCtrlEvent = 1000; | static const int MaxProcCtrlEvent = 1000; | |||
typedef int Code; | typedef int Code; | |||
typedef enum { | typedef enum { | |||
Pre = 0, | Pre = 0, | |||
Post, | Post, | |||
None, | None, | |||
Any | Any | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 9 lines changed or added | |||
InstructionAdapter.h | InstructionAdapter.h | |||
---|---|---|---|---|
skipping to change at line 75 | skipping to change at line 75 | |||
// Reset to just-constructed state | // Reset to just-constructed state | |||
void reset(Address start, ParseAPI::CodeObject *o, | void reset(Address start, ParseAPI::CodeObject *o, | |||
ParseAPI::CodeRegion *r, InstructionSource *isrc, ParseAPI::Block * ); | ParseAPI::CodeRegion *r, InstructionSource *isrc, ParseAPI::Block * ); | |||
// Implemented | // Implemented | |||
virtual InstructionAPI::Instruction::Ptr getInstruction() const = 0; | virtual InstructionAPI::Instruction::Ptr getInstruction() const = 0; | |||
virtual bool hasCFT() const = 0; | virtual bool hasCFT() const = 0; | |||
virtual size_t getSize() const = 0; | virtual size_t getSize() const = 0; | |||
virtual bool isFrameSetupInsn() const = 0; | virtual bool isFrameSetupInsn() const = 0; | |||
virtual bool isAbortOrInvalidInsn() const = 0; | virtual bool isInvalidInsn() const = 0; | |||
virtual bool isAbort() const = 0; | ||||
virtual bool isGarbageInsn() const = 0; //true for insns indicative of bad parse, for defensive mode | virtual bool isGarbageInsn() const = 0; //true for insns indicative of bad parse, for defensive mode | |||
virtual void | virtual void | |||
getNewEdges(std::vector<std::pair<Address,ParseAPI::EdgeTypeEnu m> >& | getNewEdges(std::vector<std::pair<Address,ParseAPI::EdgeTypeEnu m> >& | |||
outEdges, | outEdges, | |||
ParseAPI::Function* context, | ParseAPI::Function* context, | |||
ParseAPI::Block* currBlk, | ParseAPI::Block* currBlk, | |||
unsigned int num_insns, | unsigned int num_insns, | |||
dyn_hash_map<Address, std::string> *pltFuncs) const = | dyn_hash_map<Address, std::string> *pltFuncs) const = | |||
0; | 0; | |||
virtual bool isDynamicCall() const = 0; | virtual bool isDynamicCall() const = 0; | |||
skipping to change at line 111 | skipping to change at line 112 | |||
virtual Address getNextAddr() const; | virtual Address getNextAddr() const; | |||
virtual std::pair<bool, Address> getCFT() const = 0; | virtual std::pair<bool, Address> getCFT() const = 0; | |||
virtual bool isStackFramePreamble() const = 0; | virtual bool isStackFramePreamble() const = 0; | |||
virtual bool savesFP() const = 0; | virtual bool savesFP() const = 0; | |||
virtual bool cleansStack() const = 0; | virtual bool cleansStack() const = 0; | |||
virtual bool isConditional() const = 0; | virtual bool isConditional() const = 0; | |||
virtual bool isBranch() const = 0; | virtual bool isBranch() const = 0; | |||
virtual bool isInterruptOrSyscall() const = 0; | virtual bool isInterruptOrSyscall() const = 0; | |||
virtual bool isCall() const = 0; | virtual bool isCall() const = 0; | |||
virtual bool isReturnAddrSave(Address &ret_addr) const = 0; // ret_addr holds the return address pushed in the stack using mflr at function entry | virtual bool isReturnAddrSave(Address &ret_addr) const = 0; // ret_addr holds the return address pushed in the stack using mflr at function entry | |||
virtual bool isTailCall(ParseAPI::Function *,unsigned int num_insns) co nst = 0; | virtual bool isTailCall(ParseAPI::Function *, ParseAPI::EdgeTypeEnum ty pe, unsigned int num_insns) const = 0; | |||
protected: | protected: | |||
// Uses pattern heuristics or backward slicing to determine if a blr instruction is a return or jump table | // Uses pattern heuristics or backward slicing to determine if a blr instruction is a return or jump table | |||
virtual bool isReturn(Dyninst::ParseAPI::Function * context, Dynins t::ParseAPI::Block* currBlk) const = 0; | virtual bool isReturn(Dyninst::ParseAPI::Function * context, Dynins t::ParseAPI::Block* currBlk) const = 0; | |||
virtual bool isRealCall() const = 0; | virtual bool isRealCall() const = 0; | |||
Address current; | Address current; | |||
Address previous; | Address previous; | |||
mutable bool parsedJumpTable; | mutable bool parsedJumpTable; | |||
mutable bool successfullyParsedJumpTable; | mutable bool successfullyParsedJumpTable; | |||
mutable bool isDynamicCall_; | mutable bool isDynamicCall_; | |||
mutable bool checkedDynamicCall_; | mutable bool checkedDynamicCall_; | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 3 lines changed or added | |||
PCProcess.h | PCProcess.h | |||
---|---|---|---|---|
skipping to change at line 38 | skipping to change at line 38 | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | */ | |||
#if !defined(PROCESSPC_H_) | #if !defined(PROCESSPC_H_) | |||
#define PROCESSPC_H_ | #define PROCESSPC_H_ | |||
#include <string> | #include <string> | |||
#include <vector> | #include <vector> | |||
#include <map> | #include <map> | |||
#include <set> | #include <set> | |||
#include <iterator> | ||||
#include "dyntypes.h" | #include "dyntypes.h" | |||
#include "dyn_regs.h" | #include "dyn_regs.h" | |||
#include "EventType.h" | #include "EventType.h" | |||
#include "util.h" | #include "util.h" | |||
#include "PCErrors.h" | #include "PCErrors.h" | |||
#include "boost/checked_delete.hpp" | #include "boost/checked_delete.hpp" | |||
#include "boost/shared_ptr.hpp" | #include "boost/shared_ptr.hpp" | |||
#include "boost/weak_ptr.hpp" | #include "boost/weak_ptr.hpp" | |||
#include "boost/enable_shared_from_this.hpp" | #include "boost/enable_shared_from_this.hpp" | |||
skipping to change at line 64 | skipping to change at line 65 | |||
class int_thread; | class int_thread; | |||
class int_threadPool; | class int_threadPool; | |||
class int_registerPool; | class int_registerPool; | |||
class rpc_wrapper; | class rpc_wrapper; | |||
class int_iRPC; | class int_iRPC; | |||
class int_notify; | class int_notify; | |||
class HandlerPool; | class HandlerPool; | |||
class MTLock; | class MTLock; | |||
#define PC_VERSION_8_0_0 | #define PC_VERSION_8_0_0 | |||
#define PC_VERSION_8_1_0 | ||||
#define pc_const_cast boost::const_pointer_cast | #define pc_const_cast boost::const_pointer_cast | |||
namespace Dyninst { | namespace Dyninst { | |||
class SymbolReaderFactory; | class SymbolReaderFactory; | |||
namespace ProcControlAPI { | namespace ProcControlAPI { | |||
class Process; | class Process; | |||
skipping to change at line 86 | skipping to change at line 88 | |||
class EventDecoder; | class EventDecoder; | |||
class EventGenerator; | class EventGenerator; | |||
class EventHandler; | class EventHandler; | |||
class Event; | class Event; | |||
class RegisterPool; | class RegisterPool; | |||
class Breakpoint; | class Breakpoint; | |||
class ProcessSet; | class ProcessSet; | |||
class ThreadSet; | class ThreadSet; | |||
class LibraryTracking; | class LibraryTracking; | |||
class ThreadTracking; | class ThreadTracking; | |||
class LWPTracking; | ||||
class CallStackUnwinding; | class CallStackUnwinding; | |||
class FollowFork; | class FollowFork; | |||
class SignalMask; | ||||
class ExecFileInfo; | class ExecFileInfo; | |||
class PC_EXPORT Breakpoint | class PC_EXPORT Breakpoint | |||
{ | { | |||
friend class ::int_breakpoint; | friend class ::int_breakpoint; | |||
friend void boost::checked_delete<Breakpoint>(Breakpoint *); | friend void boost::checked_delete<Breakpoint>(Breakpoint *); | |||
friend void boost::checked_delete<const Breakpoint>(const Breakpoint *); | friend void boost::checked_delete<const Breakpoint>(const Breakpoint *); | |||
private: | private: | |||
int_breakpoint *llbreakpoint_; | int_breakpoint *llbreakpoint_; | |||
skipping to change at line 112 | skipping to change at line 116 | |||
static const int BP_W = 2; | static const int BP_W = 2; | |||
static const int BP_R = 4; | static const int BP_R = 4; | |||
int_breakpoint *llbp() const; | int_breakpoint *llbp() const; | |||
typedef boost::shared_ptr<Breakpoint> ptr; | typedef boost::shared_ptr<Breakpoint> ptr; | |||
typedef boost::shared_ptr<const Breakpoint> const_ptr; | typedef boost::shared_ptr<const Breakpoint> const_ptr; | |||
typedef boost::weak_ptr<Breakpoint> weak_ptr; | typedef boost::weak_ptr<Breakpoint> weak_ptr; | |||
static Breakpoint::ptr newBreakpoint(); | static Breakpoint::ptr newBreakpoint(); | |||
static Breakpoint::ptr newTransferBreakpoint(Dyninst::Address to); | static Breakpoint::ptr newTransferBreakpoint(Dyninst::Address to); | |||
static Breakpoint::ptr newTransferOffsetBreakpoint(signed long shift); | ||||
static Breakpoint::ptr newHardwareBreakpoint(unsigned int mode, unsigned int size); | static Breakpoint::ptr newHardwareBreakpoint(unsigned int mode, unsigned int size); | |||
void *getData() const; | void *getData() const; | |||
void setData(void *p) const; | void setData(void *p) const; | |||
bool isCtrlTransfer() const; | bool isCtrlTransfer() const; | |||
Dyninst::Address getToAddress() const; | Dyninst::Address getToAddress() const; | |||
void setSuppressCallbacks(bool); | void setSuppressCallbacks(bool); | |||
bool suppressCallbacks() const; | bool suppressCallbacks() const; | |||
skipping to change at line 157 | skipping to change at line 162 | |||
class PC_EXPORT LibraryPool | class PC_EXPORT LibraryPool | |||
{ | { | |||
friend class ::int_process; | friend class ::int_process; | |||
friend class Dyninst::ProcControlAPI::Process; | friend class Dyninst::ProcControlAPI::Process; | |||
private: | private: | |||
int_process *proc; | int_process *proc; | |||
LibraryPool(); | LibraryPool(); | |||
~LibraryPool(); | ~LibraryPool(); | |||
public: | public: | |||
class PC_EXPORT iterator { | class PC_EXPORT iterator { | |||
friend class Dyninst::ProcControlAPI::LibraryPool; | friend class Dyninst::ProcControlAPI::LibraryPool; | |||
private: | private: | |||
std::set<int_library *>::iterator int_iter; | std::set<int_library *>::iterator int_iter; | |||
public: | public: | |||
iterator(); | iterator(); | |||
~iterator(); | ~iterator(); | |||
Library::ptr operator*() const; | Library::ptr operator*() const; | |||
bool operator==(const iterator &i) const; | bool operator==(const iterator &i) const; | |||
bool operator!=(const iterator &i) const; | bool operator!=(const iterator &i) const; | |||
LibraryPool::iterator operator++(); | LibraryPool::iterator operator++(); | |||
LibraryPool::iterator operator++(int); | LibraryPool::iterator operator++(int); | |||
typedef Library::ptr value_type; | ||||
typedef int difference_type; | ||||
typedef Library::ptr *pointer; | ||||
typedef Library::ptr &reference; | ||||
typedef std::forward_iterator_tag iterator_category; | ||||
}; | }; | |||
class PC_EXPORT const_iterator { | class PC_EXPORT const_iterator { | |||
friend class Dyninst::ProcControlAPI::LibraryPool; | friend class Dyninst::ProcControlAPI::LibraryPool; | |||
private: | private: | |||
std::set<int_library *>::iterator int_iter; | std::set<int_library *>::iterator int_iter; | |||
public: | public: | |||
const_iterator(); | const_iterator(); | |||
~const_iterator(); | ~const_iterator(); | |||
Library::const_ptr operator*() const; | Library::const_ptr operator*() const; | |||
bool operator==(const const_iterator &i); | bool operator==(const const_iterator &i); | |||
bool operator!=(const const_iterator &i); | bool operator!=(const const_iterator &i); | |||
LibraryPool::const_iterator operator++(); | LibraryPool::const_iterator operator++(); | |||
LibraryPool::const_iterator operator++(int); | LibraryPool::const_iterator operator++(int); | |||
typedef Library::const_ptr value_type; | ||||
typedef int difference_type; | ||||
typedef Library::const_ptr *pointer; | ||||
typedef Library::const_ptr &reference; | ||||
typedef std::forward_iterator_tag iterator_category; | ||||
}; | }; | |||
iterator begin(); | iterator begin(); | |||
iterator end(); | iterator end(); | |||
const_iterator begin() const; | const_iterator begin() const; | |||
const_iterator end() const; | const_iterator end() const; | |||
size_t size() const; | size_t size() const; | |||
Library::ptr getExecutable(); | Library::ptr getExecutable(); | |||
Library::const_ptr getExecutable() const; | Library::const_ptr getExecutable() const; | |||
Library::ptr getLibraryByName(std::string s); | Library::ptr getLibraryByName(std::string s); | |||
Library::const_ptr getLibraryByName(std::string s) const; | Library::const_ptr getLibraryByName(std::string s) const; | |||
iterator find(Library::ptr lib); | ||||
const_iterator find(Library::ptr lib) const; | ||||
}; | }; | |||
class PC_EXPORT IRPC | class PC_EXPORT IRPC | |||
{ | { | |||
friend class ::int_iRPC; | friend class ::int_iRPC; | |||
friend void boost::checked_delete<IRPC>(IRPC *); | friend void boost::checked_delete<IRPC>(IRPC *); | |||
friend void boost::checked_delete<const IRPC>(const IRPC *); | friend void boost::checked_delete<const IRPC>(const IRPC *); | |||
private: | private: | |||
rpc_wrapper *wrapper; | rpc_wrapper *wrapper; | |||
IRPC(rpc_wrapper *wrapper_); | IRPC(rpc_wrapper *wrapper_); | |||
skipping to change at line 355 | skipping to change at line 376 | |||
int getExitCode() const; | int getExitCode() const; | |||
int getCrashSignal() const; | int getCrashSignal() const; | |||
bool hasStoppedThread() const; | bool hasStoppedThread() const; | |||
bool hasRunningThread() const; | bool hasRunningThread() const; | |||
bool allThreadsStopped() const; | bool allThreadsStopped() const; | |||
bool allThreadsRunning() const; | bool allThreadsRunning() const; | |||
bool allThreadsRunningWhenAttached() const; | bool allThreadsRunningWhenAttached() const; | |||
/** | /** | |||
* What capabilities do we have on this process | ||||
**/ | ||||
static const unsigned int pc_read = (1<<0); | ||||
static const unsigned int pc_write = (1<<1); | ||||
static const unsigned int pc_irpc = (1<<2); | ||||
static const unsigned int pc_control = (1<<3); | ||||
unsigned int getCapabilities() const; | ||||
/** | ||||
* Queries for machine info | * Queries for machine info | |||
**/ | **/ | |||
Dyninst::Architecture getArchitecture() const; | Dyninst::Architecture getArchitecture() const; | |||
Dyninst::OSType getOS() const; | Dyninst::OSType getOS() const; | |||
/** | /** | |||
* Query what kind of events this process supports | * Query what kind of events this process supports | |||
**/ | **/ | |||
bool supportsLWPEvents() const; | bool supportsLWPEvents() const; | |||
bool supportsUserThreadEvents() const; | bool supportsUserThreadEvents() const; | |||
bool supportsFork() const; | bool supportsFork() const; | |||
bool supportsExec() const; | bool supportsExec() const; | |||
/** | /** | |||
* Control process | * Control process | |||
**/ | **/ | |||
bool continueProc(); | bool continueProc(); | |||
bool stopProc(); | bool stopProc(); | |||
bool detach(); | bool detach(bool leaveStopped = false); | |||
bool terminate(); | bool terminate(); | |||
bool temporaryDetach(); | bool temporaryDetach(); | |||
bool reAttach(); | bool reAttach(); | |||
/** | /** | |||
* Memory management | * Memory management | |||
**/ | **/ | |||
class PC_EXPORT mem_perm { | ||||
bool read; | ||||
bool write; | ||||
bool execute; | ||||
int permVal() const; | ||||
public: | ||||
mem_perm() : read(false), write(false), execute(false) {} | ||||
mem_perm(const mem_perm& p) : read(p.read), write(p.write), | ||||
execute(p.execute) {} | ||||
mem_perm(bool r, bool w, bool x) : read(r), write(w), execute(x) {} | ||||
bool getR() const { return read; } | ||||
bool getW() const { return write; } | ||||
bool getX() const { return execute; } | ||||
bool isNone() const { return !read && !write && !execute; } | ||||
bool isR() const { return read && !write && !execute; } | ||||
bool isX() const { return !read && !write && execute; } | ||||
bool isRW() const { return read && write && !execute; } | ||||
bool isRX() const { return read && !write && execute; } | ||||
bool isRWX() const { return read && write && execute; } | ||||
mem_perm& setR() { read = true; return *this; } | ||||
mem_perm& setW() { write = true; return *this; } | ||||
mem_perm& setX() { execute = true; return *this; } | ||||
mem_perm& clrR() { read = false; return *this; } | ||||
mem_perm& clrW() { write = false; return *this; } | ||||
mem_perm& clrX() { execute = false; return *this; } | ||||
bool operator< (const mem_perm& p) const; | ||||
bool operator==(const mem_perm& p) const; | ||||
bool operator!=(const mem_perm& p) const; | ||||
std::string getPermName() const; | ||||
}; | ||||
unsigned getMemoryPageSize() const; | ||||
Dyninst::Address mallocMemory(size_t size); | Dyninst::Address mallocMemory(size_t size); | |||
Dyninst::Address mallocMemory(size_t size, Dyninst::Address addr); | Dyninst::Address mallocMemory(size_t size, Dyninst::Address addr); | |||
bool freeMemory(Dyninst::Address addr); | bool freeMemory(Dyninst::Address addr); | |||
bool writeMemory(Dyninst::Address addr, const void *buffer, size_t size) const; | bool writeMemory(Dyninst::Address addr, const void *buffer, size_t size) const; | |||
bool readMemory(void *buffer, Dyninst::Address addr, size_t size) const; | bool readMemory(void *buffer, Dyninst::Address addr, size_t size) const; | |||
bool writeMemoryAsync(Dyninst::Address addr, const void *buffer, size_t size, void *opaque_val = NULL) const; | bool writeMemoryAsync(Dyninst::Address addr, const void *buffer, size_t size, void *opaque_val = NULL) const; | |||
bool readMemoryAsync(void *buffer, Dyninst::Address addr, size_t size, v oid *opaque_val = NULL) const; | bool readMemoryAsync(void *buffer, Dyninst::Address addr, size_t size, v oid *opaque_val = NULL) const; | |||
/** | /** | |||
* Currently Windows-only, needed for the test infrastructure but possib ly useful elsewhere | * Currently Windows-only, needed for the test infrastructure but possib ly useful elsewhere | |||
*/ | **/ | |||
Dyninst::Address findFreeMemory(size_t size); | Dyninst::Address findFreeMemory(size_t size); | |||
bool getMemoryAccessRights(Dyninst::Address addr, size_t size, | ||||
mem_perm& rights); | ||||
bool setMemoryAccessRights(Dyninst::Address addr, size_t size, | ||||
mem_perm rights, mem_perm& oldRights); | ||||
// MemoryRegion.first = startAddr, MemoryRegion.second = endAddr | ||||
typedef std::pair<Dyninst::Address, Dyninst::Address> MemoryRegion; | ||||
bool findAllocatedRegionAround(Dyninst::Address addr, MemoryRegion& memR | ||||
egion); | ||||
/** | /** | |||
* Libraries | * Libraries | |||
**/ | **/ | |||
const LibraryPool &libraries() const; | const LibraryPool &libraries() const; | |||
LibraryPool &libraries(); | LibraryPool &libraries(); | |||
// Cause a library to be loaded into the process (via black magic) | ||||
bool addLibrary(std::string libname); | ||||
/** | /** | |||
* Breakpoints | * Breakpoints | |||
**/ | **/ | |||
bool addBreakpoint(Dyninst::Address addr, Breakpoint::ptr bp) const; | bool addBreakpoint(Dyninst::Address addr, Breakpoint::ptr bp) const; | |||
bool rmBreakpoint(Dyninst::Address addr, Breakpoint::ptr bp) const; | bool rmBreakpoint(Dyninst::Address addr, Breakpoint::ptr bp) const; | |||
unsigned numHardwareBreakpointsAvail(unsigned mode); | unsigned numHardwareBreakpointsAvail(unsigned mode); | |||
/** | /** | |||
* Post IRPC. Use continueProc/continueThread to run it, | * Post IRPC. Use continueProc/continueThread to run it, | |||
* and handleEvents to wait for a blocking IRPC to complete | * and handleEvents to wait for a blocking IRPC to complete | |||
**/ | **/ | |||
bool postIRPC(IRPC::ptr irpc) const; | bool postIRPC(IRPC::ptr irpc) const; | |||
bool getPostedIRPCs(std::vector<IRPC::ptr> &rpcs) const; | bool getPostedIRPCs(std::vector<IRPC::ptr> &rpcs) const; | |||
/** | /** | |||
* Post and run an IRPC; user must wait for completion. Standard | * Post, run, and wait for an IRPC to complete | |||
**/ | **/ | |||
bool runIRPCSync(IRPC::ptr irpc); | bool runIRPCSync(IRPC::ptr irpc); | |||
/** | /** | |||
* Post, run, and wait for an IRPC to complete | * Post and run an IRPC; user must wait for completion. | |||
**/ | **/ | |||
bool runIRPCAsync(IRPC::ptr irpc); | bool runIRPCAsync(IRPC::ptr irpc); | |||
/** | /** | |||
* Symbol access | * Symbol access | |||
**/ | **/ | |||
void setSymbolReader(SymbolReaderFactory *reader) const; | void setSymbolReader(SymbolReaderFactory *reader) const; | |||
SymbolReaderFactory *getSymbolReader() const; | SymbolReaderFactory *getSymbolReader() const; | |||
static SymbolReaderFactory *getDefaultSymbolReader(); | static SymbolReaderFactory *getDefaultSymbolReader(); | |||
static void setDefaultSymbolReader(SymbolReaderFactory *reader); | static void setDefaultSymbolReader(SymbolReaderFactory *reader); | |||
/** | /** | |||
* Perform specific operations. Interface objects will only be returned | * Perform specific operations. Interface objects will only be returned | |||
* on appropriately supported platforms, others will return NULL. | * on appropriately supported platforms, others will return NULL. | |||
**/ | **/ | |||
LibraryTracking *getLibraryTracking(); | LibraryTracking *getLibraryTracking(); | |||
ThreadTracking *getThreadTracking(); | ThreadTracking *getThreadTracking(); | |||
LWPTracking *getLWPTracking(); | ||||
FollowFork *getFollowFork(); | FollowFork *getFollowFork(); | |||
SignalMask *getSignalMask(); | ||||
const LibraryTracking *getLibraryTracking() const; | const LibraryTracking *getLibraryTracking() const; | |||
const ThreadTracking *getThreadTracking() const; | const ThreadTracking *getThreadTracking() const; | |||
const LWPTracking *getLWPTracking() const; | ||||
const FollowFork *getFollowFork() const; | const FollowFork *getFollowFork() const; | |||
const SignalMask *getSignalMask() const; | ||||
/** | /** | |||
* Errors that occured on this process | * Errors that occured on this process | |||
**/ | **/ | |||
ProcControlAPI::err_t getLastError() const; | ProcControlAPI::err_t getLastError() const; | |||
const char *getLastErrorMsg() const; | const char *getLastErrorMsg() const; | |||
/** | /** | |||
* Executable info | * Executable info | |||
**/ | **/ | |||
skipping to change at line 501 | skipping to change at line 588 | |||
bool stopThread(); | bool stopThread(); | |||
bool continueThread(); | bool continueThread(); | |||
void setSingleStepMode(bool s) const; | void setSingleStepMode(bool s) const; | |||
bool getSingleStepMode() const; | bool getSingleStepMode() const; | |||
bool getRegister(Dyninst::MachRegister reg, Dyninst::MachRegisterVal &va l) const; | bool getRegister(Dyninst::MachRegister reg, Dyninst::MachRegisterVal &va l) const; | |||
bool getAllRegisters(RegisterPool &pool) const; | bool getAllRegisters(RegisterPool &pool) const; | |||
bool setRegister(Dyninst::MachRegister reg, Dyninst::MachRegisterVal val ) const; | bool setRegister(Dyninst::MachRegister reg, Dyninst::MachRegisterVal val ) const; | |||
bool setAllRegisters(RegisterPool &pool) const; | bool setAllRegisters(RegisterPool &pool) const; | |||
bool getAllRegistersAsync(RegisterPool &pool, void *opaque_val = NULL) c | ||||
onst; | ||||
bool setAllRegistersAsync(RegisterPool &pool, void *opaque_val = NULL) c | ||||
onst; | ||||
/** | /** | |||
* User level thread info. Only available after a UserThreadCreate even t | * User level thread info. Only available after a UserThreadCreate even t | |||
**/ | **/ | |||
bool haveUserThreadInfo() const; | bool haveUserThreadInfo() const; | |||
Dyninst::THR_ID getTID() const; | Dyninst::THR_ID getTID() const; | |||
Dyninst::Address getStartFunction() const; | Dyninst::Address getStartFunction() const; | |||
Dyninst::Address getStackBase() const; | Dyninst::Address getStackBase() const; | |||
unsigned long getStackSize() const; | unsigned long getStackSize() const; | |||
Dyninst::Address getTLS() const; | Dyninst::Address getTLS() const; | |||
Dyninst::Address getThreadInfoBlockAddr() const; | ||||
/** | /** | |||
* IRPC | * IRPC | |||
**/ | **/ | |||
bool postIRPC(IRPC::ptr irpc) const; | bool postIRPC(IRPC::ptr irpc) const; | |||
bool runIRPCSync(IRPC::ptr irpc); | bool runIRPCSync(IRPC::ptr irpc); | |||
bool runIRPCAsync(IRPC::ptr irpc); | bool runIRPCAsync(IRPC::ptr irpc); | |||
bool getPostedIRPCs(std::vector<IRPC::ptr> &rpcs) const; | bool getPostedIRPCs(std::vector<IRPC::ptr> &rpcs) const; | |||
IRPC::const_ptr getRunningIRPC() const; | IRPC::const_ptr getRunningIRPC() const; | |||
skipping to change at line 674 | skipping to change at line 764 | |||
typedef void (*notify_cb_t)(); | typedef void (*notify_cb_t)(); | |||
int getFD(); | int getFD(); | |||
void registerCB(notify_cb_t cb); | void registerCB(notify_cb_t cb); | |||
void removeCB(notify_cb_t cb); | void removeCB(notify_cb_t cb); | |||
}; | }; | |||
PC_EXPORT EventNotify *evNotify(); | PC_EXPORT EventNotify *evNotify(); | |||
class PC_EXPORT ExecFileInfo | class PC_EXPORT ExecFileInfo | |||
{ | { | |||
public: | public: | |||
void* fileHandle; | void* fileHandle; | |||
void* processHandle; | void* processHandle; | |||
Address fileBase; | Address fileBase; | |||
}; | }; | |||
} | } | |||
} | } | |||
#endif | #endif | |||
End of changes. 25 change blocks. | ||||
8 lines changed or deleted | 101 lines changed or added | |||
PatchCFG.h | PatchCFG.h | |||
---|---|---|---|---|
skipping to change at line 100 | skipping to change at line 100 | |||
EdgePoints points_; | EdgePoints points_; | |||
}; | }; | |||
class PatchBlock { | class PatchBlock { | |||
friend class PatchEdge; | friend class PatchEdge; | |||
friend class PatchFunction; | friend class PatchFunction; | |||
friend class PatchObject; | friend class PatchObject; | |||
friend class PatchParseCallback; | friend class PatchParseCallback; | |||
public: | public: | |||
typedef std::map<Address, InstructionAPI::Instruction::Ptr> Insns; | typedef std::map<Address, InstructionAPI::Instruction::Ptr> Insns; | |||
typedef std::vector<PatchEdge*> edgelist; | typedef std::vector<PatchEdge*> edgelist; | |||
PATCHAPI_EXPORT static PatchBlock *create(ParseAPI::Block *, PatchFunct ion *); | PATCHAPI_EXPORT static PatchBlock *create(ParseAPI::Block *, PatchFunct ion *); | |||
PATCHAPI_EXPORT PatchBlock(const PatchBlock *parblk, PatchObject *child ); | PATCHAPI_EXPORT PatchBlock(const PatchBlock *parblk, PatchObject *child ); | |||
PATCHAPI_EXPORT PatchBlock(ParseAPI::Block *block, PatchObject *obj); | PATCHAPI_EXPORT PatchBlock(ParseAPI::Block *block, PatchObject *obj); | |||
PATCHAPI_EXPORT virtual ~PatchBlock(); | PATCHAPI_EXPORT virtual ~PatchBlock(); | |||
// Getters | // Getters | |||
PATCHAPI_EXPORT Address start() const; | PATCHAPI_EXPORT Address start() const; | |||
PATCHAPI_EXPORT Address end() const; | PATCHAPI_EXPORT Address end() const; | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
PatchCommon.h | PatchCommon.h | |||
---|---|---|---|---|
skipping to change at line 105 | skipping to change at line 105 | |||
typedef std::set<ParseAPI::CodeObject*> CodeObjectSet; | typedef std::set<ParseAPI::CodeObject*> CodeObjectSet; | |||
typedef std::set<ParseAPI::CodeSource*> CodeSourceSet; | typedef std::set<ParseAPI::CodeSource*> CodeSourceSet; | |||
} | } | |||
} | } | |||
#if defined(_MSC_VER) | #if defined(_MSC_VER) | |||
#define patchapi_debug(...) | #define patchapi_debug(...) | |||
#else | #else | |||
// Get basename | // Get basename | |||
#include <libgen.h> | #include <libgen.h> | |||
#define patchapi_debug(...) do { \ | #define patchapi_debug(PSTR, ...) do { \ | |||
if (getenv("DYNINST_DEBUG_PATCHAPI")) { \ | if (getenv("DYNINST_DEBUG_PATCHAPI")) { \ | |||
const char* nodir = basename(__FILE__); \ | const char* nodir = strrchr(__FILE__, '/'); \ | |||
fprintf(stderr, "%s [%d]: ", nodir, __LINE__); \ | nodir = nodir ? nodir+1 : __FILE__; \ | |||
fprintf(stderr, __VA_ARGS__); \ | fprintf(stderr, "%s [%d]: " PSTR "\n", nodir, __LINE__, ## __VA_ARGS__); | |||
fprintf(stderr, "\n"); \ | \ | |||
fflush(stderr); \ | fflush(stderr); \ | |||
} \ | } \ | |||
else {}; \ | ||||
} while(0) | } while(0) | |||
#endif | #endif | |||
using std::map; | using std::map; | |||
using std::list; | using std::list; | |||
using std::set; | using std::set; | |||
using std::vector; | using std::vector; | |||
using std::cerr; | using std::cerr; | |||
#endif // PATCHAPI_H_COMMON_H_ | #endif // PATCHAPI_H_COMMON_H_ | |||
End of changes. 3 change blocks. | ||||
6 lines changed or deleted | 5 lines changed or added | |||
PatchMgr.h | PatchMgr.h | |||
---|---|---|---|---|
skipping to change at line 39 | skipping to change at line 39 | |||
*/ | */ | |||
/* Public Interface */ | /* Public Interface */ | |||
#ifndef PATCHAPI_H_PATCHMGR_H_ | #ifndef PATCHAPI_H_PATCHMGR_H_ | |||
#define PATCHAPI_H_PATCHMGR_H_ | #define PATCHAPI_H_PATCHMGR_H_ | |||
#include "PatchCommon.h" | #include "PatchCommon.h" | |||
#include "Point.h" | #include "Point.h" | |||
#include "Instrumenter.h" | #include "Instrumenter.h" | |||
#include "PatchCFG.h" | #include "PatchCFG.h" | |||
#include "Buffer.h" | ||||
namespace Dyninst { | namespace Dyninst { | |||
namespace PatchAPI { | namespace PatchAPI { | |||
/* Interfaces for point query, snippet insertion and removal in batch | /* Interfaces for point query, snippet insertion and removal in batch | |||
mode */ | mode */ | |||
class PatchObject; | class PatchObject; | |||
class PatchMgr; | class PatchMgr; | |||
class PatchFunction; | class PatchFunction; | |||
skipping to change at line 81 | skipping to change at line 82 | |||
typedef std::vector<CallSite_t> CallSites; | typedef std::vector<CallSite_t> CallSites; | |||
typedef std::vector<ExitSite_t> ExitSites; | typedef std::vector<ExitSite_t> ExitSites; | |||
typedef std::vector<InsnLoc_t> Insns; | typedef std::vector<InsnLoc_t> Insns; | |||
typedef std::vector<Point::Type> EnumeratedTypes; | typedef std::vector<Point::Type> EnumeratedTypes; | |||
public: | public: | |||
typedef boost::shared_ptr<PatchMgr> Ptr; | typedef boost::shared_ptr<PatchMgr> Ptr; | |||
typedef std::pair<Location, Point::Type> Candidate; | typedef std::pair<Location, Point::Type> Candidate; | |||
typedef std::vector<Candidate> Candidates; | typedef std::vector<Candidate> Candidates; | |||
static void version(int &major, int &minor, int &maintenance); | ||||
PatchMgr(AddrSpace* as, Instrumenter* inst, PointMaker* pf); | PatchMgr(AddrSpace* as, Instrumenter* inst, PointMaker* pf); | |||
PATCHAPI_EXPORT virtual ~PatchMgr(); | PATCHAPI_EXPORT virtual ~PatchMgr(); | |||
PATCHAPI_EXPORT static PatchMgrPtr create(AddrSpace* as, | PATCHAPI_EXPORT static PatchMgrPtr create(AddrSpace* as, | |||
Instrumenter* inst = NULL, | Instrumenter* inst = NULL, | |||
PointMaker* pf = NULL); | PointMaker* pf = NULL); | |||
// Default implementation for filter function, | // Default implementation for filter function, | |||
// used in findPoins and removeSnippets | // used in findPoins and removeSnippets | |||
template <class T> | template <class T> | |||
class IdentityFilterFunc { | class IdentityFilterFunc { | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 3 lines changed or added | |||
PatchObject.h | PatchObject.h | |||
---|---|---|---|---|
skipping to change at line 120 | skipping to change at line 120 | |||
FuncMap funcs_; | FuncMap funcs_; | |||
BlockMap blocks_; | BlockMap blocks_; | |||
EdgeMap edges_; | EdgeMap edges_; | |||
CFGMaker* cfg_maker_; | CFGMaker* cfg_maker_; | |||
PATCHAPI_EXPORT PatchObject(ParseAPI::CodeObject* o, Address a, CFGMake r* cm, PatchCallback *cb = NULL); | PATCHAPI_EXPORT PatchObject(ParseAPI::CodeObject* o, Address a, CFGMake r* cm, PatchCallback *cb = NULL); | |||
PATCHAPI_EXPORT PatchObject(const PatchObject* par_obj, Address a, CFGM aker* cm, PatchCallback *cb = NULL); | PATCHAPI_EXPORT PatchObject(const PatchObject* par_obj, Address a, CFGM aker* cm, PatchCallback *cb = NULL); | |||
PATCHAPI_EXPORT void copyCFG(PatchObject* par_obj); | PATCHAPI_EXPORT void copyCFG(PatchObject* par_obj); | |||
PATCHAPI_EXPORT bool splitBlock(PatchBlock *first, ParseAPI::Block *sec ond); | PATCHAPI_EXPORT bool splitBlock(PatchBlock *first, ParseAPI::Block *sec ond); | |||
void createFuncs(); | ||||
void createBlocks(); | ||||
void createEdges(); | ||||
PatchCallback *cb_; | PatchCallback *cb_; | |||
PatchParseCallback *pcb_; | PatchParseCallback *pcb_; | |||
}; | }; | |||
template <class Iter> | template <class Iter> | |||
void PatchObject::funcs(Iter iter) { | void PatchObject::funcs(Iter iter) { | |||
createFuncs(); | ||||
for (FuncMap::iterator tmp = funcs_.begin(); tmp != funcs_.end(); ++tmp) { | for (FuncMap::iterator tmp = funcs_.begin(); tmp != funcs_.end(); ++tmp) { | |||
*iter = tmp->second; | *iter = tmp->second; | |||
++iter; | ++iter; | |||
} | } | |||
} | } | |||
template <class Iter> | template <class Iter> | |||
void PatchObject::blocks(Iter iter) { | void PatchObject::blocks(Iter iter) { | |||
createBlocks(); | ||||
for (BlockMap::iterator tmp = blocks_.begin(); tmp != blocks_.end(); ++t mp) { | for (BlockMap::iterator tmp = blocks_.begin(); tmp != blocks_.end(); ++t mp) { | |||
*iter = tmp->second; | *iter = tmp->second; | |||
++iter; | ++iter; | |||
} | } | |||
} | } | |||
template <class Iter> | template <class Iter> | |||
void PatchObject::edges(Iter iter) { | void PatchObject::edges(Iter iter) { | |||
createEdges(); | ||||
for (EdgeMap::iterator tmp = edges_.begin(); tmp != edges_.end(); ++tmp) { | for (EdgeMap::iterator tmp = edges_.begin(); tmp != edges_.end(); ++tmp) { | |||
*iter = tmp->second; | *iter = tmp->second; | |||
++iter; | ++iter; | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
#endif // PATCHAPI_H_DYNINST_MODULE_H_ | #endif // PATCHAPI_H_DYNINST_MODULE_H_ | |||
End of changes. 4 change blocks. | ||||
0 lines changed or deleted | 7 lines changed or added | |||
PlatFeatures.h | PlatFeatures.h | |||
---|---|---|---|---|
skipping to change at line 48 | skipping to change at line 48 | |||
#if !defined(PROCESSPLAT_H_) | #if !defined(PROCESSPLAT_H_) | |||
#define PROCESSPLAT_H_ | #define PROCESSPLAT_H_ | |||
class int_process; | class int_process; | |||
class sysv_process; | class sysv_process; | |||
class thread_db_process; | class thread_db_process; | |||
class linux_process; | class linux_process; | |||
namespace bgq { | namespace bgq { | |||
class bgq_process; | class bgq_process; | |||
}; | }; | |||
#if !defined(_MSC_VER) | ||||
//For sigset_t | ||||
#include <signal.h> | ||||
#endif | ||||
namespace Dyninst { | namespace Dyninst { | |||
namespace ProcControlAPI { | namespace ProcControlAPI { | |||
class PC_EXPORT LibraryTracking | class PC_EXPORT LibraryTracking | |||
{ | { | |||
friend class ::sysv_process; | friend class ::sysv_process; | |||
protected: | protected: | |||
LibraryTracking(Process::ptr proc_); | LibraryTracking(Process::ptr proc_); | |||
~LibraryTracking(); | ~LibraryTracking(); | |||
Process::weak_ptr proc; | Process::weak_ptr proc; | |||
skipping to change at line 81 | skipping to change at line 87 | |||
friend class PSetFeatures; | friend class PSetFeatures; | |||
protected: | protected: | |||
LibraryTrackingSet(ProcessSet::ptr ps_); | LibraryTrackingSet(ProcessSet::ptr ps_); | |||
~LibraryTrackingSet(); | ~LibraryTrackingSet(); | |||
ProcessSet::weak_ptr wps; | ProcessSet::weak_ptr wps; | |||
public: | public: | |||
bool setTrackLibraries(bool b) const; | bool setTrackLibraries(bool b) const; | |||
bool refreshLibraries() const; | bool refreshLibraries() const; | |||
}; | }; | |||
class PC_EXPORT LWPTracking | ||||
{ | ||||
friend class ::linux_process; | ||||
friend class bgq::bgq_process; | ||||
protected: | ||||
LWPTracking(Process::ptr proc_); | ||||
~LWPTracking(); | ||||
Process::weak_ptr proc; | ||||
static bool default_track_lwps; | ||||
public: | ||||
static void setDefaultTrackLWPs(bool b); | ||||
static bool getDefaultTrackLWPs(); | ||||
void setTrackLWPs(bool b) const; | ||||
bool getTrackLWPs() const; | ||||
bool refreshLWPs(); | ||||
}; | ||||
class PC_EXPORT LWPTrackingSet | ||||
{ | ||||
friend class ProcessSet; | ||||
friend class PSetFeatures; | ||||
protected: | ||||
LWPTrackingSet(ProcessSet::ptr ps_); | ||||
~LWPTrackingSet(); | ||||
ProcessSet::weak_ptr wps; | ||||
public: | ||||
bool setTrackLWPs(bool b) const; | ||||
bool refreshLWPs() const; | ||||
}; | ||||
class PC_EXPORT ThreadTracking | class PC_EXPORT ThreadTracking | |||
{ | { | |||
friend class ::thread_db_process; | friend class ::thread_db_process; | |||
protected: | protected: | |||
ThreadTracking(Process::ptr proc_); | ThreadTracking(Process::ptr proc_); | |||
~ThreadTracking(); | ~ThreadTracking(); | |||
Process::weak_ptr proc; | Process::weak_ptr proc; | |||
static bool default_track_threads; | static bool default_track_threads; | |||
public: | public: | |||
static void setDefaultTrackThreads(bool b); | static void setDefaultTrackThreads(bool b); | |||
skipping to change at line 206 | skipping to change at line 243 | |||
static std::string getDefaultToolName(); | static std::string getDefaultToolName(); | |||
static priority_t getDefaultToolPriority(); | static priority_t getDefaultToolPriority(); | |||
//Tool name and priority cannot be changed after process creation. | //Tool name and priority cannot be changed after process creation. | |||
//To set these values, use the static methods to set the default, | //To set these values, use the static methods to set the default, | |||
// values, then trigger your attach/create operation. | // values, then trigger your attach/create operation. | |||
std::string getToolName() const; | std::string getToolName() const; | |||
priority_t getToolPriority() const; | priority_t getToolPriority() const; | |||
}; | }; | |||
#if defined(_MSC_VER) | ||||
typedef void* dyn_sigset_t; | ||||
#else | ||||
typedef sigset_t dyn_sigset_t; | ||||
#endif | ||||
//On posix system, the sigset referenced below is a pointer to a sigset_t | ||||
class PC_EXPORT SignalMask | ||||
{ | ||||
friend class ::int_process; | ||||
protected: | ||||
dyn_sigset_t the_sigset; | ||||
static dyn_sigset_t default_sigset; | ||||
static bool sigset_initialized; | ||||
SignalMask(); | ||||
~SignalMask(); | ||||
public: | ||||
static dyn_sigset_t getDefaultSigMask(); | ||||
static void setDefaultSigMask(dyn_sigset_t s); | ||||
dyn_sigset_t getSigMask() const; | ||||
void setSigMask(dyn_sigset_t s); | ||||
}; | ||||
#if 0 | #if 0 | |||
//TO BE IMPLEMENTED | //TO BE IMPLEMENTED | |||
#if defined(_MSC_VER) | #if defined(_MSC_VER) | |||
typedef void* stat_ret_t; | typedef void* stat_ret_t; | |||
#else | #else | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <sys/stat.h> | #include <sys/stat.h> | |||
#include <unistd.h> | #include <unistd.h> | |||
typedef struct stat stat_ret_t; | typedef struct stat stat_ret_t; | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 60 lines changed or added | |||
Point.h | Point.h | |||
---|---|---|---|---|
skipping to change at line 406 | skipping to change at line 406 | |||
std::map<PatchBlock *, Point *> exits; | std::map<PatchBlock *, Point *> exits; | |||
std::map<PatchBlock *, Point *> preCalls; | std::map<PatchBlock *, Point *> preCalls; | |||
std::map<PatchBlock *, Point *> postCalls; | std::map<PatchBlock *, Point *> postCalls; | |||
FuncPoints() : entry(NULL), during(NULL) {}; | FuncPoints() : entry(NULL), during(NULL) {}; | |||
~FuncPoints(); | ~FuncPoints(); | |||
bool consistency(const PatchFunction *func) const; | bool consistency(const PatchFunction *func) const; | |||
}; | }; | |||
} | } | |||
} | } | |||
#endif // PATCHAPI_H_POINT_H_ | #endif // PATCHAPI_H_POINT_H_ | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 1 lines changed or added | |||
ProcessSet.h | ProcessSet.h | |||
---|---|---|---|---|
skipping to change at line 54 | skipping to change at line 54 | |||
namespace Dyninst { | namespace Dyninst { | |||
namespace ProcControlAPI { | namespace ProcControlAPI { | |||
class ProcessSet; | class ProcessSet; | |||
class ThreadSet; | class ThreadSet; | |||
class LibraryTrackingSet; | class LibraryTrackingSet; | |||
class ThreadTrackingSet; | class ThreadTrackingSet; | |||
class CallStackUnwindingSet; | class CallStackUnwindingSet; | |||
class FollowForkSet; | class FollowForkSet; | |||
class LWPTrackingSet; | ||||
class PSetFeatures; | class PSetFeatures; | |||
class TSetFeatures; | class TSetFeatures; | |||
typedef boost::shared_ptr<ProcessSet> ProcessSet_ptr; | typedef boost::shared_ptr<ProcessSet> ProcessSet_ptr; | |||
typedef boost::shared_ptr<ThreadSet> ThreadSet_ptr; | typedef boost::shared_ptr<ThreadSet> ThreadSet_ptr; | |||
typedef boost::shared_ptr<const ProcessSet> ProcessSet_const_ptr; | typedef boost::shared_ptr<const ProcessSet> ProcessSet_const_ptr; | |||
typedef boost::shared_ptr<const ThreadSet> ThreadSet_const_ptr; | typedef boost::shared_ptr<const ThreadSet> ThreadSet_const_ptr; | |||
/** | /** | |||
* AddressSet represents a set of Process/Address pairs. It is used to | * AddressSet represents a set of Process/Address pairs. It is used to | |||
skipping to change at line 324 | skipping to change at line 325 | |||
ProcessSet::ptr getAllThreadRunningSubset() const; | ProcessSet::ptr getAllThreadRunningSubset() const; | |||
ProcessSet::ptr getAnyThreadRunningSubset() const; | ProcessSet::ptr getAnyThreadRunningSubset() const; | |||
ProcessSet::ptr getAllThreadStoppedSubset() const; | ProcessSet::ptr getAllThreadStoppedSubset() const; | |||
ProcessSet::ptr getAnyThreadStoppedSubset() const; | ProcessSet::ptr getAnyThreadStoppedSubset() const; | |||
/** | /** | |||
* Move all processes in set to specified state | * Move all processes in set to specified state | |||
**/ | **/ | |||
bool continueProcs() const; | bool continueProcs() const; | |||
bool stopProcs() const; | bool stopProcs() const; | |||
bool detach() const; | bool detach(bool leaveStopped = false) const; | |||
bool terminate() const; | bool terminate() const; | |||
bool temporaryDetach() const; | bool temporaryDetach() const; | |||
bool reAttach() const; | bool reAttach() const; | |||
/** | /** | |||
* Memory management | * Memory management | |||
**/ | **/ | |||
AddressSet::ptr mallocMemory(size_t size) const; | AddressSet::ptr mallocMemory(size_t size) const; | |||
bool mallocMemory(size_t size, AddressSet::ptr location) const; | bool mallocMemory(size_t size, AddressSet::ptr location) const; | |||
bool freeMemory(AddressSet::ptr addrs) const; | bool freeMemory(AddressSet::ptr addrs) const; | |||
skipping to change at line 389 | skipping to change at line 390 | |||
bool postIRPC(const std::multimap<Process::const_ptr, IRPC::ptr> &rpcs) const; | bool postIRPC(const std::multimap<Process::const_ptr, IRPC::ptr> &rpcs) const; | |||
bool postIRPC(IRPC::ptr irpc, std::multimap<Process::ptr, IRPC::ptr> *re sult = NULL) const; | bool postIRPC(IRPC::ptr irpc, std::multimap<Process::ptr, IRPC::ptr> *re sult = NULL) const; | |||
bool postIRPC(IRPC::ptr irpc, AddressSet::ptr addrs, std::multimap<Proce ss::ptr, IRPC::ptr> *result = NULL) const; | bool postIRPC(IRPC::ptr irpc, AddressSet::ptr addrs, std::multimap<Proce ss::ptr, IRPC::ptr> *result = NULL) const; | |||
/** | /** | |||
* Perform specific operations. Interface objects will only be returned | * Perform specific operations. Interface objects will only be returned | |||
* on appropriately supported platforms, others will return NULL. | * on appropriately supported platforms, others will return NULL. | |||
**/ | **/ | |||
LibraryTrackingSet *getLibraryTracking(); | LibraryTrackingSet *getLibraryTracking(); | |||
ThreadTrackingSet *getThreadTracking(); | ThreadTrackingSet *getThreadTracking(); | |||
LWPTrackingSet *getLWPTracking(); | ||||
FollowForkSet *getFollowFork(); | FollowForkSet *getFollowFork(); | |||
const LibraryTrackingSet *getLibraryTracking() const; | const LibraryTrackingSet *getLibraryTracking() const; | |||
const ThreadTrackingSet *getThreadTracking() const; | const ThreadTrackingSet *getThreadTracking() const; | |||
const LWPTrackingSet *getLWPTracking() const; | ||||
const FollowForkSet *getFollowFork() const; | const FollowForkSet *getFollowFork() const; | |||
}; | }; | |||
/** | /** | |||
* Return a unique ProcessSet representing every running process. It is an error to try to | * Return a unique ProcessSet representing every running process. It is an error to try to | |||
* manually modify this ProcessSet. Modifications are done automatically b y ProcControlAPI | * manually modify this ProcessSet. Modifications are done automatically b y ProcControlAPI | |||
* as processes are created and destroyed. | * as processes are created and destroyed. | |||
**/ | **/ | |||
ProcessSet::const_ptr getAllProcs(); | ProcessSet::const_ptr getAllProcs(); | |||
skipping to change at line 425 | skipping to change at line 428 | |||
int_threadSet *getIntThreadSet() const; | int_threadSet *getIntThreadSet() const; | |||
/** | /** | |||
* Create a new ThreadSet given existing threads | * Create a new ThreadSet given existing threads | |||
**/ | **/ | |||
static ThreadSet::ptr newThreadSet(); | static ThreadSet::ptr newThreadSet(); | |||
static ThreadSet::ptr newThreadSet(Thread::ptr thr); | static ThreadSet::ptr newThreadSet(Thread::ptr thr); | |||
static ThreadSet::ptr newThreadSet(const ThreadPool &threadp); | static ThreadSet::ptr newThreadSet(const ThreadPool &threadp); | |||
static ThreadSet::ptr newThreadSet(const std::set<Thread::const_ptr> &th reads); | static ThreadSet::ptr newThreadSet(const std::set<Thread::const_ptr> &th reads); | |||
static ThreadSet::ptr newThreadSet(ProcessSet::ptr ps); | static ThreadSet::ptr newThreadSet(ProcessSet::ptr ps, bool initial_only = false); | |||
/** | /** | |||
* Modify current set by performing these set operations with another se t. | * Modify current set by performing these set operations with another se t. | |||
**/ | **/ | |||
ThreadSet::ptr set_union(ThreadSet::ptr tp) const; | ThreadSet::ptr set_union(ThreadSet::ptr tp) const; | |||
ThreadSet::ptr set_intersection(ThreadSet::ptr tp) const; | ThreadSet::ptr set_intersection(ThreadSet::ptr tp) const; | |||
ThreadSet::ptr set_difference(ThreadSet::ptr tp) const; | ThreadSet::ptr set_difference(ThreadSet::ptr tp) const; | |||
/** | /** | |||
* Iterator and standard set utilities | * Iterator and standard set utilities | |||
End of changes. 5 change blocks. | ||||
2 lines changed or deleted | 5 lines changed or added | |||
SymLiteCodeSource.h | SymLiteCodeSource.h | |||
---|---|---|---|---|
skipping to change at line 53 | skipping to change at line 53 | |||
class CFGModifier; | class CFGModifier; | |||
/** SymReaderCodeRegion and SymReaderCodeSource implement CodeSource for pr ogram | /** SymReaderCodeRegion and SymReaderCodeSource implement CodeSource for pr ogram | |||
binaries supported by the SymReaderAPI | binaries supported by the SymReaderAPI | |||
**/ | **/ | |||
class SymReaderCodeRegion : public CodeRegion { | class SymReaderCodeRegion : public CodeRegion { | |||
private: | private: | |||
SymReader * _symtab; | SymReader * _symtab; | |||
SymRegion * _region; | SymSegment * _region; | |||
void* rawData; | void* rawData; | |||
public: | public: | |||
PARSER_EXPORT SymReaderCodeRegion(SymReader *, SymRegion *); | PARSER_EXPORT SymReaderCodeRegion(SymReader *, SymSegment *); | |||
PARSER_EXPORT ~SymReaderCodeRegion(); | PARSER_EXPORT ~SymReaderCodeRegion(); | |||
PARSER_EXPORT void names(Address, vector<std::string> &); | PARSER_EXPORT void names(Address, vector<std::string> &); | |||
PARSER_EXPORT bool findCatchBlock(Address addr, Address & catchStart); | PARSER_EXPORT bool findCatchBlock(Address addr, Address & catchStart); | |||
/** InstructionSource implementation **/ | /** InstructionSource implementation **/ | |||
PARSER_EXPORT bool isValidAddress(const Address) const; | PARSER_EXPORT bool isValidAddress(const Address) const; | |||
PARSER_EXPORT void* getPtrToInstruction(const Address) const; | PARSER_EXPORT void* getPtrToInstruction(const Address) const; | |||
PARSER_EXPORT void* getPtrToData(const Address) const; | PARSER_EXPORT void* getPtrToData(const Address) const; | |||
PARSER_EXPORT unsigned int getAddressWidth() const; | PARSER_EXPORT unsigned int getAddressWidth() const; | |||
PARSER_EXPORT bool isCode(const Address) const; | PARSER_EXPORT bool isCode(const Address) const; | |||
PARSER_EXPORT bool isData(const Address) const; | PARSER_EXPORT bool isData(const Address) const; | |||
PARSER_EXPORT Address offset() const; | PARSER_EXPORT Address offset() const; | |||
PARSER_EXPORT Address length() const; | PARSER_EXPORT Address length() const; | |||
PARSER_EXPORT Architecture getArch() const; | PARSER_EXPORT Architecture getArch() const; | |||
/** interval **/ | /** interval **/ | |||
PARSER_EXPORT Address low() const { return offset(); } | PARSER_EXPORT Address low() const { return offset(); } | |||
PARSER_EXPORT Address high() const { return offset() + length(); } | PARSER_EXPORT Address high() const { return offset() + length(); } | |||
PARSER_EXPORT SymRegion * symRegion() const { return _region; } | PARSER_EXPORT SymSegment * symRegion() const { return _region; } | |||
}; | }; | |||
class SymReaderCodeSource : public CodeSource { | class SymReaderCodeSource : public CodeSource { | |||
private: | private: | |||
SymReader * _symtab; | SymReader * _symtab; | |||
bool owns_symtab; | bool owns_symtab; | |||
mutable CodeRegion * _lookup_cache; | mutable CodeRegion * _lookup_cache; | |||
static dyn_hash_map<std::string, bool> non_returning_funcs; | static dyn_hash_map<std::string, bool> non_returning_funcs; | |||
skipping to change at line 102 | skipping to change at line 102 | |||
public: | public: | |||
PARSER_EXPORT SymReaderCodeSource(SymReader *); | PARSER_EXPORT SymReaderCodeSource(SymReader *); | |||
PARSER_EXPORT SymReaderCodeSource(const char *); | PARSER_EXPORT SymReaderCodeSource(const char *); | |||
PARSER_EXPORT ~SymReaderCodeSource(); | PARSER_EXPORT ~SymReaderCodeSource(); | |||
PARSER_EXPORT bool nonReturning(Address func_entry); | PARSER_EXPORT bool nonReturning(Address func_entry); | |||
PARSER_EXPORT bool nonReturning(std::string func_name); | PARSER_EXPORT bool nonReturning(std::string func_name); | |||
PARSER_EXPORT bool resizeRegion(SymRegion *, Address newDiskSize); | PARSER_EXPORT bool resizeRegion(SymSegment *, Address newDiskSize); | |||
PARSER_EXPORT SymReader * getSymReaderObject() {return _symtab;} | PARSER_EXPORT SymReader * getSymReaderObject() {return _symtab;} | |||
/** InstructionSource implementation **/ | /** InstructionSource implementation **/ | |||
PARSER_EXPORT bool isValidAddress(const Address) const; | PARSER_EXPORT bool isValidAddress(const Address) const; | |||
PARSER_EXPORT void* getPtrToInstruction(const Address) const; | PARSER_EXPORT void* getPtrToInstruction(const Address) const; | |||
PARSER_EXPORT void* getPtrToData(const Address) const; | PARSER_EXPORT void* getPtrToData(const Address) const; | |||
PARSER_EXPORT unsigned int getAddressWidth() const; | PARSER_EXPORT unsigned int getAddressWidth() const; | |||
PARSER_EXPORT bool isCode(const Address) const; | PARSER_EXPORT bool isCode(const Address) const; | |||
PARSER_EXPORT bool isData(const Address) const; | PARSER_EXPORT bool isData(const Address) const; | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
SymReader.h | SymReader.h | |||
---|---|---|---|---|
skipping to change at line 49 | skipping to change at line 49 | |||
class SymbolReaderFactory; | class SymbolReaderFactory; | |||
/** | /** | |||
* Symbol_t is an anonymous struct that any SymReader can use for a symbol | * Symbol_t is an anonymous struct that any SymReader can use for a symbol | |||
* handle. Some symbol readers may not want to store the objects behind a | * handle. Some symbol readers may not want to store the objects behind a | |||
* 'void*' on the heap, so we're making Symbol_t big enough that it could | * 'void*' on the heap, so we're making Symbol_t big enough that it could | |||
* act as a full symbol handle. Or a SymReader could just choose fill in o ne | * act as a full symbol handle. Or a SymReader could just choose fill in o ne | |||
* of the void pointers as a handle to a heap object, if it's comfortable | * of the void pointers as a handle to a heap object, if it's comfortable | |||
* doing so. | * doing so. | |||
**/ | **/ | |||
typedef struct { | struct Symbol_t { | |||
void *v1; | void *v1; | |||
void *v2; | void *v2; | |||
int i1; | int i1; | |||
int i2; | int i2; | |||
} Symbol_t; | }; | |||
typedef struct { | struct Section_t { | |||
void *v1; | void *v1; | |||
void *v2; | void *v2; | |||
int i1; | int i1; | |||
int i2; | int i2; | |||
} Section_t; | }; | |||
typedef struct { | struct SymSegment { | |||
Dyninst::Offset file_offset; | Dyninst::Offset file_offset; | |||
Dyninst::Address mem_addr; | Dyninst::Address mem_addr; | |||
size_t file_size; | size_t file_size; | |||
size_t mem_size; | size_t mem_size; | |||
int type; | int type; | |||
int perms; | int perms; | |||
} SymRegion; | }; | |||
/** | /** | |||
* This may seem like a clunky interface in places, but it was designed suc h | * This may seem like a clunky interface in places, but it was designed suc h | |||
* that the underlying implementation could be made re-enterant safe (so it | * that the underlying implementation could be made re-enterant safe (so it | |||
* could be called from a signal handler). | * could be called from a signal handler). | |||
**/ | **/ | |||
class COMMON_EXPORT SymReader | class COMMON_EXPORT SymReader | |||
{ | { | |||
protected: | protected: | |||
SymReader() {} | SymReader() {} | |||
virtual ~SymReader() {} | virtual ~SymReader() {} | |||
public: | public: | |||
virtual Symbol_t getSymbolByName(std::string symname) = 0; | virtual Symbol_t getSymbolByName(std::string symname) = 0; | |||
virtual Symbol_t getContainingSymbol(Dyninst::Offset offset) = 0; | virtual Symbol_t getContainingSymbol(Dyninst::Offset offset) = 0; | |||
virtual std::string getInterpreterName() = 0; | virtual std::string getInterpreterName() = 0; | |||
virtual unsigned getAddressWidth() = 0; | virtual unsigned getAddressWidth() = 0; | |||
virtual unsigned numRegions() = 0; | virtual unsigned numSegments() = 0; | |||
virtual bool getRegion(unsigned num, SymRegion ®) = 0; | virtual bool getSegment(unsigned num, SymSegment ®) = 0; | |||
virtual Dyninst::Offset getSymbolOffset(const Symbol_t &sym) = 0; | virtual Dyninst::Offset getSymbolOffset(const Symbol_t &sym) = 0; | |||
virtual Dyninst::Offset getSymbolTOC(const Symbol_t &sym) = 0; | ||||
virtual std::string getSymbolName(const Symbol_t &sym) = 0; | virtual std::string getSymbolName(const Symbol_t &sym) = 0; | |||
virtual std::string getDemangledName(const Symbol_t &sym) = 0; | virtual std::string getDemangledName(const Symbol_t &sym) = 0; | |||
virtual unsigned long getSymbolSize(const Symbol_t &sym) = 0; | virtual unsigned long getSymbolSize(const Symbol_t &sym) = 0; | |||
virtual bool isValidSymbol(const Symbol_t &sym) = 0; | virtual bool isValidSymbol(const Symbol_t &sym) = 0; | |||
virtual Section_t getSectionByName(std::string name) = 0; | virtual Section_t getSectionByName(std::string name) = 0; | |||
virtual Section_t getSectionByAddress(Dyninst::Address addr) = 0; | virtual Section_t getSectionByAddress(Dyninst::Address addr) = 0; | |||
virtual Dyninst::Address getSectionAddress(Section_t sec) = 0; | virtual Dyninst::Address getSectionAddress(Section_t sec) = 0; | |||
virtual std::string getSectionName(Section_t sec) = 0; | virtual std::string getSectionName(Section_t sec) = 0; | |||
virtual bool isValidSection(Section_t sec) = 0; | virtual bool isValidSection(Section_t sec) = 0; | |||
End of changes. 8 change blocks. | ||||
8 lines changed or deleted | 9 lines changed or added | |||
Symbol.h | Symbol.h | |||
---|---|---|---|---|
skipping to change at line 92 | skipping to change at line 92 | |||
public: | public: | |||
enum SymbolType { | enum SymbolType { | |||
ST_UNKNOWN, | ST_UNKNOWN, | |||
ST_FUNCTION, | ST_FUNCTION, | |||
ST_OBJECT, | ST_OBJECT, | |||
ST_MODULE, | ST_MODULE, | |||
ST_SECTION, | ST_SECTION, | |||
ST_TLS, | ST_TLS, | |||
ST_DELETED, | ST_DELETED, | |||
ST_INDIRECT, | ||||
ST_NOTYPE | ST_NOTYPE | |||
}; | }; | |||
static const char *symbolType2Str(SymbolType t); | static const char *symbolType2Str(SymbolType t); | |||
enum SymbolLinkage { | enum SymbolLinkage { | |||
SL_UNKNOWN, | SL_UNKNOWN, | |||
SL_GLOBAL, | SL_GLOBAL, | |||
SL_LOCAL, | SL_LOCAL, | |||
SL_WEAK | SL_WEAK | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 1 lines changed or added | |||
Symtab.h | Symtab.h | |||
---|---|---|---|---|
skipping to change at line 49 | skipping to change at line 49 | |||
#include "Annotatable.h" | #include "Annotatable.h" | |||
#include "Serialization.h" | #include "Serialization.h" | |||
#include "ProcReader.h" | #include "ProcReader.h" | |||
#include "boost/shared_ptr.hpp" | #include "boost/shared_ptr.hpp" | |||
class MappedFile; | class MappedFile; | |||
#define SYM_MAJOR 6 | #define SYM_MAJOR 8 | |||
#define SYM_MINOR 2 | #define SYM_MINOR 1 | |||
#define SYM_BETA 1 | #define SYM_BETA 1 | |||
namespace Dyninst { | namespace Dyninst { | |||
struct SymSegment; | ||||
namespace SymtabAPI { | namespace SymtabAPI { | |||
class Archive; | class Archive; | |||
class builtInTypeCollection; | class builtInTypeCollection; | |||
class ExceptionBlock; | class ExceptionBlock; | |||
class Object; | class Object; | |||
class localVar; | class localVar; | |||
class relocationEntry; | class relocationEntry; | |||
class Type; | class Type; | |||
skipping to change at line 408 | skipping to change at line 410 | |||
// Used by binaryEdit.C... | // Used by binaryEdit.C... | |||
public: | public: | |||
SYMTAB_EXPORT bool canBeShared(); | SYMTAB_EXPORT bool canBeShared(); | |||
SYMTAB_EXPORT Module *getOrCreateModule(const std::string &modName, | SYMTAB_EXPORT Module *getOrCreateModule(const std::string &modName, | |||
const Offset modAddr); | const Offset modAddr); | |||
public: | public: | |||
//Only valid on ELF formats | //Only valid on ELF formats | |||
SYMTAB_EXPORT Offset getElfDynamicOffset(); | SYMTAB_EXPORT Offset getElfDynamicOffset(); | |||
// SymReader interface | ||||
SYMTAB_EXPORT void getSegmentsSymReader(std::vector<SymSegment> &segs); | ||||
private: | private: | |||
void createDefaultModule(); | void createDefaultModule(); | |||
Module *newModule(const std::string &name, const Offset addr, supportedL anguages lang); | Module *newModule(const std::string &name, const Offset addr, supportedL anguages lang); | |||
//bool buildFunctionLists(std::vector <Symbol *> &raw_funcs); | //bool buildFunctionLists(std::vector <Symbol *> &raw_funcs); | |||
//void enterFunctionInTables(Symbol *func, bool wasSymtab); | //void enterFunctionInTables(Symbol *func, bool wasSymtab); | |||
bool addSymtabVariables(); | bool addSymtabVariables(); | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 6 lines changed or added | |||
SymtabReader.h | SymtabReader.h | |||
---|---|---|---|---|
skipping to change at line 49 | skipping to change at line 49 | |||
// either define its own SymReader (as ProcControlAPI does) or it can use S ymtabAPI as | // either define its own SymReader (as ProcControlAPI does) or it can use S ymtabAPI as | |||
// its symbol reader. These SymtabReader and SymtabReaderFactory implement the SymReader | // its symbol reader. These SymtabReader and SymtabReaderFactory implement the SymReader | |||
// interface with a SymtabAPI implementation. | // interface with a SymtabAPI implementation. | |||
namespace Dyninst { | namespace Dyninst { | |||
namespace SymtabAPI { | namespace SymtabAPI { | |||
class Symtab; | class Symtab; | |||
class Region; | class Region; | |||
class FastParser; | class FastParser; | |||
class DwarfHandle; | ||||
class SYMTAB_EXPORT SymtabReaderFactory : public SymbolReaderFactory | class SYMTAB_EXPORT SymtabReaderFactory : public SymbolReaderFactory | |||
{ | { | |||
private: | private: | |||
std::map<std::string, SymReader *> open_syms; | std::map<std::string, SymReader *> open_syms; | |||
public: | public: | |||
SymtabReaderFactory(); | SymtabReaderFactory(); | |||
virtual ~SymtabReaderFactory(); | virtual ~SymtabReaderFactory(); | |||
virtual SymReader *openSymbolReader(std::string pathname); | virtual SymReader *openSymbolReader(std::string pathname); | |||
virtual SymReader *openSymbolReader(const char *buffer, unsigned long si ze); | virtual SymReader *openSymbolReader(const char *buffer, unsigned long si ze); | |||
virtual bool closeSymbolReader(SymReader *sr); | virtual bool closeSymbolReader(SymReader *sr); | |||
}; | }; | |||
class SYMTAB_EXPORT SymtabReader : public SymReader { | class SYMTAB_EXPORT SymtabReader : public SymReader { | |||
friend class SymtabReaderFactory; | friend class SymtabReaderFactory; | |||
protected: | protected: | |||
Symtab *symtab; | Symtab *symtab; | |||
int ref_count; | int ref_count; | |||
std::vector<Region *> *mapped_regions; | std::vector<SymSegment> segments; | |||
DwarfHandle *dwarf_handle; | ||||
bool ownsSymtab; | bool ownsSymtab; | |||
public: | public: | |||
SymtabReader(std::string file_); | SymtabReader(std::string file_); | |||
SymtabReader(const char *buffer, unsigned long size); | SymtabReader(const char *buffer, unsigned long size); | |||
SymtabReader(Symtab *s); | SymtabReader(Symtab *s); | |||
virtual ~SymtabReader(); | virtual ~SymtabReader(); | |||
virtual Symbol_t getSymbolByName(std::string symname); | virtual Symbol_t getSymbolByName(std::string symname); | |||
virtual unsigned long getSymbolSize(const Symbol_t &sym); | virtual unsigned long getSymbolSize(const Symbol_t &sym); | |||
virtual Symbol_t getContainingSymbol(Dyninst::Offset offset); | virtual Symbol_t getContainingSymbol(Dyninst::Offset offset); | |||
virtual std::string getInterpreterName(); | virtual std::string getInterpreterName(); | |||
virtual unsigned getAddressWidth(); | virtual unsigned getAddressWidth(); | |||
virtual unsigned numRegions(); | virtual unsigned numSegments(); | |||
virtual bool getRegion(unsigned num, SymRegion ®); | virtual bool getSegment(unsigned num, SymSegment &seg); | |||
virtual Dyninst::Offset getSymbolOffset(const Symbol_t &sym); | virtual Dyninst::Offset getSymbolOffset(const Symbol_t &sym); | |||
virtual Dyninst::Offset getSymbolTOC(const Symbol_t &sym); | ||||
virtual std::string getSymbolName(const Symbol_t &sym); | virtual std::string getSymbolName(const Symbol_t &sym); | |||
virtual std::string getDemangledName(const Symbol_t &sym); | virtual std::string getDemangledName(const Symbol_t &sym); | |||
virtual bool isValidSymbol(const Symbol_t &sym); | virtual bool isValidSymbol(const Symbol_t &sym); | |||
virtual Section_t getSectionByName(std::string name); | virtual Section_t getSectionByName(std::string name); | |||
virtual Section_t getSectionByAddress(Dyninst::Address addr); | virtual Section_t getSectionByAddress(Dyninst::Address addr); | |||
virtual Dyninst::Address getSectionAddress(Section_t sec); | virtual Dyninst::Address getSectionAddress(Section_t sec); | |||
virtual std::string getSectionName(Section_t sec); | virtual std::string getSectionName(Section_t sec); | |||
virtual bool isValidSection(Section_t sec); | virtual bool isValidSection(Section_t sec); | |||
virtual Dyninst::Offset imageOffset(); | virtual Dyninst::Offset imageOffset(); | |||
virtual Dyninst::Offset dataOffset(); | virtual Dyninst::Offset dataOffset(); | |||
virtual void *getElfHandle(); | virtual void *getElfHandle(); | |||
private: | ||||
void *getDebugInfo(); | void buildSegments(); | |||
}; | }; | |||
extern "C" { | extern "C" { | |||
SYMTAB_EXPORT SymbolReaderFactory *getSymtabReaderFactory(); | SYMTAB_EXPORT SymbolReaderFactory *getSymtabReaderFactory(); | |||
} | } | |||
} | } | |||
} | } | |||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
7 lines changed or deleted | 7 lines changed or added | |||
basetypes.h | basetypes.h | |||
---|---|---|---|---|
skipping to change at line 37 | skipping to change at line 37 | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | */ | |||
#ifndef BASETYPES_H_ | #ifndef BASETYPES_H_ | |||
#define BASETYPES_H_ | #define BASETYPES_H_ | |||
#include "dyntypes.h" | #include "dyntypes.h" | |||
#include "dyn_regs.h" | #include "dyn_regs.h" | |||
#include "SymReader.h" | #include "SymReader.h" | |||
#include <sstream> | ||||
#include <iostream> | ||||
namespace Dyninst { | namespace Dyninst { | |||
namespace Stackwalker { | namespace Stackwalker { | |||
typedef enum { loc_address, loc_register, loc_unknown } storage_t; | typedef enum { loc_address, loc_register, loc_unknown } storage_t; | |||
struct location_t { | struct location_t { | |||
bool operator==(const location_t &L) const | bool operator==(const location_t &L) const | |||
{ | { | |||
return ((val.addr == L.val.addr) && | return ((val.addr == L.val.addr) && | |||
(val.reg == L.val.reg) && | (val.reg == L.val.reg) && | |||
(location == L.location)); | (location == L.location)); | |||
} | } | |||
struct { | struct { | |||
Dyninst::Address addr; | Dyninst::Address addr; | |||
Dyninst::MachRegister reg; | Dyninst::MachRegister reg; | |||
} val; | } val; | |||
storage_t location; | storage_t location; | |||
std::string format() const { | ||||
std::stringstream ret; | ||||
switch (location) { | ||||
case loc_unknown: | ||||
ret << "<loc: unknown>"; | ||||
break; | ||||
case loc_register: | ||||
ret << "<loc: reg " << val.reg.name() << ">"; | ||||
break; | ||||
case loc_address: | ||||
ret << "<loc: addr " << std::hex << val.addr << ">" << std::dec; | ||||
break; | ||||
} | ||||
return ret.str(); | ||||
} | ||||
}; | }; | |||
} | } | |||
} | } | |||
#endif | #endif | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 19 lines changed or added | |||
dyn_regs.h | dyn_regs.h | |||
---|---|---|---|---|
skipping to change at line 43 | skipping to change at line 43 | |||
#include "util.h" | #include "util.h" | |||
#include "boost/shared_ptr.hpp" | #include "boost/shared_ptr.hpp" | |||
#include <assert.h> | #include <assert.h> | |||
#include <map> | #include <map> | |||
#include <string> | #include <string> | |||
namespace Dyninst | namespace Dyninst | |||
{ | { | |||
struct x86OperandParser; | ||||
struct ppcOperandParser; | ||||
typedef unsigned long MachRegisterVal; | typedef unsigned long MachRegisterVal; | |||
typedef enum | typedef enum | |||
{ | { | |||
Arch_none = 0x00000000, | Arch_none = 0x00000000, | |||
Arch_x86 = 0x14000000, | Arch_x86 = 0x14000000, | |||
Arch_x86_64 = 0x18000000, | Arch_x86_64 = 0x18000000, | |||
Arch_ppc32 = 0x24000000, | Arch_ppc32 = 0x24000000, | |||
Arch_ppc64 = 0x28000000 | Arch_ppc64 = 0x28000000 | |||
} Architecture; | } Architecture; | |||
COMMON_EXPORT bool isSegmentRegister(int regClass); | COMMON_EXPORT bool isSegmentRegister(int regClass); | |||
COMMON_EXPORT unsigned getArchAddressWidth(Dyninst::Architecture arch); | COMMON_EXPORT unsigned getArchAddressWidth(Dyninst::Architecture arch); | |||
class COMMON_EXPORT MachRegister { | class COMMON_EXPORT MachRegister { | |||
private: | friend struct ::Dyninst::x86OperandParser; | |||
friend struct ::Dyninst::ppcOperandParser; | ||||
private: | ||||
signed int reg; | signed int reg; | |||
typedef std::map<signed int, std::string> NameMap; | typedef std::map<signed int, std::string> NameMap; | |||
static boost::shared_ptr<MachRegister::NameMap> names(); | static boost::shared_ptr<MachRegister::NameMap> names(); | |||
void init_names(); | void init_names(); | |||
public: | public: | |||
MachRegister(); | MachRegister(); | |||
explicit MachRegister(signed int r); | explicit MachRegister(signed int r); | |||
explicit MachRegister(signed int r, const char *n); | explicit MachRegister(signed int r, const char *n); | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added | |||
dyninstRTExport.h | dyninstRTExport.h | |||
---|---|---|---|---|
skipping to change at line 102 | skipping to change at line 102 | |||
DLLEXPORT void dyninst_free_lock(dyninst_lock_t *lock); | DLLEXPORT void dyninst_free_lock(dyninst_lock_t *lock); | |||
DLLEXPORT int dyninst_lock(dyninst_lock_t *lock); | DLLEXPORT int dyninst_lock(dyninst_lock_t *lock); | |||
DLLEXPORT void dyninst_unlock(dyninst_lock_t *lock); | DLLEXPORT void dyninst_unlock(dyninst_lock_t *lock); | |||
/** | /** | |||
* Functions for retrieving information about threads | * Functions for retrieving information about threads | |||
**/ | **/ | |||
DLLEXPORT unsigned dyninst_maxNumOfThreads(); | DLLEXPORT unsigned dyninst_maxNumOfThreads(); | |||
DLLEXPORT unsigned dyninst_threadIndex(); | DLLEXPORT unsigned dyninst_threadIndex(); | |||
/** | ||||
* Internal functions that we export to ensure they show up. | ||||
**/ | ||||
DLLEXPORT void DYNINSTinit(int, int, int, int); | ||||
DLLEXPORT void DYNINST_snippetBreakpoint(); | ||||
DLLEXPORT void DYNINST_stopThread(void *, void *, void *, void *); | ||||
DLLEXPORT void DYNINST_stopInterProc(void *, void *, void *, void *, void * | ||||
, void *); | ||||
DLLEXPORT void RThandleShadow(void *, void *, void *, void *, void *); | ||||
DLLEXPORT unsigned long RTtranslateMemory(unsigned long, unsigned long, uns | ||||
igned long); | ||||
DLLEXPORT unsigned long RTtranslateMemoryShift(unsigned long, unsigned long | ||||
, unsigned long); | ||||
DLLEXPORT int DYNINSTthreadIndex(); | ||||
DLLEXPORT void *DYNINSTos_malloc(size_t, void *, void *); | ||||
/** | ||||
* And variables | ||||
**/ | ||||
DLLEXPORT extern dyntid_t (*DYNINST_pthread_self)(void); | ||||
DLLEXPORT extern unsigned int DYNINSTobsCostLow; | ||||
DLLEXPORT extern int libdyninstAPI_RT_init_maxthreads; | ||||
DLLEXPORT extern int libdyninstAPI_RT_init_localCause; | ||||
DLLEXPORT extern int libdyninstAPI_RT_init_localPid; | ||||
DLLEXPORT extern int libdyninstAPI_RT_init_debug_flag; | ||||
DLLEXPORT extern struct DYNINST_bootstrapStruct DYNINST_bootstrap_info; | ||||
DLLEXPORT extern unsigned *DYNINST_tramp_guards; | ||||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 30 lines changed or added | |||
entryIDs.h | entryIDs.h | |||
---|---|---|---|---|
skipping to change at line 99 | skipping to change at line 99 | |||
e_addsd, | e_addsd, | |||
e_addss, | e_addss, | |||
e_addsubpd, | e_addsubpd, | |||
e_addsubps, | e_addsubps, | |||
e_and, | e_and, | |||
e_andnpd, | e_andnpd, | |||
e_andnps, | e_andnps, | |||
e_andpd, | e_andpd, | |||
e_andps, | e_andps, | |||
e_arpl, | e_arpl, | |||
e_blendpd, // SSE 4.1 | ||||
e_blendps, // SSE 4.1 | ||||
e_blendvpd, // SSE 4.1 | ||||
e_blendvps, // SSE 4.1 | ||||
e_bound, | e_bound, | |||
e_bsf, | e_bsf, | |||
e_bsr, | e_bsr, | |||
e_bswap, | e_bswap, | |||
e_bt, | e_bt, | |||
e_btc, | e_btc, | |||
e_btr, | e_btr, | |||
e_bts, | e_bts, | |||
e_cbw, | e_cbw, | |||
e_cdq, | e_cdq, | |||
skipping to change at line 133 | skipping to change at line 137 | |||
e_cmovnl, | e_cmovnl, | |||
e_cmovno, | e_cmovno, | |||
e_cmovns, | e_cmovns, | |||
e_cmovo, | e_cmovo, | |||
e_cmovpe, | e_cmovpe, | |||
e_cmovpo, | e_cmovpo, | |||
e_cmovs, | e_cmovs, | |||
e_comisd, | e_comisd, | |||
e_comiss, | e_comiss, | |||
e_cpuid, | e_cpuid, | |||
e_crc32, // SSE 4.2 | ||||
e_cvtdq2pd, | e_cvtdq2pd, | |||
e_cvtdq2ps, | e_cvtdq2ps, | |||
e_cvtpd2dq, | e_cvtpd2dq, | |||
e_cvtpd2pi, | e_cvtpd2pi, | |||
e_cvtpd2ps, | e_cvtpd2ps, | |||
e_cvtpi2pd, | e_cvtpi2pd, | |||
e_cvtpi2ps, | e_cvtpi2ps, | |||
e_cvtps2dq, | e_cvtps2dq, | |||
e_cvtps2pd, | e_cvtps2pd, | |||
e_cvtps2pi, | e_cvtps2pi, | |||
skipping to change at line 165 | skipping to change at line 170 | |||
e_cwd, | e_cwd, | |||
e_cwde, | e_cwde, | |||
e_daa, | e_daa, | |||
e_das, | e_das, | |||
e_dec, | e_dec, | |||
e_div, | e_div, | |||
e_divpd, | e_divpd, | |||
e_divps, | e_divps, | |||
e_divsd, | e_divsd, | |||
e_divss, | e_divss, | |||
e_dppd, // SSE 4.1 | ||||
e_dpps, // SSE 4.1 | ||||
e_emms, | e_emms, | |||
e_enter, | e_enter, | |||
e_extractps, // SSE 4.1 | ||||
e_extrq, | e_extrq, | |||
e_fadd, | e_fadd, | |||
e_faddp, | e_faddp, | |||
e_f2xm1, | e_f2xm1, | |||
e_fbld, | e_fbld, | |||
e_fbstp, | e_fbstp, | |||
e_fchs, | e_fchs, | |||
e_fcmovb, | e_fcmovb, | |||
e_fcmovbe, | e_fcmovbe, | |||
e_fcmove, | e_fcmove, | |||
skipping to change at line 243 | skipping to change at line 251 | |||
e_haddps, | e_haddps, | |||
e_hlt, | e_hlt, | |||
e_hsubpd, | e_hsubpd, | |||
e_hsubps, | e_hsubps, | |||
e_idiv, | e_idiv, | |||
e_imul, | e_imul, | |||
e_in, | e_in, | |||
e_inc, | e_inc, | |||
e_insb, | e_insb, | |||
e_insd, | e_insd, | |||
e_insertps, // SSE 4.1 | ||||
e_insertq, | e_insertq, | |||
e_insw, | e_insw, | |||
e_int, | e_int, | |||
e_int3, | e_int3, | |||
e_int1, | e_int1, | |||
e_int80, | e_int80, | |||
e_into, | e_into, | |||
e_invd, | e_invd, | |||
e_invlpg, | e_invlpg, | |||
e_iret, | e_iret, | |||
skipping to change at line 303 | skipping to change at line 312 | |||
e_movdqu, | e_movdqu, | |||
e_movhpd, | e_movhpd, | |||
e_movhps, | e_movhps, | |||
e_movhps_movlhps, | e_movhps_movlhps, | |||
e_movlpd, | e_movlpd, | |||
e_movlps, | e_movlps, | |||
e_movlps_movhlps, | e_movlps_movhlps, | |||
e_movmskpd, | e_movmskpd, | |||
e_movmskps, | e_movmskps, | |||
e_movntdq, | e_movntdq, | |||
e_movntdqa, // SSE 4.1 | ||||
e_movnti, | e_movnti, | |||
e_movntpd, | e_movntpd, | |||
e_movntps, | e_movntps, | |||
e_movntq, | e_movntq, | |||
e_movntsd, | e_movntsd, | |||
e_movntss, | e_movntss, | |||
e_movq, | e_movq, | |||
e_movq2dq, | e_movq2dq, | |||
e_movsb, | e_movsb, | |||
e_movsd, | e_movsd, | |||
e_movsd_sse, | e_movsd_sse, | |||
e_movshdup, | e_movshdup, | |||
e_movsldup, | e_movsldup, | |||
e_movss, | e_movss, | |||
e_movsw, | e_movsw, | |||
e_movsx, | e_movsx, | |||
e_movsxd, | e_movsxd, | |||
e_movupd, | e_movupd, | |||
e_movups, | e_movups, | |||
e_movzx, | e_movzx, | |||
e_mpsadbw, // SSE 4.1 | ||||
e_mul, | e_mul, | |||
e_mulpd, | e_mulpd, | |||
e_mulps, | e_mulps, | |||
e_mulsd, | e_mulsd, | |||
e_mulss, | e_mulss, | |||
e_neg, | e_neg, | |||
e_nop, | e_nop, | |||
e_not, | e_not, | |||
e_or, | e_or, | |||
e_orpd, | e_orpd, | |||
e_orps, | e_orps, | |||
e_out, | e_out, | |||
e_outsb, | e_outsb, | |||
e_outsd, | e_outsd, | |||
e_outsw, | e_outsw, | |||
e_pabsb, // SSSE3 | ||||
e_pabsd, // SSSE3 | ||||
e_pabsw, // SSSE3 | ||||
e_packssdw, | e_packssdw, | |||
e_packsswb, | e_packsswb, | |||
e_packusdw, // SSE 4.1 | ||||
e_packuswb, | e_packuswb, | |||
e_paddb, | e_paddb, | |||
e_paddd, | e_paddd, | |||
e_paddq, | e_paddq, | |||
e_paddsb, | e_paddsb, | |||
e_paddsw, | e_paddsw, | |||
e_paddusb, | e_paddusb, | |||
e_paddusw, | e_paddusw, | |||
e_paddw, | e_paddw, | |||
e_palignr, // SSSE3 | ||||
e_pand, | e_pand, | |||
e_pandn, | e_pandn, | |||
e_pavgb, | e_pavgb, | |||
e_pavgw, | e_pavgw, | |||
e_pblendvb, // SSE 4.1 | ||||
e_pblendw, // SSE 4.1 | ||||
e_pcmpeqb, | e_pcmpeqb, | |||
e_pcmpeqd, | e_pcmpeqd, | |||
e_pcmpeqq, // SSE 4.1 | ||||
e_pcmpeqw, | e_pcmpeqw, | |||
e_pcmpestri, // SSE 4.2 | ||||
e_pcmpestrm, // SSE 4.2 | ||||
e_pcmpgdt, | e_pcmpgdt, | |||
e_pcmpgtb, | e_pcmpgtb, | |||
e_pcmpgtq, // SSE 4.2 | ||||
e_pcmpgtw, | e_pcmpgtw, | |||
e_pextrw, | e_pcmpistri, // SSE 4.2 | |||
e_pcmpistrm, // SSE 4.2 | ||||
e_pextrb, // SSE 4.1 | ||||
e_pextrd_pextrq, // SSE 4.1 | ||||
e_pextrw, // SSE 4.1 | ||||
e_phaddd, // SSSE3 | ||||
e_phaddw, // SSSE3 | ||||
e_phaddsw, // SSSE3 | ||||
e_phminposuw, // SSE 4.1 | ||||
e_phsubd, // SSSE3 | ||||
e_phsubw, // SSSE3 | ||||
e_phsubsw, // SSSE3 | ||||
e_pinsrb, // SSE 4.1 | ||||
e_pinsrd_pinsrq, // SSE 4.1 | ||||
e_pinsrw, | e_pinsrw, | |||
e_pmaddwd, | e_pmaddwd, | |||
e_pmaddubsw, // SSSE3 | ||||
e_pmaxsb, // SSE 4.1 | ||||
e_pmaxsd, // SSE 4.1 | ||||
e_pmaxud, // SSE 4.1 | ||||
e_pmaxuw, // SSE 4.1 | ||||
e_pmaxsw, | e_pmaxsw, | |||
e_pmaxub, | e_pmaxub, | |||
e_pminsb, // SSE 4.1 | ||||
e_pminsd, // SSE 4.1 | ||||
e_pminud, // SSE 4.1 | ||||
e_pminuw, // SSE 4.1 | ||||
e_pminsw, | e_pminsw, | |||
e_pminub, | e_pminub, | |||
e_pmovmskb, | e_pmovmskb, | |||
e_pmovntdqa, // SSE 4.1 | ||||
e_pmovsxbd, // SSE 4.1 | ||||
e_pmovsxbq, // SSE 4.1 | ||||
e_pmovsxbw, // SSE 4.1 | ||||
e_pmovsxwd, // SSE 4.1 | ||||
e_pmovsxwq, // SSE 4.1 | ||||
e_pmovsxdq, // SSE 4.1 | ||||
e_pmovzxbd, // SSE 4.1 | ||||
e_pmovzxbq, // SSE 4.1 | ||||
e_pmovzxbw, // SSE 4.1 | ||||
e_pmovzxwd, // SSE 4.1 | ||||
e_pmovzxwq, // SSE 4.1 | ||||
e_pmovzxdq, // SSE 4.1 | ||||
e_pmuldq, // SSE 4.1 | ||||
e_pmulhrsw, // SSSE3 | ||||
e_pmulhuw, | e_pmulhuw, | |||
e_pmulhw, | e_pmulhw, | |||
e_pmulld, // SSE 4.1 | ||||
e_pmullw, | e_pmullw, | |||
e_pmuludq, | e_pmuludq, | |||
e_pop, | e_pop, | |||
e_popa, | e_popa, | |||
e_popad, | e_popad, | |||
e_popf, | e_popf, | |||
e_popfd, | e_popfd, | |||
e_popcnt, | e_popcnt, | |||
e_por, | e_por, | |||
e_psadbw, | e_psadbw, | |||
e_pshufb, // SSSE3 | ||||
e_pshufd, | e_pshufd, | |||
e_pshufhw, | e_pshufhw, | |||
e_pshuflw, | e_pshuflw, | |||
e_pshufw, | e_pshufw, | |||
e_psignd, // SSSE3 | ||||
e_psignw, // SSSE3 | ||||
e_psignb, // SSSE3 | ||||
e_pslld, | e_pslld, | |||
e_pslldq, | e_pslldq, | |||
e_psllq, | e_psllq, | |||
e_psllw, | e_psllw, | |||
e_psrad, | e_psrad, | |||
e_psraw, | e_psraw, | |||
e_psrld, | e_psrld, | |||
e_psrldq, | e_psrldq, | |||
e_psrlq, | e_psrlq, | |||
e_psrlw, | e_psrlw, | |||
e_psubb, | e_psubb, | |||
e_psubd, | e_psubd, | |||
e_psubsb, | e_psubsb, | |||
e_psubsw, | e_psubsw, | |||
e_psubusb, | e_psubusb, | |||
e_psubusw, | e_psubusw, | |||
e_psubw, | e_psubw, | |||
e_ptest, // SSE 4.1 | ||||
e_punpckhbw, | e_punpckhbw, | |||
e_punpckhdq, | e_punpckhdq, | |||
e_punpckhqd, | e_punpckhqd, | |||
e_punpckhwd, | e_punpckhwd, | |||
e_punpcklbw, | e_punpcklbw, | |||
e_punpcklqd, | e_punpcklqd, | |||
e_punpcklqld, | e_punpcklqld, | |||
e_punpcklwd, | e_punpcklwd, | |||
e_push, | e_push, | |||
e_pusha, | e_pusha, | |||
skipping to change at line 423 | skipping to change at line 488 | |||
e_pxor, | e_pxor, | |||
e_rcl, | e_rcl, | |||
e_rcpps, | e_rcpps, | |||
e_rcpss, | e_rcpss, | |||
e_rcr, | e_rcr, | |||
e_rdmsr, | e_rdmsr, | |||
e_rdpmc, | e_rdpmc, | |||
e_rdtsc, | e_rdtsc, | |||
e_rol, | e_rol, | |||
e_ror, | e_ror, | |||
e_roundpd, // SSE 4.1 | ||||
e_roundps, // SSE 4.1 | ||||
e_roundsd, // SSE 4.1 | ||||
e_roundss, // SSE 4.1 | ||||
e_rsm, | e_rsm, | |||
e_rsqrtps, | e_rsqrtps, | |||
e_rsqrtss, | e_rsqrtss, | |||
e_sahf, | e_sahf, | |||
e_salc, | e_salc, | |||
e_sar, | e_sar, | |||
e_sbb, | e_sbb, | |||
e_scasb, | e_scasb, | |||
e_scasd, | e_scasd, | |||
e_scasw, | e_scasw, | |||
End of changes. 23 change blocks. | ||||
1 lines changed or deleted | 70 lines changed or added | |||
liveness.h | liveness.h | |||
---|---|---|---|---|
skipping to change at line 30 | skipping to change at line 30 | |||
* | * | |||
* This library is distributed in the hope that it will be useful, | * This library is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | * Lesser General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | */ | |||
#if defined(cap_liveness) | ||||
#ifndef LIVENESS_H | #ifndef LIVENESS_H | |||
#define LIVENESS_H | #define LIVENESS_H | |||
#include "CFG.h" | #include "CFG.h" | |||
#include "CodeObject.h" | #include "CodeObject.h" | |||
#include "CodeSource.h" | #include "CodeSource.h" | |||
#include "Location.h" | #include "Location.h" | |||
#include "Instruction.h" | #include "Instruction.h" | |||
#include "Register.h" | #include "Register.h" | |||
#include "InstructionDecoder.h" | #include "InstructionDecoder.h" | |||
skipping to change at line 112 | skipping to change at line 111 | |||
void clean(); | void clean(); | |||
int getIndex(MachRegister machReg); | int getIndex(MachRegister machReg); | |||
ABI* getABI() { return abi;} | ABI* getABI() { return abi;} | |||
private: | private: | |||
ErrorType errorno; | ErrorType errorno; | |||
}; | }; | |||
#endif // LIVESS_H | #endif // LIVESS_H | |||
#endif // cap_liveness | ||||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 0 lines changed or added | |||
local_var.h | local_var.h | |||
---|---|---|---|---|
skipping to change at line 152 | skipping to change at line 152 | |||
/** | /** | |||
* Given a StackwalkerAPI frame, return the SymtabAPI function | * Given a StackwalkerAPI frame, return the SymtabAPI function | |||
* that created the frame. | * that created the frame. | |||
**/ | **/ | |||
static Dyninst::SymtabAPI::Function *getFunctionForFrame(Frame f) | static Dyninst::SymtabAPI::Function *getFunctionForFrame(Frame f) | |||
{ | { | |||
Offset offset; | Offset offset; | |||
void *symtab_v; | void *symtab_v; | |||
std::string lib_name; | std::string lib_name; | |||
bool result = f.getLibOffset(lib_name, offset, symtab_v); | bool result = f.getLibOffset(lib_name, offset, symtab_v); | |||
if (!result || !symtab_v) | if (!result) | |||
return NULL; | return NULL; | |||
Symtab *symtab = getSymtabForName(lib_name); | Symtab *symtab = NULL; | |||
if (symtab_v) { | ||||
symtab = (Symtab *) symtab_v; | ||||
} | ||||
else { | ||||
symtab = getSymtabForName(lib_name); | ||||
} | ||||
Function *func; | Function *func; | |||
result = symtab->getContainingFunction(offset, func); | result = symtab->getContainingFunction(offset, func); | |||
if (!result) | if (!result) | |||
return NULL; | return NULL; | |||
return func; | return func; | |||
} | } | |||
/** | /** | |||
* Given a frame in a stackwalk, and a local variable, get the value | * Given a frame in a stackwalk, and a local variable, get the value | |||
* of that local variable in the frame. | * of that local variable in the frame. | |||
skipping to change at line 232 | skipping to change at line 238 | |||
Address var_addr = 0; | Address var_addr = 0; | |||
deref = (loc.refClass == storageRef); | deref = (loc.refClass == storageRef); | |||
switch (loc.stClass) { | switch (loc.stClass) { | |||
case storageAddr: | case storageAddr: | |||
var_addr = loc.frameOffset; | var_addr = loc.frameOffset; | |||
break; | break; | |||
case storageReg: | case storageReg: | |||
case storageRegOffset: { | case storageRegOffset: { | |||
MachRegisterVal reg_value; | MachRegisterVal reg_value; | |||
MachRegister reg = loc.mr_reg; | MachRegister reg = loc.mr_reg; | |||
if (loc.stClass == storageRegOffset && loc.reg == -1) { | if (loc.stClass == storageRegOffset && reg == -1) { | |||
reg = MachRegister::getFramePointer(proc->getAddressWidth() == 4 ? Arch_x86 : Arch_x86_64); | reg = MachRegister::getFramePointer(proc->getAddressWidth() == 4 ? Arch_x86 : Arch_x86_64); | |||
} | } | |||
LVReader r(proc, frame, &swalk, thrd); | LVReader r(proc, frame, &swalk, thrd); | |||
result = r.GetReg(reg, reg_value); | result = r.GetReg(reg, reg_value); | |||
if (loc.stClass == storageReg) { | if (loc.stClass == storageReg) { | |||
var_addr = reg_value; | var_addr = reg_value; | |||
} | } | |||
else { | else { | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 9 lines changed or added | |||
procstate.h | procstate.h | |||
---|---|---|---|---|
skipping to change at line 175 | skipping to change at line 175 | |||
//LibAddrPair.first = path to library, LibAddrPair.second = load address | //LibAddrPair.first = path to library, LibAddrPair.second = load address | |||
typedef std::pair<std::string, Address> LibAddrPair; | typedef std::pair<std::string, Address> LibAddrPair; | |||
typedef enum { library_load, library_unload } lib_change_t; | typedef enum { library_load, library_unload } lib_change_t; | |||
class LibraryState { | class LibraryState { | |||
protected: | protected: | |||
ProcessState *procstate; | ProcessState *procstate; | |||
std::vector<std::pair<LibAddrPair, unsigned int> > arch_libs; | std::vector<std::pair<LibAddrPair, unsigned int> > arch_libs; | |||
public: | public: | |||
LibraryState(ProcessState *parent); | LibraryState(ProcessState *parent); | |||
virtual bool getLibraryAtAddr(Address addr, LibAddrPair &lib) = 0; | virtual bool getLibraryAtAddr(Address addr, LibAddrPair &lib) = 0; | |||
virtual bool getLibraries(std::vector<LibAddrPair> &libs) = 0; | virtual bool getLibraries(std::vector<LibAddrPair> &libs, bool allow_ref resh = true) = 0; | |||
virtual void notifyOfUpdate() = 0; | virtual void notifyOfUpdate() = 0; | |||
virtual Address getLibTrapAddress() = 0; | virtual Address getLibTrapAddress() = 0; | |||
virtual bool getLibc(LibAddrPair &lc); | virtual bool getLibc(LibAddrPair &lc); | |||
virtual bool getLibthread(LibAddrPair <); | virtual bool getLibthread(LibAddrPair <); | |||
virtual bool getAOut(LibAddrPair &ao) = 0; | virtual bool getAOut(LibAddrPair &ao) = 0; | |||
virtual ~LibraryState(); | virtual ~LibraryState(); | |||
virtual bool updateLibsArch(std::vector<std::pair<LibAddrPair, unsigned int> > &alibs); | virtual bool updateLibsArch(std::vector<std::pair<LibAddrPair, unsigned int> > &alibs); | |||
}; | }; | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
slicing.h | slicing.h | |||
---|---|---|---|---|
skipping to change at line 203 | skipping to change at line 203 | |||
ParseAPI::Function *func; | ParseAPI::Function *func; | |||
// If non-NULL this must be an internal context | // If non-NULL this must be an internal context | |||
// element, since we have an active call site. | // element, since we have an active call site. | |||
ParseAPI::Block *block; | ParseAPI::Block *block; | |||
// To enter or leave a function we must be able to | // To enter or leave a function we must be able to | |||
// map corresponding abstract regions. | // map corresponding abstract regions. | |||
// In particular, we need to know the depth of the | // In particular, we need to know the depth of the | |||
// stack in the caller. | // stack in the caller. | |||
long stackDepth; | int stackDepth; | |||
ContextElement(ParseAPI::Function *f) : | ContextElement(ParseAPI::Function *f) : | |||
func(f), block(NULL), stackDepth(-1) {}; | func(f), block(NULL), stackDepth(-1) {}; | |||
ContextElement(ParseAPI::Function *f, long depth) : | ContextElement(ParseAPI::Function *f, long depth) : | |||
func(f), block(NULL), stackDepth(depth) {}; | func(f), block(NULL), stackDepth(depth) {}; | |||
}; | }; | |||
// This should be sufficient... | // This should be sufficient... | |||
typedef std::deque<ContextElement> Context; | typedef std::deque<ContextElement> Context; | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
stackanalysis.h | stackanalysis.h | |||
---|---|---|---|---|
skipping to change at line 44 | skipping to change at line 44 | |||
#if !defined(_MSC_VER) && !defined(os_freebsd) | #if !defined(_MSC_VER) && !defined(os_freebsd) | |||
#include <values.h> | #include <values.h> | |||
#endif | #endif | |||
#include "dyntypes.h" | #include "dyntypes.h" | |||
#include <set> | #include <set> | |||
#include <map> | #include <map> | |||
#include <string> | #include <string> | |||
#include <list> | #include <list> | |||
#include "util.h" | #include "util.h" | |||
#include "dynutil/h/dyn_regs.h" | #include "dyn_regs.h" | |||
#include "common/h/IntervalTree.h" | ||||
// for blockSet... | ||||
//#include "dyninstAPI/src/image-func.h" | ||||
// To define StackAST | // To define StackAST | |||
#include "DynAST.h" | #include "DynAST.h" | |||
#if defined(os_aix) | #if defined(os_aix) | |||
// AIX is missing a MINLONG... | // AIX is missing a MINLONG... | |||
#if defined(arch_64bit) | #if defined(arch_64bit) | |||
#define MINLONG INT64_MIN | #define MINLONG INT64_MIN | |||
#else | #else | |||
#define MINLONG INT32_MIN | #define MINLONG INT32_MIN | |||
skipping to change at line 313 | skipping to change at line 308 | |||
// intervals. For each interval we have the following | // intervals. For each interval we have the following | |||
// information: | // information: | |||
// a) Whether the function has a well-defined | // a) Whether the function has a well-defined | |||
// stack frame. This is defined as follows: | // stack frame. This is defined as follows: | |||
// x86/AMD-64: a frame pointer | // x86/AMD-64: a frame pointer | |||
// POWER: an allocated frame pointed to by GPR1 | // POWER: an allocated frame pointed to by GPR1 | |||
// b) The "depth" of the stack; the distance between | // b) The "depth" of the stack; the distance between | |||
// the stack pointer and the caller's stack pointer. | // the stack pointer and the caller's stack pointer. | |||
// c) The "depth" of any aliases of the stack pointer. | // c) The "depth" of any aliases of the stack pointer. | |||
typedef std::map<Offset, RegisterState> StateIntervals; | typedef std::map<Offset, RegisterState> StateIntervals; | |||
//typedef class IntervalTree<Offset, RegisterState> StateIntervals; | ||||
typedef std::map<ParseAPI::Block *, StateIntervals> Intervals; | typedef std::map<ParseAPI::Block *, StateIntervals> Intervals; | |||
typedef std::map<ParseAPI::Function *, Height> FuncCleanAmounts; | typedef std::map<ParseAPI::Function *, Height> FuncCleanAmounts; | |||
typedef std::map<ParseAPI::Block *, SummaryFunc> BlockEffects; | typedef std::map<ParseAPI::Block *, SummaryFunc> BlockEffects; | |||
typedef std::map<ParseAPI::Block *, RegisterState> BlockState; | typedef std::map<ParseAPI::Block *, RegisterState> BlockState; | |||
// To build intervals, we must replay the effect of each instruction . | // To build intervals, we must replay the effect of each instruction . | |||
// To avoid sucking enormous time, we keep those transfer functions around... | // To avoid sucking enormous time, we keep those transfer functions around... | |||
typedef std::map<ParseAPI::Block *, std::map<Offset, TransferFuncs> > InstructionEffects; | typedef std::map<ParseAPI::Block *, std::map<Offset, TransferFuncs> > InstructionEffects; | |||
skipping to change at line 339 | skipping to change at line 333 | |||
DATAFLOW_EXPORT Height find(ParseAPI::Block *, Address addr, MachRegist er reg); | DATAFLOW_EXPORT Height find(ParseAPI::Block *, Address addr, MachRegist er reg); | |||
// And a commonly used shortcut | // And a commonly used shortcut | |||
DATAFLOW_EXPORT Height findSP(ParseAPI::Block *, Address addr); | DATAFLOW_EXPORT Height findSP(ParseAPI::Block *, Address addr); | |||
DATAFLOW_EXPORT Height findFP(ParseAPI::Block *, Address addr); | DATAFLOW_EXPORT Height findFP(ParseAPI::Block *, Address addr); | |||
DATAFLOW_EXPORT void findDefinedHeights(ParseAPI::Block* b, Address add r, std::vector<std::pair<MachRegister, Height> >& heights); | DATAFLOW_EXPORT void findDefinedHeights(ParseAPI::Block* b, Address add r, std::vector<std::pair<MachRegister, Height> >& heights); | |||
DATAFLOW_EXPORT void debug(); | DATAFLOW_EXPORT void debug(); | |||
private: | private: | |||
std::string format(const RegisterState &input) const; | std::string format(const RegisterState &input) const; | |||
MachRegister sp(); | MachRegister sp(); | |||
MachRegister fp(); | MachRegister fp(); | |||
bool analyze(); | bool analyze(); | |||
void summarizeBlocks(); | void summarizeBlocks(); | |||
void summarize(); | void summarize(); | |||
void fixpoint(); | void fixpoint(); | |||
void createIntervals(); | void createIntervals(); | |||
void createEntryInput(RegisterState &input); | void createEntryInput(RegisterState &input); | |||
void meetInputs(ParseAPI::Block *b, RegisterState &input); | void meetInputs(ParseAPI::Block *b, RegisterState &input); | |||
void meet(const RegisterState &source, RegisterState &accum); | void meet(const RegisterState &source, RegisterState &accum); | |||
RegisterState getSrcOutputRegs(ParseAPI::Edge* e); | RegisterState getSrcOutputRegs(ParseAPI::Edge* e); | |||
void computeInsnEffects(ParseAPI::Block *block, | void computeInsnEffects(ParseAPI::Block *block, | |||
const InstructionPtr &insn, | InstructionPtr insn, | |||
const Offset off, | const Offset off, | |||
TransferFuncs &xferFunc); | TransferFuncs &xferFunc); | |||
bool isCall(InstructionPtr insn); | bool isCall(InstructionPtr insn); | |||
bool handleNormalCall(InstructionPtr insn, ParseAPI::Block *block, Offs et off, TransferFuncs &xferFuncs); | bool handleNormalCall(InstructionPtr insn, ParseAPI::Block *block, Offs et off, TransferFuncs &xferFuncs); | |||
bool handleThunkCall(InstructionPtr insn, TransferFuncs &xferFuncs); | bool handleThunkCall(InstructionPtr insn, TransferFuncs &xferFuncs); | |||
void handlePushPop(InstructionPtr insn, int sign, TransferFuncs &xferFu ncs); | void handlePushPop(InstructionPtr insn, int sign, TransferFuncs &xferFu ncs); | |||
void handleReturn(InstructionPtr insn, TransferFuncs &xferFuncs); | void handleReturn(InstructionPtr insn, TransferFuncs &xferFuncs); | |||
void handleAddSub(InstructionPtr insn, int sign, TransferFuncs &xferFun cs); | void handleAddSub(InstructionPtr insn, int sign, TransferFuncs &xferFun cs); | |||
void handleLEA(InstructionPtr insn, TransferFuncs &xferFuncs); | void handleLEA(InstructionPtr insn, TransferFuncs &xferFuncs); | |||
End of changes. 4 change blocks. | ||||
10 lines changed or deleted | 4 lines changed or added | |||
util.h | util.h | |||
---|---|---|---|---|
skipping to change at line 140 | skipping to change at line 140 | |||
#if defined(STACKWALKER_EXPORTS) | #if defined(STACKWALKER_EXPORTS) | |||
#define SW_EXPORT __declspec(dllexport) | #define SW_EXPORT __declspec(dllexport) | |||
#else | #else | |||
#define SW_EXPORT __declspec(dllimport) | #define SW_EXPORT __declspec(dllimport) | |||
#endif | #endif | |||
#else | #else | |||
#define SW_EXPORT | #define SW_EXPORT | |||
#endif | #endif | |||
#endif | #endif | |||
#if !defined(INJECTOR_EXPORT) | ||||
#if defined(_MSC_VER) | ||||
#if defined(INJECTOR_EXPORTS) | ||||
#define INJECTOR_EXPORT __declspec(dllexport) | ||||
#else | ||||
#define INJECTOR_EXPORT __declspec(dllimport) | ||||
#endif | ||||
#else | ||||
#define INJECTOR_EXPORT | ||||
#endif | ||||
#endif | ||||
#if !defined(SYMEVAL_EXPORT) | #if !defined(SYMEVAL_EXPORT) | |||
#if defined(_MSC_VER) | #if defined(_MSC_VER) | |||
#if defined(SYMEVAL_LIB) | #if defined(SYMEVAL_LIB) | |||
#define SYMEVAL_EXPORT __declspec(dllexport) | #define SYMEVAL_EXPORT __declspec(dllexport) | |||
#else | #else | |||
#define SYMEVAL_EXPORT __declspec(dllimport) | #define SYMEVAL_EXPORT __declspec(dllimport) | |||
#endif | #endif | |||
#else | #else | |||
#define SYMEVAL_EXPORT | #define SYMEVAL_EXPORT | |||
#endif | #endif | |||
skipping to change at line 167 | skipping to change at line 179 | |||
#define THROW_SPEC(x) throw (x) | #define THROW_SPEC(x) throw (x) | |||
#define THROW throw () | #define THROW throw () | |||
#endif | #endif | |||
#endif | #endif | |||
#ifndef __UTIL_H__ | #ifndef __UTIL_H__ | |||
#define __UTIL_H__ | #define __UTIL_H__ | |||
#include <string> | #include <string> | |||
#include "dyntypes.h" | #include "dyntypes.h" | |||
/* GCC 4.7.0 and 4.7.1 broke ABI compatibility between C++11 and C++98 | ||||
* code in a MAJOR way. Disallow that combination; other versions of | ||||
* the compiler are fine. | ||||
*/ | ||||
#if !((__cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X__)) | ||||
#if (__GNUC__ == 4 && __GNUC_MINOR__ == 7 && ((__GNUC_PATCHLEVEL__ == 0) || | ||||
(__GNUC_PATCHLEVEL__ == 1))) | ||||
#error "Using GCC 4.7.0 or 4.7.1 with Dyninst requires the -std:c++0x or -s | ||||
td:c++11 flag. Other versions do not." | ||||
#endif | ||||
#endif | ||||
namespace Dyninst { | namespace Dyninst { | |||
COMMON_EXPORT unsigned addrHashCommon(const Address &addr); | COMMON_EXPORT unsigned addrHashCommon(const Address &addr); | |||
COMMON_EXPORT unsigned ptrHash(const void * addr); | COMMON_EXPORT unsigned ptrHash(const void * addr); | |||
COMMON_EXPORT unsigned ptrHash(void * addr); | COMMON_EXPORT unsigned ptrHash(void * addr); | |||
COMMON_EXPORT unsigned addrHash(const Address &addr); | COMMON_EXPORT unsigned addrHash(const Address &addr); | |||
COMMON_EXPORT unsigned addrHash4(const Address &addr); | COMMON_EXPORT unsigned addrHash4(const Address &addr); | |||
COMMON_EXPORT unsigned addrHash16(const Address &addr); | COMMON_EXPORT unsigned addrHash16(const Address &addr); | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 25 lines changed or added | |||
walker.h | walker.h | |||
---|---|---|---|---|
skipping to change at line 42 | skipping to change at line 42 | |||
#define WALKER_H_ | #define WALKER_H_ | |||
#include "basetypes.h" | #include "basetypes.h" | |||
#include "PCProcess.h" | #include "PCProcess.h" | |||
#include <vector> | #include <vector> | |||
#include <list> | #include <list> | |||
#include <string> | #include <string> | |||
#include <utility> | #include <utility> | |||
#define SW_MAJOR 8 | #define SW_MAJOR 8 | |||
#define SW_MINOR 0 | #define SW_MINOR 1 | |||
#define SW_BETA 0 | #define SW_BETA 1 | |||
#define SW_VERSION_8_1_1 | ||||
#define SW_VERSION_8_1_0 | ||||
#define SW_VERSION_8_0_0 | #define SW_VERSION_8_0_0 | |||
#define SW_VERSION_2_1_1 | #define SW_VERSION_2_1_1 | |||
#define SW_VERSION_2_1_0 | #define SW_VERSION_2_1_0 | |||
namespace Dyninst { | namespace Dyninst { | |||
class SymbolReaderFactory; | class SymbolReaderFactory; | |||
namespace Stackwalker { | namespace Stackwalker { | |||
skipping to change at line 187 | skipping to change at line 189 | |||
iterator find(Walker *); | iterator find(Walker *); | |||
const_iterator begin() const; | const_iterator begin() const; | |||
const_iterator end() const; | const_iterator end() const; | |||
const_iterator find(Walker *) const; | const_iterator find(Walker *) const; | |||
std::pair<iterator, bool> insert(Walker *walker); | std::pair<iterator, bool> insert(Walker *walker); | |||
void erase(iterator i); | void erase(iterator i); | |||
bool empty() const; | bool empty() const; | |||
size_t size() const; | size_t size() const; | |||
bool walkStacks(CallTree &tree) const; | bool walkStacks(CallTree &tree, bool walk_initial_only = false) const; | |||
}; | }; | |||
} | } | |||
} | } | |||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 5 lines changed or added | |||