From e934d78f883e55443be669b094f5f6c9660d5299 Mon Sep 17 00:00:00 2001 From: hollings Date: Wed, 29 Aug 2001 23:25:23 +0000 Subject: [PATCH] Changes to work towards compatability with IBM's version of dyninst. major visible change is that the BPatch_{struct,union,function,etc} enum is now called BPatch_Data{....}. Also added a bunch of #ifdef IBM_BPATCH_COMPAT to provide implementations of IBM specific functions (some of which will probably be moved to our version too). --- dyninstAPI/h/BPatch.h | 33 +++++++ dyninstAPI/h/BPatch_Vector.h | 10 ++- dyninstAPI/h/BPatch_basicBlock.h | 2 +- dyninstAPI/h/BPatch_function.h | 35 ++++++-- dyninstAPI/h/BPatch_image.h | 17 +++- dyninstAPI/h/BPatch_module.h | 24 +++++- dyninstAPI/h/BPatch_point.h | 44 ++++++++-- dyninstAPI/h/BPatch_snippet.h | 27 +++++- dyninstAPI/h/BPatch_sourceObj.h | 8 +- dyninstAPI/h/BPatch_thread.h | 6 ++ dyninstAPI/h/BPatch_type.h | 82 +++++++++++------- dyninstAPI/src/BPatch.C | 129 +++++++++++++++++----------- dyninstAPI/src/BPatch_collections.h | 1 + dyninstAPI/src/BPatch_flowGraph.C | 4 +- dyninstAPI/src/BPatch_function.C | 85 +++++++++++++++--- dyninstAPI/src/BPatch_image.C | 86 +++++++++++++++---- dyninstAPI/src/BPatch_module.C | 73 ++++++++++++++-- dyninstAPI/src/BPatch_snippet.C | 47 ++++++++-- dyninstAPI/src/BPatch_templates.C | 4 +- dyninstAPI/src/BPatch_thread.C | 9 +- dyninstAPI/src/BPatch_type.C | 52 +++++------ dyninstAPI/src/CodeView.C | 10 +-- dyninstAPI/src/ast.h | 9 +- dyninstAPI/src/dummy.C | 18 +++- dyninstAPI/src/inst-power.C | 13 ++- dyninstAPI/src/inst-sparc.C | 3 +- dyninstAPI/src/parseStab.C | 42 ++++----- dyninstAPI/src/process.C | 10 ++- dyninstAPI/src/symtab.C | 7 +- dyninstAPI/tests/rs6000-ibm-aix4.2/Makefile | 3 +- dyninstAPI/tests/src/test1.C | 9 +- 31 files changed, 677 insertions(+), 225 deletions(-) diff --git a/dyninstAPI/h/BPatch.h b/dyninstAPI/h/BPatch.h index c85f9ef..14b54fa 100644 --- a/dyninstAPI/h/BPatch.h +++ b/dyninstAPI/h/BPatch.h @@ -74,6 +74,28 @@ typedef void (*BPatchExecCallback)(BPatch_thread *proc); typedef void (*BPatchExitCallback)(BPatch_thread *proc, int code); +typedef void (*BPatchSignalCallback)(BPatch_thread *proc, int sigNum); + + +#ifdef IBM_BPATCH_COMPAT +typedef void *BPatch_Address; +typedef void (*BPatchLoggingCallback)(char *msg, int); +extern void setLogging_NP(BPatchLoggingCallback func, int); + +typedef void (*BPatchThreadEventCallback)(BPatch_thread *thr, void *arg1, void *arg2); + +#define BP_OK 0 +#define BP_Pending 1 +#define BP_Delayed 2 +#define BP_child 3 +#define BP_state 4 +#define BP_pthdbBadContext 5 +#define BP_lastCode 6 + +extern int eCodes[BP_lastCode]; + +#endif + class BPATCH_DLL_EXPORT BPatch { friend class BPatch_thread; friend class process; @@ -133,6 +155,17 @@ public: int getLastError() { return lastError; } // End of functions that are for internal use only +#ifdef IBM_BPATCH_COMPAT + int getLastErrorCode() { return lastError; } + + BPatchThreadEventCallback registerDetachDoneCallback(BPatchThreadEventCallback) { return NULL; } + BPatchThreadEventCallback registerSnippetRemovedCallback(BPatchThreadEventCallback) { return NULL; } + BPatchSignalCallback registerSignalCallback(BPatchSignalCallback func, int sigNum) { return NULL; } + + BPatchThreadEventCallback registerRPCTerminationCallback(BPatchThreadEventCallback); + BPatchThreadEventCallback RPCdoneCallback; +#endif + BPatch(); ~BPatch(); diff --git a/dyninstAPI/h/BPatch_Vector.h b/dyninstAPI/h/BPatch_Vector.h index 9d400e9..409f41d 100644 --- a/dyninstAPI/h/BPatch_Vector.h +++ b/dyninstAPI/h/BPatch_Vector.h @@ -39,7 +39,7 @@ * incur to third parties resulting from your use of Paradyn. */ -// $Id: BPatch_Vector.h,v 1.8 2001/06/12 15:43:27 hollings Exp $ +// $Id: BPatch_Vector.h,v 1.9 2001/08/29 23:25:24 hollings Exp $ #ifndef _BPatch_Vector_h_ #define _BPatch_Vector_h_ @@ -52,13 +52,17 @@ #ifdef USE_STL_VECTOR #include -#define BPatch_Vector vector +#define BPatch_Vector vector #else #ifdef external_templates #pragma interface #endif /* external_templates */ +#ifndef BPATCH_LIBRARY +#define vector BPatch_Vector +#endif + template class BPATCH_DLL_EXPORT BPatch_Vector { int reserved; // Number of objects for which space is reserved @@ -74,7 +78,7 @@ public: BPatch_Vector& operator=(const BPatch_Vector &); - int size() const { return len; } + unsigned int size() const { return len; } void push_back(const T& x); void push_front(const T& x); diff --git a/dyninstAPI/h/BPatch_basicBlock.h b/dyninstAPI/h/BPatch_basicBlock.h index 6fcf7cf..2e6a7a3 100644 --- a/dyninstAPI/h/BPatch_basicBlock.h +++ b/dyninstAPI/h/BPatch_basicBlock.h @@ -24,7 +24,7 @@ class BPATCH_DLL_EXPORT BPatch_basicBlock { private: /** the flow graph that contains this basic block */ - BPatch_flowGraph* flowGraph; + BPatch_flowGraph *flowGraph; /** the ID of the block.It is unique in the CFG. * starts at 0 and goes up to (number of basic blocks - 1) diff --git a/dyninstAPI/h/BPatch_function.h b/dyninstAPI/h/BPatch_function.h index 4c9d137..0ed0f0c 100644 --- a/dyninstAPI/h/BPatch_function.h +++ b/dyninstAPI/h/BPatch_function.h @@ -67,7 +67,6 @@ class BPATCH_DLL_EXPORT BPatch_function: public BPatch_sourceObj { BPatch_flowGraph* cfg; void *getBaseAddrRelative(); - void getSymTabName(char*&); public: virtual ~BPatch_function(); @@ -77,11 +76,11 @@ public: process *getProc() { return proc; } // No longer inline but defined in .C file - BPatch_function(process *_proc, function_base *_func, BPatch_module *); + BPatch_function(process *_proc, function_base *_func, BPatch_module *mod = NULL); BPatch_function(process *_proc, function_base *_func, BPatch_type * _retType, BPatch_module *); - BPatch_Vector *getSourceObj(); + bool getSourceObj(BPatch_Vector &); BPatch_sourceObj *getObjParent(); BPatch_localVarCollection * localVariables; BPatch_localVarCollection * funcParameters; @@ -90,6 +89,7 @@ public: // For users of the library: char *getName(char *s, int len); + char *getMangledName(char *s, int len); void *getBaseAddr(); unsigned int getSize(); BPatch_type * getReturnType(){ return retType; } @@ -112,10 +112,35 @@ public: bool exactMatch = true); // method to return file name, and first and last lines of the func - bool getLineAndFile(unsigned short &start, - unsigned short &end, + bool getLineAndFile(unsigned int &start, + unsigned int &end, char *name, unsigned &length); + + // is this defined, what variables should be returned?? + bool getVariables(BPatch_Vector &vect); + + char *getModuleName(char *name, int maxLen); + +#ifdef IBM_BPATCH_COMPAT + bool getLineNumbers(unsigned int &start, unsigned int &end); + + void *getAddress(); + + bool getAddressRange(void * &start, void * &end); + + BPatch_type *returnType(); + + void getIncPoints(BPatch_Vector &vect); + + + int getMangledNameLen(); + + void getExcPoints(BPatch_Vector &points); + + // return a function that can be passed as a paramter + BPatch_variableExpr *getFunctionRef(); +#endif //method to create the control flow graph for the function diff --git a/dyninstAPI/h/BPatch_image.h b/dyninstAPI/h/BPatch_image.h index 89258d8..9229392 100644 --- a/dyninstAPI/h/BPatch_image.h +++ b/dyninstAPI/h/BPatch_image.h @@ -64,12 +64,16 @@ public: BPatch_image(); virtual ~BPatch_image(); - BPatch_Vector *getSourceObj(); - BPatch_sourceObj *getObjParent(); - bool ModuleListExist(); void addModuleIfExist(BPatch_module *bpmod); + + BPatch_variableExpr *createVarExprByName(BPatch_module *mod, const char *name); + // End functions for internal use only + + bool getSourceObj(BPatch_Vector &); + BPatch_sourceObj *getObjParent(); + bool getVariables(BPatch_Vector &); BPatch_Vector *getProcedures(); BPatch_Vector *getModules(); @@ -93,6 +97,13 @@ public: bool getLineToAddr(const char* fileName,unsigned short lineNo, BPatch_Vector& buffer, bool exactMatch = true); +#ifdef IBM_BPATCH_COMPAT + char *programName(char *name, unsigned int len); + char *getProgramName(char *name, unsigned int len); + int lpType(); + BPatch_Vector *findFunction(const char *name, BPatch_Vector &funcs); +#endif + private: BPatch_Vector *modlist; AddrToVarExprHash *AddrToVarExpr; diff --git a/dyninstAPI/h/BPatch_module.h b/dyninstAPI/h/BPatch_module.h index 55950b8..b5aa1da 100644 --- a/dyninstAPI/h/BPatch_module.h +++ b/dyninstAPI/h/BPatch_module.h @@ -78,14 +78,16 @@ public: virtual ~BPatch_module(); - BPatch_Vector *getSourceObj(); + bool getSourceObj(BPatch_Vector&); BPatch_sourceObj *getObjParent(); + bool getVariables(BPatch_Vector &); BPatch_typeCollection *moduleTypes; // End functions for internal use only char *getName(char *buffer, int length); + char *getFullName(char *buffer, int length); BPatch_Vector *getProcedures(); @@ -102,8 +104,28 @@ public: BPatch_Vector& buffer, bool exactMatch = true); +#ifdef IBM_BPATCH_COMPAT + bool getLineNumbers(unsigned int &start, unsigned int &end); + char *getUniqueString(char *buffer, int length); + + char *sharedLibraryName(char *buffer, int length) { getFullName(buffer, length); } + char *getSharedLibName(char *buffer, int length) { getFullName(buffer, length); } + int getSharedLibType(); + int getBindingType(); +#endif + private: }; +#ifdef IBM_BPATCH_COMPAT +#define BPatch_sharedPublic 1 +#define BPatch_sharedPrivate 2 +#define BPatch_nonShared 3 + +#define BPatch_static 1 +#define BPatch_dynamic 2 + +#endif + #endif /* _BPatch_module_h_ */ diff --git a/dyninstAPI/h/BPatch_point.h b/dyninstAPI/h/BPatch_point.h index 337e4ad..f5a9063 100644 --- a/dyninstAPI/h/BPatch_point.h +++ b/dyninstAPI/h/BPatch_point.h @@ -52,16 +52,39 @@ class BPatch_function; /* + * Provide these definitions for backwards compatability. + * + */ +#define BPatch_entry BPatch_locEntry +#define BPatch_exit BPatch_locExit +#define BPatch_subroutine BPatch_locSubroutine +#define BPatch_longJump BPatch_locLongJump +#define BPatch_allLocations BPatch_locAllLocations +#define BPatch_instruction BPatch_locInstruction + +/* * Used with BPatch_function::findPoint to specify which of the possible * instrumentation points within a procedure should be returned. */ typedef enum { - BPatch_entry, - BPatch_exit, - BPatch_subroutine, - BPatch_longJump, - BPatch_allLocations, - BPatch_instruction + BPatch_locEntry, + BPatch_locExit, + BPatch_locSubroutine, + BPatch_locLongJump, + BPatch_locAllLocations, + BPatch_locInstruction, + BPatch_locSourceBlockEntry, // not yet used + BPatch_locSourceBlockExit, // not yet used + BPatch_locSourceLoopEntry, // not yet used + BPatch_locSourceLoopExit, // not yet used + BPatch_locBasicBlockEntry, // not yet used + BPatch_locBasicBlockExit, // not yet used + BPatch_locSourceLoop, // not yet used + BPatch_locBasicBlockLoopEntry, // not yet used + BPatch_locBasicBlockLoopExit, // not yet used + BPatch_locVarInitStart, // not yet used + BPatch_locVarInitEnd, // not yet used + BPatch_locStatement, // not yet used } BPatch_procedureLocation; @@ -85,6 +108,15 @@ public: const BPatch_function *getFunction() { return func; } BPatch_function *getCalledFunction(); void *getAddress(); + +#ifdef IBM_BPATCH_COMPAT + void *getPointAddress() { getAddress(); } + + int getPointLine() { return -1; } + + BPatch_function *getContainingFunction() { return const_cast(getFunction()); }; +#endif + int getDisplacedInstructions(int maxSize, void *insns); bool usesTrap_NP(); diff --git a/dyninstAPI/h/BPatch_snippet.h b/dyninstAPI/h/BPatch_snippet.h index 42b81a4..559ed7f 100644 --- a/dyninstAPI/h/BPatch_snippet.h +++ b/dyninstAPI/h/BPatch_snippet.h @@ -72,13 +72,22 @@ typedef enum { BPatch_times, BPatch_mod, BPatch_ref, - BPatch_seq + BPatch_seq, + BPatch_bit_and, // not supported yet + BPatch_bit_or, // not supported yet + BPatch_bit_xor, // not supported yet + BPatch_left_shift, // not supported yet + BPatch_right_shift, // not supported yet } BPatch_binOp; +// for backwards compatability +#define BPatch_addr BPatch_address + typedef enum { BPatch_negate, - BPatch_addr, - BPatch_deref + BPatch_address, + BPatch_deref, + BPatch_bit_compl, // not supported yet } BPatch_unOp; class BPATCH_DLL_EXPORT BPatch_snippet { @@ -112,6 +121,10 @@ public: class BPATCH_DLL_EXPORT BPatch_constExpr : public BPatch_snippet { public: +#ifdef IBM_BPATCH_COMPAT + BPatch_constExpr(long long value); + BPatch_constExpr(float value); +#endif BPatch_constExpr(int value); #ifdef BPATCH_NOT_YET BPatch_constExpr(float value); @@ -186,8 +199,14 @@ public: char *getName() { return name; } void *getBaseAddr() const { return address; } + +#ifdef IBM_BPATCH_COMPAT + const char *getName(char *buffer, int max) { return strncpy(buffer, name, max); } + long long int getAddress() const { return (long long int) address; } +#endif + unsigned int getSize() const { return size; } - const BPatch_type *getType(); + BPatch_type *getType(); void setType(BPatch_type *); void setSize(int sz) { size = sz; } BPatch_Vector *getComponents(); diff --git a/dyninstAPI/h/BPatch_sourceObj.h b/dyninstAPI/h/BPatch_sourceObj.h index b8a0a4a..8870a96 100644 --- a/dyninstAPI/h/BPatch_sourceObj.h +++ b/dyninstAPI/h/BPatch_sourceObj.h @@ -75,16 +75,16 @@ typedef enum BPatch_sourceType { class BPATCH_DLL_EXPORT BPatch_sourceObj { public: BPatch_sourceType getSrcType() { return _srcType; } - virtual BPatch_Vector *getSourceObj() = 0; + virtual bool getSourceObj(BPatch_Vector &) = 0; + virtual bool getVariables(BPatch_Vector &) = 0; virtual BPatch_sourceObj *getObjParent() = 0; BPatch_Vector *findVariable(const char *name); BPatch_language getLanguage() { return _srcLanguage; } BPatch_type *getType(char *name); - BPatch_Vector *getVariables(); BPatch_Vector *getLoadedFileNames(); - char *programName(char *buf, unsigned int len); - int programNameLen(); + char *getName(char *buf, unsigned int len); + int getNameLen(); protected: enum BPatch_sourceType _srcType; diff --git a/dyninstAPI/h/BPatch_thread.h b/dyninstAPI/h/BPatch_thread.h index ffbc720..1809929 100644 --- a/dyninstAPI/h/BPatch_thread.h +++ b/dyninstAPI/h/BPatch_thread.h @@ -145,6 +145,7 @@ class BPATCH_DLL_EXPORT BPatch_thread { void *returnValue); void *oneTimeCodeInternal(const BPatch_snippet &expr); + protected: // for creating a process BPatch_thread(char *path, char *argv[], char *envp[] = NULL, int stdin_fd = 0, @@ -223,6 +224,11 @@ public: //to an address bool getLineAndFile(unsigned long addr,unsigned short& lineNo, char* fileName,int length); + +#ifdef IBM_BPATCH_COMPAT + bool isThreaded() { return false; } +#endif + }; #endif /* BPatch_thread_h_ */ diff --git a/dyninstAPI/h/BPatch_type.h b/dyninstAPI/h/BPatch_type.h index 80ab339..765f0b0 100644 --- a/dyninstAPI/h/BPatch_type.h +++ b/dyninstAPI/h/BPatch_type.h @@ -44,6 +44,7 @@ #include "BPatch_dll.h" #include "BPatch_Vector.h" +#include typedef enum {BPatchSymLocalVar, BPatchSymGlobalVar, BPatchSymRegisterVar, BPatchSymStaticLocalVar, BPatchSymStaticGlobal, @@ -65,39 +66,55 @@ typedef enum {BPatchSymLocalVar, BPatchSymGlobalVar, BPatchSymRegisterVar, * BPatchSymTypeTag - C++ type name and tag combination */ -typedef enum {BPatch_scalar, - BPatch_enumerated, - BPatch_class, - BPatch_structure, - BPatch_union, - BPatch_array, - BPatch_pointer, - BPatch_referance, - BPatch_func, - BPatch_typeAttrib, - BPatch_built_inType, - BPatch_reference, - BPatch_unknownType, +typedef enum {BPatch_dataScalar, + BPatch_dataEnumerated, + BPatch_dataTypeClass, + BPatch_dataStructure, + BPatch_dataUnion, + BPatch_dataArray, + BPatch_dataPointer, + BPatch_dataReferance, + BPatch_dataFunction, + BPatch_dataTypeAttrib, + BPatch_dataBuilt_inType, + BPatch_dataReference, + BPatch_dataUnknownType, BPatchSymTypeRange, - BPatch_method, - BPatch_common} BPatch_dataClass; + BPatch_dataMethod, + BPatch_dataCommon, + BPatch_dataPrimitive, + BPatch_dataTypeNumber, +} BPatch_dataClass; + + +#define BPatch_scalar BPatch_dataScalar +#define BPatch_enumerated BPatch_dataEnumerated +#define BPatch_typeClass BPatch_dataTypeClass +#define BPatch_structure BPatch_dataStructure +#define BPatch_union BPatch_dataUnion +#define BPatch_array BPatch_dataArray +#define BPatch_pointer BPatch_dataPointer +#define BPatch_reference BPatch_dataReferance +#define BPatch_typeAttrib BPatch_dataTypeAttrib +#define BPatch_built_inType BPatch_dataBuilt_inType +#define BPatch_unknownType BPatch_dataUnknownType /* * Type Descriptors: * BPatchSymTypeReference - type reference- gnu sun-(empty) - * BPatch_array - array type- gnu sun-'a' - * BPatch_enumerated - enumerated type- gnu sun-'e' - * BPatch_class - Class type - * BPatch_func - function type- gnu sun-'f' + * BPatch_dataArray - array type- gnu sun-'a' + * BPatch_dataEnumerated - enumerated type- gnu sun-'e' + * BPatch_dataTypeClass - Class type + * BPatch_dataFunction - function type- gnu sun-'f' * BPatchSymTypeRange - range type- gnu sun-'r' - * BPatch_structure - structure type- gnu sun-'s' - * BPatch_union - union specification- gnu sun-'u' - * BPatch_pointer - pointer type- gnu sun-'*' - * BPatch_referance - referance type- gnu sun-'*' - * BPatch_typeAttrib - type attribute (C++)- gnu sun- '@' - * BPatch_built_inType - built-in type -- gdb doc ->negative type number - * BPatch_reference - C++ reference to another type- gnu sun- '&' - * BPatch_method - C++ class method + * BPatch_dataStructure - structure type- gnu sun-'s' + * BPatch_dataUnion - union specification- gnu sun-'u' + * BPatch_dataPointer - pointer type- gnu sun-'*' + * BPatch_dataReferance - referance type- gnu sun-'*' + * BPatch_dataTypeAttrib - type attribute (C++)- gnu sun- '@' + * BPatch_dataBuilt_inType - built-in type -- gdb doc ->negative type number + * BPatch_dataReference - C++ reference to another type- gnu sun- '&' + * BPatch_dataMethod - C++ class method */ typedef enum {BPatch_private, BPatch_protected, BPatch_public, @@ -131,7 +148,7 @@ class BPATCH_DLL_EXPORT BPatch_field { int value; /* For structs and unions */ - BPatch_type *type; + BPatch_type *_type; int offset; int size; @@ -155,7 +172,8 @@ public: const char *getName() { return fieldname; } - BPatch_type *getType() { return type; } + BPatch_type *getType() { return _type; } + int getValue() { return value;} BPatch_visibility getVisibility() { return vis; } BPatch_dataClass getTypeDesc() { return typeDes; } @@ -269,6 +287,12 @@ public: int getSize() const { return size; }; const char *getName() { return name; } + +#ifdef IBM_BPATCH_COMPAT + const char *getName(char *buffer, int max) { return strncpy(buffer, name, max); } + BPatch_dataClass type() { return type_; } +#endif + const char *getLow() { return low; } const char *getHigh() { return hi; } BPatch_type *getConstituentType() { return ptr; } diff --git a/dyninstAPI/src/BPatch.C b/dyninstAPI/src/BPatch.C index 3ce4943..d639a1e 100644 --- a/dyninstAPI/src/BPatch.C +++ b/dyninstAPI/src/BPatch.C @@ -39,7 +39,7 @@ * incur to third parties resulting from your use of Paradyn. */ -// $Id: BPatch.C,v 1.37 2001/08/01 15:39:54 chadd Exp $ +// $Id: BPatch.C,v 1.38 2001/08/29 23:25:26 hollings Exp $ #include #include @@ -115,12 +115,15 @@ BPatch::BPatch() * Initialize hash table of standard types. */ stdTypes = new BPatch_typeCollection; - stdTypes->addType(new BPatch_type("int",-1, BPatch_scalar, sizeof(int))); - stdTypes->addType(new BPatch_type("char *",-3, BPatch_scalar, sizeof(char*))); - BPatch_type *voidType = new BPatch_type("void",-11, BPatch_scalar, 0); + stdTypes->addType(new BPatch_type("int",-1, BPatch_dataScalar, sizeof(int))); + stdTypes->addType(new BPatch_type("char *",-3, BPatch_dataScalar, sizeof(char*))); + BPatch_type *voidType = new BPatch_type("void",-11, BPatch_dataScalar, 0); stdTypes->addType(voidType); - stdTypes->addType(new BPatch_type("void *",-4, BPatch_pointer, voidType)); - stdTypes->addType(new BPatch_type("float",-12, BPatch_scalar, sizeof(float))); + stdTypes->addType(new BPatch_type("void *",-4, BPatch_dataPointer, voidType)); + stdTypes->addType(new BPatch_type("float",-12, BPatch_dataScalar, sizeof(float))); +#if !defined(i386_unknown_nt4_0) + stdTypes->addType(new BPatch_type("long long",-31, BPatch_dataScalar, sizeof(long long int))); +#endif /* * Initialize hash table of API types. @@ -137,121 +140,121 @@ BPatch::BPatch() // NOTE: integral type mean twos-complement // -1 int, 32 bit signed integral type // in stab document, size specified in bits, system size is in bytes - builtInTypes->addBuiltInType(new BPatch_type("int",-1, BPatch_built_inType, + builtInTypes->addBuiltInType(new BPatch_type("int",-1, BPatch_dataBuilt_inType, 4)); // -2 char, 8 bit type holding a character. GDB & dbx(AIX) treat as signed builtInTypes->addBuiltInType(new BPatch_type("char",-2, - BPatch_built_inType, 1)); + BPatch_dataBuilt_inType, 1)); // -3 short, 16 bit signed integral type builtInTypes->addBuiltInType(new BPatch_type("short",-3, - BPatch_built_inType, 2)); + BPatch_dataBuilt_inType, 2)); // -4 long, 32/64 bit signed integral type builtInTypes->addBuiltInType(new BPatch_type("long",-4, - BPatch_built_inType, + BPatch_dataBuilt_inType, sizeof(long))); // -5 unsigned char, 8 bit unsigned integral type builtInTypes->addBuiltInType(new BPatch_type("unsigned char",-5, - BPatch_built_inType, 1)); + BPatch_dataBuilt_inType, 1)); // -6 signed char, 8 bit signed integral type builtInTypes->addBuiltInType(new BPatch_type("signed char",-6, - BPatch_built_inType, 1)); + BPatch_dataBuilt_inType, 1)); // -7 unsigned short, 16 bit unsigned integral type builtInTypes->addBuiltInType(new BPatch_type("unsigned short",-7, - BPatch_built_inType, 2)); + BPatch_dataBuilt_inType, 2)); // -8 unsigned int, 32 bit unsigned integral type builtInTypes->addBuiltInType(new BPatch_type("unsigned int",-8, - BPatch_built_inType, 4)); + BPatch_dataBuilt_inType, 4)); // -9 unsigned, 32 bit unsigned integral type builtInTypes->addBuiltInType(new BPatch_type("unsigned",-9, - BPatch_built_inType,4)); + BPatch_dataBuilt_inType,4)); // -10 unsigned long, 32 bit unsigned integral type builtInTypes->addBuiltInType(new BPatch_type("unsigned long",-10, - BPatch_built_inType, + BPatch_dataBuilt_inType, sizeof(unsigned long))); // -11 void, type indicating the lack of a value // XXX-size may not be correct jdd 4/22/99 builtInTypes->addBuiltInType(new BPatch_type("void",-11, - BPatch_built_inType, + BPatch_dataBuilt_inType, 0)); // -12 float, IEEE single precision builtInTypes->addBuiltInType(new BPatch_type("float",-12, - BPatch_built_inType, + BPatch_dataBuilt_inType, sizeof(float))); // -13 double, IEEE double precision builtInTypes->addBuiltInType(new BPatch_type("double",-13, - BPatch_built_inType, + BPatch_dataBuilt_inType, sizeof(double))); // -14 long double, IEEE double precision, size may increase in future builtInTypes->addBuiltInType(new BPatch_type("long double",-14, - BPatch_built_inType, + BPatch_dataBuilt_inType, sizeof(long double))); // -15 integer, 32 bit signed integral type builtInTypes->addBuiltInType(new BPatch_type("integer",-15, - BPatch_built_inType, 4)); + BPatch_dataBuilt_inType, 4)); // -16 boolean, 32 bit type. GDB/GCC 0=False, 1=True, all other values // have unspecified meaning builtInTypes->addBuiltInType(new BPatch_type("boolean",-16, - BPatch_built_inType, 4)); + BPatch_dataBuilt_inType, 4)); // -17 short real, IEEE single precision // XXX-size may not be correct jdd 4/22/99 builtInTypes->addBuiltInType(new BPatch_type("short real",-17, - BPatch_built_inType, + BPatch_dataBuilt_inType, sizeof(float))); // -18 real, IEEE double precision XXX-size may not be correct jdd 4/22/99 builtInTypes->addBuiltInType(new BPatch_type("real",-18, - BPatch_built_inType, + BPatch_dataBuilt_inType, sizeof(double))); // -19 stringptr XXX- size of void * -- jdd 4/22/99 builtInTypes->addBuiltInType(new BPatch_type("stringptr",-19, - BPatch_built_inType, + BPatch_dataBuilt_inType, sizeof(void *))); // -20 character, 8 bit unsigned character type builtInTypes->addBuiltInType(new BPatch_type("character",-20, - BPatch_built_inType, 1)); + BPatch_dataBuilt_inType, 1)); // -21 logical*1, 8 bit type (Fortran, used for boolean or unsigned int) builtInTypes->addBuiltInType(new BPatch_type("logical*1",-21, - BPatch_built_inType, 1)); + BPatch_dataBuilt_inType, 1)); // -22 logical*2, 16 bit type (Fortran, some for boolean or unsigned int) builtInTypes->addBuiltInType(new BPatch_type("logical*2",-22, - BPatch_built_inType, 2)); + BPatch_dataBuilt_inType, 2)); // -23 logical*4, 32 bit type (Fortran, some for boolean or unsigned int) builtInTypes->addBuiltInType(new BPatch_type("logical*4",-23, - BPatch_built_inType, 4)); + BPatch_dataBuilt_inType, 4)); // -24 logical, 32 bit type (Fortran, some for boolean or unsigned int) builtInTypes->addBuiltInType(new BPatch_type("logical",-24, - BPatch_built_inType, 4)); + BPatch_dataBuilt_inType, 4)); // -25 complex, consists of 2 IEEE single-precision floating point values builtInTypes->addBuiltInType(new BPatch_type("complex",-25, - BPatch_built_inType, + BPatch_dataBuilt_inType, (sizeof(float)*2))); // -26 complex, consists of 2 IEEE double-precision floating point values builtInTypes->addBuiltInType(new BPatch_type("complex",-26, - BPatch_built_inType, + BPatch_dataBuilt_inType, (sizeof(double)*2))); // -27 integer*1, 8 bit signed integral type builtInTypes->addBuiltInType(new BPatch_type("integer*1",-27, - BPatch_built_inType, 1)); + BPatch_dataBuilt_inType, 1)); // -28 integer*2, 16 bit signed integral type builtInTypes->addBuiltInType(new BPatch_type("integer*2",-28, - BPatch_built_inType, 2)); + BPatch_dataBuilt_inType, 2)); // -29 integer*4, 32 bit signed integral type builtInTypes->addBuiltInType(new BPatch_type("integer*4",-29, - BPatch_built_inType, 4)); + BPatch_dataBuilt_inType, 4)); // -30 wchar, Wide character, 16 bits wide, unsigned (unknown format) builtInTypes->addBuiltInType(new BPatch_type("wchar",-30, - BPatch_built_inType, 2)); + BPatch_dataBuilt_inType, 2)); // -31 long long, 64 bit signed integral type builtInTypes->addBuiltInType(new BPatch_type("long long",-31, - BPatch_built_inType, 8)); + BPatch_dataBuilt_inType, 8)); // -32 unsigned long long, 64 bit unsigned integral type builtInTypes->addBuiltInType(new BPatch_type("unsigned long long", -32, - BPatch_built_inType, 8)); + BPatch_dataBuilt_inType, 8)); // -33 logical*8, 64 bit unsigned integral type builtInTypes->addBuiltInType(new BPatch_type("logical*8",-33, - BPatch_built_inType, 8)); + BPatch_dataBuilt_inType, 8)); // -34 integer*8, 64 bit signed integral type builtInTypes->addBuiltInType(new BPatch_type("integer*8",-34, - BPatch_built_inType, 8)); + BPatch_dataBuilt_inType, 8)); // default callbacks are null postForkCallback = NULL; @@ -466,12 +469,15 @@ void BPatch::reportError(BPatchErrorLevel severity, int number, const char *str) { assert(bpatch != NULL); - // don't log BPatchWarning or BPatchInfo messages as "errors" + // don't log BPatchWarning or BPatchInfo messages as "errors" if ((severity == BPatchFatal) || (severity == BPatchSerious)) bpatch->lastError = number; if (bpatch->errorHandler != NULL) { bpatch->errorHandler(severity, number, &str); + } else { + fprintf(stdout, "DYNINST ERROR: %s\n", str); + fflush(stdout); } } @@ -916,14 +922,14 @@ BPatch_type * BPatch::createEnum( const char * name, return NULL; } - BPatch_type * newType = new BPatch_type( name, BPatch_enumerated ); + BPatch_type * newType = new BPatch_type( name, BPatch_dataEnumerated ); if (!newType) return NULL; APITypes->addType(newType); // ADD components to type for (int i=0; i < elementNames.size(); i++) { - newType->addField(elementNames[i], BPatch_scalar, elementIds[i]); + newType->addField(elementNames[i], BPatch_dataScalar, elementIds[i]); } return(newType); @@ -942,7 +948,7 @@ BPatch_type * BPatch::createEnum( const char * name, BPatch_type * BPatch::createEnum( const char * name, BPatch_Vector elementNames) { - BPatch_type * newType = new BPatch_type( name, BPatch_enumerated ); + BPatch_type * newType = new BPatch_type( name, BPatch_dataEnumerated ); if (!newType) return NULL; @@ -950,7 +956,7 @@ BPatch_type * BPatch::createEnum( const char * name, // ADD components to type for (int i=0; i < elementNames.size(); i++) { - newType->addField(elementNames[i], BPatch_scalar, i); + newType->addField(elementNames[i], BPatch_dataScalar, i); } return(newType); @@ -985,7 +991,7 @@ BPatch_type * BPatch::createStruct( const char * name, size += size; } - BPatch_type *newType = new BPatch_type(name, BPatch_structure, size); + BPatch_type *newType = new BPatch_type(name, BPatch_dataStructure, size); if (!newType) return NULL; APITypes->addType(newType); @@ -1033,7 +1039,7 @@ BPatch_type * BPatch::createUnion( const char * name, if(size < newsize) size = newsize; } - BPatch_type * newType = new BPatch_type(name, BPatch_union, size); + BPatch_type * newType = new BPatch_type(name, BPatch_dataUnion, size); if (!newType) return NULL; APITypes->addType(newType); @@ -1066,7 +1072,7 @@ BPatch_type * BPatch::createArray( const char * name, BPatch_type * ptr, if (!ptr) { return NULL; } else { - newType = new BPatch_type(name, BPatch_array , ptr, low, hi); + newType = new BPatch_type(name, BPatch_dataArray , ptr, low, hi); if (!newType) return NULL; } @@ -1108,7 +1114,7 @@ BPatch_type * BPatch::createPointer(const char * name, BPatch_type * ptr, BPatch_type * BPatch::createScalar( const char * name, int size) { - BPatch_type * newType = new BPatch_type(name, BPatch_scalar, size); + BPatch_type * newType = new BPatch_type(name, BPatch_dataScalar, size); if (!newType) return NULL; APITypes->addType(newType); @@ -1135,3 +1141,28 @@ BPatch_type * BPatch::createTypedef( const char * name, BPatch_type * ptr) return newType; } + +#ifdef IBM_BPATCH_COMPAT + +/* + * Register a function to call when an RPC (i.e. oneshot) is done. + * + * dyninst version is a callback that is defined for BPatch_thread + * + */ +BPatchThreadEventCallback BPatch::registerRPCTerminationCallback(BPatchThreadEventCallback func) +{ + BPatchThreadEventCallback ret; + + ret = RPCdoneCallback; + RPCdoneCallback = func; + + return ret; +} + +void setLogging_NP(BPatchLoggingCallback, int) +{ + return; +} + +#endif diff --git a/dyninstAPI/src/BPatch_collections.h b/dyninstAPI/src/BPatch_collections.h index 07e1f92..8725387 100644 --- a/dyninstAPI/src/BPatch_collections.h +++ b/dyninstAPI/src/BPatch_collections.h @@ -71,6 +71,7 @@ public: class BPatch_typeCollection { friend class BPatch_image; + friend class BPatch_module; dictionary_hash typesByName; dictionary_hash globalVarsByName; diff --git a/dyninstAPI/src/BPatch_flowGraph.C b/dyninstAPI/src/BPatch_flowGraph.C index f34f1c2..57ae2d5 100644 --- a/dyninstAPI/src/BPatch_flowGraph.C +++ b/dyninstAPI/src/BPatch_flowGraph.C @@ -489,8 +489,8 @@ void BPatch_flowGraph::createSourceBlocks(){ BPatch_image* bpImage = bpFunction->mod->img; - char* functionName = NULL; - bpFunction->getSymTabName(functionName); + char functionName[1024]; + bpFunction->getMangledName(functionName, sizeof(functionName)); string fName(functionName); delete[] functionName; int i; diff --git a/dyninstAPI/src/BPatch_function.C b/dyninstAPI/src/BPatch_function.C index bffd8fa..1079e8c 100644 --- a/dyninstAPI/src/BPatch_function.C +++ b/dyninstAPI/src/BPatch_function.C @@ -39,7 +39,7 @@ * incur to third parties resulting from your use of Paradyn. */ -// $Id: BPatch_function.C,v 1.13 2001/06/12 15:43:28 hollings Exp $ +// $Id: BPatch_function.C,v 1.14 2001/08/29 23:25:27 hollings Exp $ #define BPATCH_FILE @@ -117,9 +117,13 @@ BPatch_function::~BPatch_function() * This is not currently supported. * */ -BPatch_Vector *BPatch_function::getSourceObj() +bool BPatch_function::getSourceObj(BPatch_Vector &children) { - return NULL; + // init and empty vector + BPatch_Vector dummy; + + children = dummy; + return false; } /* @@ -152,12 +156,23 @@ char *BPatch_function::getName(char *s, int len) return s; } -void BPatch_function::getSymTabName(char*& s) +/* + * BPatch_function::getMangledName + * + * Copies the mangled name of the function into a buffer, up to a given maximum + * length. Returns a pointer to the beginning of the buffer that was + * passed in. + * + * s The buffer into which the name will be copied. + * len The size of the buffer. + */ +char *BPatch_function::getMangledName(char *s, int len) { - assert(func); - string name = func->symTabName(); - s = new char[name.length()+1]; - strcpy(s,name.string_of()); + assert(func); + string name = func->symTabName(); + strncpy(s, name.string_of(), len); + + return s; } /* @@ -372,8 +387,8 @@ bool BPatch_function::getLineToAddr(unsigned short lineNo, // // Return the module name, first and last line numbers of the function. // -bool BPatch_function::getLineAndFile(unsigned short &start, - unsigned short &end, +bool BPatch_function::getLineAndFile(unsigned int &start, + unsigned int &end, char *fileName, unsigned &length) { start = end = 0; @@ -463,3 +478,53 @@ BPatch_Vector *BPatch_function::findVariable(const char * return ret; } } + +bool BPatch_function::getVariables(BPatch_Vector &vect) +{ + return false; +} + +char *BPatch_function::getModuleName(char *name, int maxLen) { + return getModule()->getName(name, maxLen); +} + +#ifdef IBM_BPATCH_COMPAT + +bool BPatch_function::getLineNumbers(unsigned int &start, unsigned int &end) { + unsigned int length = 0; + return getLineAndFile(start, end, NULL, length); +} + +void *BPatch_function::getAddress() { return getBaseAddr(); } + +bool BPatch_function::getAddressRange(void * &start, void * &end) { + start = getBaseAddr(); + unsigned long temp = (unsigned long) start; + end = (void *) (temp + getSize()); + + return true; +} + +BPatch_type *BPatch_function::returnType() { return retType; } + +void BPatch_function::getIncPoints(BPatch_Vector &vect) +{ + BPatch_Vector *v1 = findPoint(BPatch_allLocations); + if (v1) { + for (int i=0; i < v1->size(); i++) { + vect.push_back((*v1)[i]); + } + } +} + +int BPatch_function::getMangledNameLen() { return 1024; } + +void BPatch_function::getExcPoints(BPatch_Vector &points) { + abort(); + return; +}; + +// return a function that can be passed as a paramter +BPatch_variableExpr *BPatch_function::getFunctionRef() { abort(); return NULL; } + +#endif diff --git a/dyninstAPI/src/BPatch_image.C b/dyninstAPI/src/BPatch_image.C index 3a01b6a..842bddf 100644 --- a/dyninstAPI/src/BPatch_image.C +++ b/dyninstAPI/src/BPatch_image.C @@ -39,7 +39,7 @@ * incur to third parties resulting from your use of Paradyn. */ -// $Id: BPatch_image.C,v 1.26 2001/08/20 19:59:04 bernat Exp $ +// $Id: BPatch_image.C,v 1.27 2001/08/29 23:25:27 hollings Exp $ #define BPATCH_FILE @@ -113,9 +113,15 @@ BPatch_image::~BPatch_image() * getSourceObj - Return the children (modules) * */ -BPatch_Vector *BPatch_image::getSourceObj() +bool BPatch_image::getSourceObj(BPatch_Vector &vect) { - return (BPatch_Vector *) getModules(); + BPatch_Vector *temp = getModules(); + if (temp) { + vect = * (BPatch_Vector *) temp; + return (true); + } else { + return (false); + } } /* @@ -156,6 +162,26 @@ BPatch_Vector *BPatch_image::getProcedures() } +BPatch_variableExpr *BPatch_image::createVarExprByName(BPatch_module *mod, const char *name) +{ + Symbol syminfo; + BPatch_type *type; + + type = mod->moduleTypes->globalVarsByName[name]; + assert(type); + if (!proc->getSymbolInfo(name, syminfo)) { + printf("unable to find variable %s\n", name); + } + BPatch_variableExpr *var = AddrToVarExpr->hash[syminfo.addr()]; + if (!var) { + var = new BPatch_variableExpr((char *) name, proc, + (void *)syminfo.addr(), (const BPatch_type *) type); + AddrToVarExpr->hash[syminfo.addr()] = var; + } + return var; +} + + /* * BPatch_image::getProcedures * @@ -180,19 +206,8 @@ BPatch_Vector *BPatch_image::getGlobalVariables() vector keys = module->moduleTypes->globalVarsByName.keys(); int limit = keys.size(); for (int j = 0; j < limit; j++) { - Symbol syminfo; string name = keys[j]; - type = module->moduleTypes->globalVarsByName[name]; - assert(type); - if (!proc->getSymbolInfo(name, syminfo)) { - printf("unable to find variable %s\n", name.string_of()); - } - var = AddrToVarExpr->hash[syminfo.addr()]; - if (!var) { - var = new BPatch_variableExpr((char *) name.string_of(), proc, - (void *)syminfo.addr(), (const BPatch_type *) type); - AddrToVarExpr->hash[syminfo.addr()] = var; - } + var = createVarExprByName(module, name.string_of()); varlist->push_back(var); } } @@ -201,6 +216,20 @@ BPatch_Vector *BPatch_image::getGlobalVariables() return varlist; } +bool BPatch_image::getVariables(BPatch_Vector &vars) +{ + BPatch_Vector *temp = BPatch_image::getGlobalVariables(); + + if (temp) { + vars = *temp; + return true; + } else { + vars = BPatch_Vector(); + return false; + } +} + + /* * BPatch_image::getModules * @@ -606,3 +635,30 @@ bool BPatch_image::getLineToAddr(const char* fileName,unsigned short lineNo, return true; } + +#ifdef IBM_BPATCH_COMPAT +char *BPatch_image::programName(char *name, unsigned int len) { + return getProgramName(name, len); +} + +char *BPatch_image::getProgramName(char *name, unsigned int len) { + strcpy(name, ""); + return name; +} + +int BPatch_image::lpType() +{ + return 0; +}; + +BPatch_Vector *BPatch_image::findFunction(const char *name, BPatch_Vector &funcs) +{ + BPatch_function *temp = findFunction(name); + + funcs = BPatch_Vector(); + if (temp) { + funcs.push_back(temp); + } +} +#endif + diff --git a/dyninstAPI/src/BPatch_module.C b/dyninstAPI/src/BPatch_module.C index 6be2855..4b2f1ac 100644 --- a/dyninstAPI/src/BPatch_module.C +++ b/dyninstAPI/src/BPatch_module.C @@ -65,9 +65,16 @@ char * current_func_name = NULL; * Return the contained source objects (e.g. functions). * */ -BPatch_Vector *BPatch_module::getSourceObj() +bool BPatch_module::getSourceObj(BPatch_Vector &vect) { - return (BPatch_Vector *) getProcedures(); + BPatch_Vector *temp; + temp = getProcedures(); + if (temp) { + vect = *(BPatch_Vector *) temp; + return true; + } else { + return false; + } } /* @@ -92,6 +99,16 @@ char *BPatch_module::getName(char *buffer, int length) } +char *BPatch_module::getFullName(char *buffer, int length) +{ + string str = mod->fullName(); + + strncpy(buffer, str.string_of(), length); + + return buffer; +} + + BPatch_module::BPatch_module(process *_proc, pdmodule *_mod,BPatch_image *_img): proc(_proc), mod(_mod), img(_img), BPfuncs(NULL),lineInformation(NULL) { @@ -507,13 +524,13 @@ void BPatch_module::parseTypes() } else { commonBlock = const_cast (commonBlockVar->getType()); - if (commonBlock->getDataClass() != BPatch_common) { + if (commonBlock->getDataClass() != BPatch_dataCommon) { // its still the null type, create a new one for it commonBlock = new BPatch_type(commonBlockName, false); commonBlockVar->setType(commonBlock); moduleTypes->addGlobalVariable(commonBlockName, commonBlock); - commonBlock->setDataClass(BPatch_common); + commonBlock->setDataClass(BPatch_dataCommon); } // reset field list commonBlock->beginCommonBlock(); @@ -762,13 +779,13 @@ void BPatch_module::parseTypes() printf("unable to find variable %s\n", commonBlockName); } else { commonBlock = const_cast (commonBlockVar->getType()); - if (commonBlock->getDataClass() != BPatch_common) { + if (commonBlock->getDataClass() != BPatch_dataCommon) { // its still the null type, create a new one for it commonBlock = new BPatch_type(commonBlockName, false); commonBlockVar->setType(commonBlock); moduleTypes->addGlobalVariable(commonBlockName, commonBlock); - commonBlock->setDataClass(BPatch_common); + commonBlock->setDataClass(BPatch_dataCommon); } // reset field list commonBlock->beginCommonBlock(); @@ -1020,3 +1037,47 @@ bool BPatch_module::getLineToAddr(unsigned short lineNo, delete[] elements; return true; } + + +bool BPatch_module::getVariables(BPatch_Vector &vars) +{ + BPatch_variableExpr *var; + vector keys = moduleTypes->globalVarsByName.keys(); + int limit = keys.size(); + for (int j = 0; j < limit; j++) { + string name = keys[j]; + var = img->createVarExprByName(this, name.string_of()); + vars.push_back(var); + } + if (limit) + return true; + else + return false; +} + +#ifdef IBM_BPATCH_COMPAT + +bool BPatch_module::getLineNumbers(unsigned int &start, unsigned int &end) +{ + start = 0; + end = 0; +} + +char *BPatch_module::getUniqueString(char *buffer, int length) +{ + getName(buffer, length); + return buffer; +} + +int BPatch_module::getSharedLibType() +{ + return 0; +} + +int BPatch_module::getBindingType() +{ + return 0; +} + +#endif + diff --git a/dyninstAPI/src/BPatch_snippet.C b/dyninstAPI/src/BPatch_snippet.C index 8fa24fc..70dd961 100644 --- a/dyninstAPI/src/BPatch_snippet.C +++ b/dyninstAPI/src/BPatch_snippet.C @@ -39,7 +39,7 @@ * incur to third parties resulting from your use of Paradyn. */ -// $Id: BPatch_snippet.C,v 1.30 2001/07/05 16:53:21 tikir Exp $ +// $Id: BPatch_snippet.C,v 1.31 2001/08/29 23:25:27 hollings Exp $ #define BPATCH_FILE @@ -134,7 +134,7 @@ AstNode *generateArrayRef(const BPatch_snippet &lOperand, "array reference has not type information"); return NULL; } - if (arrayType->getDataClass() != BPatch_array) { + if (arrayType->getDataClass() != BPatch_dataArray) { BPatch_reportError(BPatchSerious, 109, "array reference to non-array type"); return NULL; @@ -283,7 +283,7 @@ BPatch_arithExpr::BPatch_arithExpr(BPatch_unOp op, case BPatch_deref: { ast = new AstNode(AstNode::DataIndir, lOperand.ast); BPatch_type *type = const_cast ((lOperand.ast)->getType()); - if (!type || (type->getDataClass() != BPatch_pointer)) { + if (!type || (type->getDataClass() != BPatch_dataPointer)) { ast->setType(BPatch::bpatch->stdTypes->findType("int")); } else { ast->setType(type->getConstituentType()); @@ -413,6 +413,39 @@ BPatch_constExpr::BPatch_constExpr(const void *value) } +#ifdef IBM_BPATCH_COMPAT +// +// this is long long only in size, it will fail if a true long long +// with high bits is passed. + +BPatch_constExpr::BPatch_constExpr(long long value) +{ + assert(value < 0x00000000ffffffff); + + ast = new AstNode(AstNode::Constant, (void *)(value & 0x00000000ffffffff)); + + assert(BPatch::bpatch != NULL); + ast->setTypeChecking(BPatch::bpatch->isTypeChecked()); + + BPatch_type *type = BPatch::bpatch->stdTypes->findType("long long"); + printf("size of const expr type long long is %d\n", type->getSize()); + + assert(type != NULL); + + ast->setType(type); + printf("generating long long constant\n"); + fflush(stdout); +} + + +BPatch_constExpr::BPatch_constExpr(float value) +{ + // XXX fix me, puting value into int register. + int ivalue = (int) value; + BPatch_constExpr((int) ivalue); +} +#endif + /* * BPatch_funcCallExpr::BPatch_funcCallExpr * @@ -634,9 +667,9 @@ BPatch_variableExpr::BPatch_variableExpr(char *in_name, * Return the variable's type * */ -const BPatch_type *BPatch_variableExpr::getType() +BPatch_type *BPatch_variableExpr::getType() { - return (ast->getType()); + return (const_cast(ast->getType())); } /* @@ -790,7 +823,7 @@ BPatch_Vector *BPatch_variableExpr::getComponents() BPatch_Vector *retList; type = const_cast(getType()); - if ((type->getDataClass() != BPatch_structure) && (type->getDataClass() != BPatch_union)) { + if ((type->getDataClass() != BPatch_dataStructure) && (type->getDataClass() != BPatch_dataUnion)) { return NULL; } @@ -812,7 +845,7 @@ BPatch_Vector *BPatch_variableExpr::getComponents() AstNode *fieldExpr = new AstNode(AstNode::DataIndir, addrExpr); newVar = new BPatch_variableExpr(const_cast (field->getName()), - proc, fieldExpr, const_cast(field->type)); + proc, fieldExpr, const_cast(field->_type)); retList->push_back(newVar); } diff --git a/dyninstAPI/src/BPatch_templates.C b/dyninstAPI/src/BPatch_templates.C index 0303ed2..902de3c 100644 --- a/dyninstAPI/src/BPatch_templates.C +++ b/dyninstAPI/src/BPatch_templates.C @@ -39,7 +39,7 @@ * incur to third parties resulting from your use of Paradyn. */ -// $Id: BPatch_templates.C,v 1.17 2001/08/01 15:39:54 chadd Exp $ +// $Id: BPatch_templates.C,v 1.18 2001/08/29 23:25:27 hollings Exp $ #include @@ -86,11 +86,11 @@ template class BPatch_Vector; template class BPatch_Vector; template class BPatch_Vector; template class BPatch_Vector; +template class BPatch_Vector; #ifndef USE_STL_VECTOR template class BPatch_Vector; template class BPatch_Vector; -template class BPatch_Vector; template class BPatch_Vector; template class BPatch_Vector; template class BPatch_Vector; diff --git a/dyninstAPI/src/BPatch_thread.C b/dyninstAPI/src/BPatch_thread.C index 8b87cbf..c490705 100644 --- a/dyninstAPI/src/BPatch_thread.C +++ b/dyninstAPI/src/BPatch_thread.C @@ -39,7 +39,7 @@ * incur to third parties resulting from your use of Paradyn. */ -// $Id: BPatch_thread.C,v 1.42 2001/08/01 15:39:54 chadd Exp $ +// $Id: BPatch_thread.C,v 1.43 2001/08/29 23:25:27 hollings Exp $ #ifdef sparc_sun_solaris2_4 #include @@ -1009,6 +1009,13 @@ void BPatch_thread::oneTimeCodeCallbackDispatch(process *theProc, assert(theThread != NULL); theThread->oneTimeCodeCallback(userData, returnValue); + +#ifdef IBM_BPATCH_COMPAT + if (BPatch::bpatch->RPCdoneCallback) { + printf("invoking IBM thread callback function\n"); + BPatch::bpatch->RPCdoneCallback(theThread, userData, returnValue); + } +#endif } diff --git a/dyninstAPI/src/BPatch_type.C b/dyninstAPI/src/BPatch_type.C index 7ed0595..9b0adf6 100644 --- a/dyninstAPI/src/BPatch_type.C +++ b/dyninstAPI/src/BPatch_type.C @@ -147,7 +147,7 @@ nullType(false), cblocks(NULL) //typeCol = NULL; size = _size; - if( _type == BPatch_scalar) { + if( _type == BPatch_dataScalar) { // Check that void type == void type if( _ID == _size ){ @@ -190,7 +190,7 @@ nullType(false), cblocks(NULL) { ID = _ID; - if(_type == BPatch_scalar){ // could be a typedef for something + if(_type == BPatch_dataScalar){ // could be a typedef for something if( _name) name = strdup(_name); else @@ -330,7 +330,7 @@ nullType(false), cblocks(NULL) name = NULL; hi = NULL; low = NULL; - type_ = BPatch_scalar; + type_ = BPatch_dataScalar; ptr = _ptr; } } @@ -459,7 +459,7 @@ nullType(false), cblocks(NULL) ID = USER_BPATCH_TYPE_ID; USER_BPATCH_TYPE_ID--; - type_ = BPatch_pointer; + type_ = BPatch_dataPointer; size = size_; if( _name) @@ -598,7 +598,7 @@ nullType(false) name = NULL; hi = NULL; low = NULL; - type_ = BPatch_scalar; + type_ = BPatch_dataScalar; ptr = _ptr; } } @@ -724,14 +724,14 @@ bool BPatch_type::isCompatible(BPatch_type *otype) } } - if ((type_ == BPatch_unknownType) || (otype->type_ == BPatch_unknownType)) { + if ((type_ == BPatch_dataUnknownType) || (otype->type_ == BPatch_dataUnknownType)) { BPatch_reportError(BPatchWarning, 112, "One or more unknown BPatch_types"); return true; } switch(type_){ - case BPatch_scalar: + case BPatch_dataScalar: if (!strcmp(name,otype->name) && (size == otype->size)) { return true; } else { @@ -747,31 +747,31 @@ bool BPatch_type::isCompatible(BPatch_type *otype) return true; break; - case BPatch_reference: + case BPatch_dataReference: if (!(strcmp(name,otype->name)) && (size == otype->size)) return true; break; - case BPatch_built_inType: + case BPatch_dataBuilt_inType: if (!(strcmp(name,otype->name))&&(size == otype->size)) return true; break; - case BPatch_unknownType: + case BPatch_dataUnknownType: // should be caught above assert(0); break; - case BPatch_typeAttrib: + case BPatch_dataTypeAttrib: if (!(strcmp(name,otype->name))&&(size == otype->size)) return true; break; - case BPatch_pointer: + case BPatch_dataPointer: { BPatch_type *pType1, *pType2; - if (otype->type_ != BPatch_pointer) { + if (otype->type_ != BPatch_dataPointer) { BPatch_reportError(BPatchWarning, 112, "Pointer and non-Pointer are not type compatible"); return false; @@ -788,7 +788,7 @@ bool BPatch_type::isCompatible(BPatch_type *otype) } break; - case BPatch_func: + case BPatch_dataFunction: if (!(strcmp(name,otype->name))&&(ID == otype->ID)) { return true; } else { @@ -798,11 +798,11 @@ bool BPatch_type::isCompatible(BPatch_type *otype) } break; - case BPatch_array: + case BPatch_dataArray: { BPatch_type * arType1, * arType2; - if (otype->type_ != BPatch_array) { + if (otype->type_ != BPatch_dataArray) { BPatch_reportError(BPatchWarning, 112, "Array and non-array are not type compatible"); return false; @@ -829,7 +829,7 @@ bool BPatch_type::isCompatible(BPatch_type *otype) } break; - case BPatch_enumerated: + case BPatch_dataEnumerated: { if( !strcmp( name, otype->name) && (ID == otype->ID)) return true; @@ -856,8 +856,8 @@ bool BPatch_type::isCompatible(BPatch_type *otype) } break; - case BPatch_structure: - case BPatch_union: + case BPatch_dataStructure: + case BPatch_dataUnion: { if (!strcmp( name, otype->name) && (ID == otype->ID)) return true; @@ -951,11 +951,11 @@ void BPatch_type::addField(const char * _fieldname, BPatch_dataClass _typeDes, BPatch_field * newField; // API defined structs/union's size are defined on the fly. - if (this->type_ == BPatch_structure) + if (this->type_ == BPatch_dataStructure) this->size += _nsize; - else if ( this->type_ == BPatch_union) { + else if ( this->type_ == BPatch_dataUnion) { if( _nsize > size) size = _nsize; - } else if (type_ == BPatch_common) { + } else if (type_ == BPatch_dataCommon) { if (size < _offset + _nsize) size = _offset + _nsize; } assert ( this->size > 0 ); @@ -1002,7 +1002,7 @@ BPatch_field::BPatch_field(const char * fName, BPatch_dataClass _typeDes, value = evalue; fieldname = strdup(fName); - type = NULL; + _type = NULL; offset = size = 0; vis = BPatch_visUnknown; // printf("adding field %s\n", fName); @@ -1023,7 +1023,7 @@ BPatch_field::BPatch_field(const char * fName, BPatch_dataClass _typeDes, value = evalue; fieldname = strdup(fName); - type = NULL; + _type = NULL; offset = size = 0; vis = _vis; // printf("adding field %s\n", fName); @@ -1042,7 +1042,7 @@ BPatch_field::BPatch_field(const char * fName, BPatch_dataClass _typeDes, { typeDes = _typeDes; - type = suType; + _type = suType; offset = suOffset; fieldname = strdup(fName); size = suSize; @@ -1064,7 +1064,7 @@ BPatch_field::BPatch_field(const char * fName, BPatch_dataClass _typeDes, { typeDes = _typeDes; - type = suType; + _type = suType; offset = suOffset; fieldname = strdup(fName); size = suSize; diff --git a/dyninstAPI/src/CodeView.C b/dyninstAPI/src/CodeView.C index 67a376c..f26db45 100644 --- a/dyninstAPI/src/CodeView.C +++ b/dyninstAPI/src/CodeView.C @@ -39,7 +39,7 @@ * incur to third parties resulting from your use of Paradyn. */ -// $Id: CodeView.C,v 1.9 2001/06/15 20:47:49 hollings Exp $ +// $Id: CodeView.C,v 1.10 2001/08/29 23:25:27 hollings Exp $ #include @@ -962,7 +962,7 @@ CodeView::Symbols::FindFields(BPatch_module *mod, BPatch_type *mainType, int cou if (memberType == NULL) memberType = mod->moduleTypes->findType("void"); - mainType->addField(fname, BPatch_method, memberType, 0, 0); + mainType->addField(fname, BPatch_dataMethod, memberType, 0, 0); // printf("Field %d is LF_ONEMETHOD %s\n", i, fname); @@ -974,7 +974,7 @@ CodeView::Symbols::FindFields(BPatch_module *mod, BPatch_type *mainType, int cou (int)((LFMethod *)ptr)->name[0]); fname[(int)((LFMethod *)ptr)->name[0]] = '\0'; memberType = mod->moduleTypes->findType("void"); - mainType->addField(fname, BPatch_method, memberType, 0, 0); + mainType->addField(fname, BPatch_dataMethod, memberType, 0, 0); ptr = (unsigned char *)((LFMethod *)ptr)->name + (int)((LFMethod *)ptr)->name[0] + 1; @@ -1134,9 +1134,9 @@ CodeView::Symbols::ExploreType(BPatch_module *mod, DWORD index, typeName[(int)className[0]] = '\0'; if (trec->leaf == LF_CLASS) - newType = new BPatch_type(typeName, -1, BPatch_class, classLen); + newType = new BPatch_type(typeName, -1, BPatch_dataTypeClass, classLen); else - newType = new BPatch_type(typeName, -1, BPatch_structure, + newType = new BPatch_type(typeName, -1, BPatch_dataStructure, classLen); // printf("Name of the structure %s\n", typeName); FindFields(mod, newType, ((LFClass *)trec)->count, diff --git a/dyninstAPI/src/ast.h b/dyninstAPI/src/ast.h index 151a129..254c134 100644 --- a/dyninstAPI/src/ast.h +++ b/dyninstAPI/src/ast.h @@ -39,7 +39,7 @@ * incur to third parties resulting from your use of Paradyn. */ -// $Id: ast.h,v 1.46 2001/08/01 15:39:55 chadd Exp $ +// $Id: ast.h,v 1.47 2001/08/29 23:25:27 hollings Exp $ #ifndef AST_HDR #define AST_HDR @@ -185,6 +185,7 @@ class AstNode { int referenceCount; // Reference count for freeing memory int useCount; // Reference count for generating code void setUseCount(void); // Set values for useCount + int getSize() { return size; }; void cleanUseCount(void); bool checkUseCount(registerSpace*, bool&); void printUseCount(void); @@ -247,12 +248,6 @@ class AstNode { AstNode *eoperand; public: - - //ccw 18 jan 2001 : 28 mar 2001 - //this is used by inst-mips.C emitFuncCall to determine - //how much stack space to allocate before calling the function - int getSize() { return size; } - // Functions for getting and setting type decoration used by the // dyninst API library #ifdef BPATCH_LIBRARY diff --git a/dyninstAPI/src/dummy.C b/dyninstAPI/src/dummy.C index 476e4b5..cf9c1c9 100644 --- a/dyninstAPI/src/dummy.C +++ b/dyninstAPI/src/dummy.C @@ -39,13 +39,14 @@ * incur to third parties resulting from your use of Paradyn. */ /* - * $Id: dummy.C,v 1.5 2001/06/12 15:43:29 hollings Exp $ + * $Id: dummy.C,v 1.6 2001/08/29 23:25:27 hollings Exp $ * * Miscellaneous functions and globals that are defined in paradynd modules * which aren't being included in the library. */ #include +#include int traceSocket = 0; int traceSocket_fd = 0; @@ -60,10 +61,9 @@ extern "C" { void __uninitialized_copy_aux__H2ZPCt6vector2ZUiZt9allocator1ZUiZPt6vector2ZUiZt9allocator1ZUi_X01X01X11G12__false_type_X11() { abort(); } void __uninitialized_copy_aux__H2ZPC7FERNodeZP7FERNode_X01X01X11G12__false_type_X11() { abort(); } -void fill_n__H3ZPP11pd_FunctionZUlZP11pd_Function_X01X11RCX21_X01() {abort(); } +void fill_n__H3ZPP11pd_FunctionZUlZP11pd_Function_X01X11RCX21_X01() {} void fill_n__H3ZPP11pd_FunctionZUiZP11pd_Function_X01X11RCX21_X01() { } -void fill_n__H3ZPP7AstNodeZUlZP7AstNode_X01X11RCX21_X01() {abort(); } void fill_n__H3ZPP7AstNodeZUiZP7AstNode_X01X11RCX21_X01() { } void fill_n__H3ZPP19BPatch_variableExprZUiZP19BPatch_variableExpr_X01X11RCX21_X01() {abort(); } @@ -73,4 +73,16 @@ void fill__H2ZPP19BPatch_variableExprZP19BPatch_variableExpr_X01T0RCX11_v() { ab void fill_n__H3ZPP8pdmoduleZUiZP8pdmodule_X01X11RCX21_X01() { } +#ifdef notdef +void __uninitialized_copy_aux__H2ZPC6stringZP6string_X01X01X11G12__false_type_X11() { + printf("call fill of string\n"); +} +#endif + +void __uninitialized_copy_aux__H2ZPCt6vector2ZUlZt9allocator1ZUlZPt6vector2ZUlZt9allocator1ZUl_X01X01X11G12__false_type_X11() {} + +void fill_n__H3ZPP8pdmoduleZUlZP8pdmodule_X01X11RCX21_X01() {} + +void fill_n__H3ZPP19BPatch_variableExprZUlZP19BPatch_variableExpr_X01X11RCX21_X01() {} + } diff --git a/dyninstAPI/src/inst-power.C b/dyninstAPI/src/inst-power.C index 62e8c53..732d01c 100644 --- a/dyninstAPI/src/inst-power.C +++ b/dyninstAPI/src/inst-power.C @@ -41,7 +41,7 @@ /* * inst-power.C - Identify instrumentation points for a RS6000/PowerPCs - * $Id: inst-power.C,v 1.111 2001/08/20 19:59:06 bernat Exp $ + * $Id: inst-power.C,v 1.112 2001/08/29 23:25:27 hollings Exp $ */ #include "common/h/headers.h" @@ -343,9 +343,9 @@ Address pd_Function::newCallPoint(const Address adr, const instruction instr, void initDefaultPointFrequencyTable() { +#ifdef notdef funcFrequencyTable[EXIT_NAME] = 1; -#ifdef notdef FILE *fp; float value; char name[512]; @@ -1933,6 +1933,13 @@ Register emitFuncCall(opCode /* ocode */, // Generate the code for all function parameters, and keep a list // of what registers they're in. for (unsigned u = 0; u < operands.size(); u++) { + if (operands[u]->getSize() == 8) { + Register dummyReg = rs->allocateRegister(iPtr, base, noCost); + srcs.push_back(dummyReg); + instruction *insn = (instruction *) ((void*)&iPtr[base]); + genImmInsn(insn, CALop, dummyReg, 0, 0); + base += sizeof(instruction); + } srcs.push_back(operands[u]->generateCode(proc, rs, iPtr, base, false, false)); } @@ -2292,7 +2299,7 @@ Register emitR(opCode op, Register src1, Register /*src2*/, Register dest, } void emitVload(opCode op, Address src1, Register /*src2*/, Register dest, - char *baseInsn, Address &base, bool /*noCost*/, int /* size */) + char *baseInsn, Address &base, bool /*noCost*/, int size) { instruction *insn = (instruction *) ((void*)&baseInsn[base]); diff --git a/dyninstAPI/src/inst-sparc.C b/dyninstAPI/src/inst-sparc.C index 284a0f5..ae64fa5 100644 --- a/dyninstAPI/src/inst-sparc.C +++ b/dyninstAPI/src/inst-sparc.C @@ -39,7 +39,7 @@ * incur to third parties resulting from your use of Paradyn. */ -// $Id: inst-sparc.C,v 1.104 2001/08/20 19:59:07 bernat Exp $ +// $Id: inst-sparc.C,v 1.105 2001/08/29 23:25:28 hollings Exp $ #include "dyninstAPI/src/inst-sparc.h" #include "dyninstAPI/src/instPoint.h" @@ -1434,6 +1434,7 @@ void emitFuncJump(opCode op, #ifdef BPATCH_LIBRARY #include "BPatch_flowGraph.h" +#include "BPatch_function.h" #include diff --git a/dyninstAPI/src/parseStab.C b/dyninstAPI/src/parseStab.C index fd13f86..d6bf50a 100644 --- a/dyninstAPI/src/parseStab.C +++ b/dyninstAPI/src/parseStab.C @@ -486,7 +486,7 @@ char *parseStabString(BPatch_module *mod, int linenum, char *stabstr, } } if (!found) { - commonBlock->addField(name, BPatch_scalar, BPtype, + commonBlock->addField(name, BPatch_dataScalar, BPtype, framePtr, BPtype->getSize()); } } else { @@ -649,7 +649,7 @@ static char *parseCrossRef(BPatch_typeCollection *moduleTypes, char *name, { char *temp; BPatch_type *newType; - BPatch_dataClass typdescr = BPatch_pointer; + BPatch_dataClass typdescr = BPatch_dataPointer; cnt++; /* skip 'x'*/ if ((stabstr[cnt] == 's') || // struct @@ -761,7 +761,7 @@ static BPatch_type *parseArrayDef(BPatch_module *mod, char *name, if (ptrType) { // Create new type - field in a struct or union - newType = new BPatch_type(name, ID, BPatch_array, ptrType, + newType = new BPatch_type(name, ID, BPatch_dataArray, ptrType, lowbound, hibound); if (newType) { // Add to Collection @@ -968,7 +968,7 @@ static void parseAttrType(BPatch_module *mod, char *name, int ID, char *stabstr, int &cnt) { // format @s(size in bits); negative type number; - BPatch_dataClass typdescr = BPatch_typeAttrib; + BPatch_dataClass typdescr = BPatch_dataTypeAttrib; assert(stabstr[cnt] == '@'); cnt++; /* skip the @ */ @@ -1023,7 +1023,7 @@ static char *parseRefType(BPatch_module *mod, char *name, BPatch_type *ptrType = mod->moduleTypes->findType(refID); if (!ptrType) ptrType = BPatch::bpatch->type_Untyped; - BPatch_type *newType = new BPatch_type(name, ID, BPatch_pointer, ptrType); + BPatch_type *newType = new BPatch_type(name, ID, BPatch_dataPointer, ptrType); // Add to typeCollection if(newType) { mod->moduleTypes->addType(newType); @@ -1073,7 +1073,7 @@ static char *parseFieldList(BPatch_module *mod, BPatch_type *newType, //Find base class BPatch_type *baseCl = mod->moduleTypes->findType(baseID); - if (!baseCl || (baseCl->getDataClass() != BPatch_structure) ) + if (!baseCl || (baseCl->getDataClass() != BPatch_dataStructure) ) continue; //Get field descriptions of the base type @@ -1094,7 +1094,7 @@ static char *parseFieldList(BPatch_module *mod, BPatch_type *newType, } while (stabstr[cnt] && (stabstr[cnt] != ';')) { - typedescr = BPatch_scalar; + typedescr = BPatch_dataScalar; if (stabstr[cnt] == '~') { //End of virtual class @@ -1115,7 +1115,7 @@ static char *parseFieldList(BPatch_module *mod, BPatch_type *newType, if ((stabstr[cnt]) == ':') { //Method definition - typedescr = BPatch_method; + typedescr = BPatch_dataMethod; cnt++; } @@ -1148,7 +1148,7 @@ static char *parseFieldList(BPatch_module *mod, BPatch_type *newType, beg_offset = 0; size = 0; - if (typedescr == BPatch_method) { + if (typedescr == BPatch_dataMethod) { while(1) { //Mangling of arguments while(stabstr[cnt] != ';') cnt++; @@ -1295,7 +1295,7 @@ static char *parseTypeDef(BPatch_module *mod, char *stabstr, char *name, int ID) // fprintf(stderr, "parsing %s\n", stabstr); if (isSymId(stabstr[0])) { - typdescr = BPatch_scalar; + typdescr = BPatch_dataScalar; type = parseSymDesc(stabstr, cnt); if (ID == type) { @@ -1334,7 +1334,7 @@ static char *parseTypeDef(BPatch_module *mod, char *stabstr, char *name, int ID) break; case '*': - typdescr = BPatch_pointer; + typdescr = BPatch_dataPointer; /* pointer to another type */ cnt++; ptrID = parseTypeUse(mod, stabstr, cnt, NULL); @@ -1343,7 +1343,7 @@ static char *parseTypeDef(BPatch_module *mod, char *stabstr, char *name, int ID) ptrType = mod->moduleTypes->findType(ptrID); if (!ptrType) ptrType = BPatch::bpatch->type_Untyped; - newType = new BPatch_type(NULL, ID, BPatch_pointer, ptrType); + newType = new BPatch_type(NULL, ID, BPatch_dataPointer, ptrType); // Add to typeCollection if(newType) mod->moduleTypes->addType(newType); if(!newType) { @@ -1361,7 +1361,7 @@ static char *parseTypeDef(BPatch_module *mod, char *stabstr, char *name, int ID) case 'f': /* function type */ - typdescr = BPatch_func; + typdescr = BPatch_dataFunction; cnt++; /* skip the f */ type = parseTypeUse(mod, stabstr, cnt, name); @@ -1380,7 +1380,7 @@ static char *parseTypeDef(BPatch_module *mod, char *stabstr, char *name, int ID) int size = parseSymDesc(stabstr, cnt); ptrType = mod->moduleTypes->findType(baseType); - newType = new BPatch_type(name, ID, BPatch_array, ptrType, + newType = new BPatch_type(name, ID, BPatch_dataArray, ptrType, 1, size); mod->moduleTypes->addType(newType); } @@ -1395,7 +1395,7 @@ static char *parseTypeDef(BPatch_module *mod, char *stabstr, char *name, int ID) int bytes = parseSymDesc(stabstr, cnt); - newType = new BPatch_type(name, ID, BPatch_built_inType, bytes); + newType = new BPatch_type(name, ID, BPatch_dataBuilt_inType, bytes); mod->moduleTypes->addType(newType); if (stabstr[cnt] == ';') cnt++; // skip the final ';' @@ -1405,7 +1405,7 @@ static char *parseTypeDef(BPatch_module *mod, char *stabstr, char *name, int ID) case 'b': { // builtin type b - signed char-flag width; offset; nbits - typdescr = BPatch_built_inType; + typdescr = BPatch_dataBuilt_inType; int limit = strlen(&stabstr[cnt]); // skip to width @@ -1424,7 +1424,7 @@ static char *parseTypeDef(BPatch_module *mod, char *stabstr, char *name, int ID) if (stabstr[cnt]) cnt++; // skip the final ';' - newType = new BPatch_type(name, ID, BPatch_built_inType, + newType = new BPatch_type(name, ID, BPatch_dataBuilt_inType, nbits/8); //Add to Collection mod->moduleTypes->addType(newType); @@ -1438,7 +1438,7 @@ static char *parseTypeDef(BPatch_module *mod, char *stabstr, char *name, int ID) break; case 'e': // Enumerated type - typdescr = BPatch_enumerated; + typdescr = BPatch_dataEnumerated; cnt++; /* skip the 'e' */ // Create new Enum type @@ -1454,7 +1454,7 @@ static char *parseTypeDef(BPatch_module *mod, char *stabstr, char *name, int ID) value = parseSymDesc(stabstr, cnt); // add enum field to type - newType->addField(compsymdesc, BPatch_scalar, value); + newType->addField(compsymdesc, BPatch_dataScalar, value); free(temp); free(compsymdesc); @@ -1486,9 +1486,9 @@ static char *parseTypeDef(BPatch_module *mod, char *stabstr, char *name, int ID) case 'u': // union /* Type descriptor */ if (stabstr[cnt] == 's') { - typdescr = BPatch_structure; + typdescr = BPatch_dataStructure; } else { - typdescr = BPatch_union; + typdescr = BPatch_dataUnion; } cnt++; // skip to size diff --git a/dyninstAPI/src/process.C b/dyninstAPI/src/process.C index 9f18539..91f4ea6 100644 --- a/dyninstAPI/src/process.C +++ b/dyninstAPI/src/process.C @@ -39,7 +39,7 @@ * incur to third parties resulting from your use of Paradyn. */ -// $Id: process.C,v 1.262 2001/08/23 14:43:22 schendel Exp $ +// $Id: process.C,v 1.263 2001/08/29 23:25:28 hollings Exp $ extern "C" { #ifdef PARADYND_PVM @@ -2308,7 +2308,7 @@ void process::registerInferiorAttachedSegs(void *inferiorAttachedAtPtr) { extern bool forkNewProcess(string &file, string dir, vector argv, - vectorenvp, string inputFile, string outputFile, + vector envp, string inputFile, string outputFile, int &traceLink, int &pid, int &tid, int &procHandle, int &thrHandle, @@ -2605,7 +2605,10 @@ bool attachProcess(const string &progpath, int pid, int afterAttach to load it again (in fact, we will probably hang if we try to load it again). This is checked in the call to handleStartProcess */ - theProc->dlopenDYNINSTlib(); + if (!theProc->dlopenDYNINSTlib()) { + return false; + } + // this will set isLoadingDyninstLib to true - naim if (!theProc->continueProc()) { logLine("WARNING: continueProc failed\n"); @@ -5379,6 +5382,7 @@ bool process::handleDoneSAFEinferiorRPC(void) { // step 4) invoke user callback, if any if (theStruct.callbackFunc) { + printf("about to invoke RPC callback\n"); theStruct.callbackFunc(this, theStruct.userData, theStruct.resultValue); } currRunningRPCs.removeByIndex(k); diff --git a/dyninstAPI/src/symtab.C b/dyninstAPI/src/symtab.C index 4903ea4..0541b7c 100644 --- a/dyninstAPI/src/symtab.C +++ b/dyninstAPI/src/symtab.C @@ -39,7 +39,7 @@ * incur to third parties resulting from your use of Paradyn. */ -// $Id: symtab.C,v 1.127 2001/08/23 14:43:29 schendel Exp $ +// $Id: symtab.C,v 1.128 2001/08/29 23:25:28 hollings Exp $ #include #include @@ -1343,7 +1343,10 @@ image::image(fileDescriptor *desc, bool &err) statusLine(msg.string_of()); // short file name - name_ = extract_pathname_tail(desc->file()); + // XXX still need full name for later parsing steps + // jkh - 7/11/01 + // name_ = extract_pathname_tail(desc->file()); + name_ = desc->file(); err = false; // use the *DUMMY_MODULE* until a module is defined diff --git a/dyninstAPI/tests/rs6000-ibm-aix4.2/Makefile b/dyninstAPI/tests/rs6000-ibm-aix4.2/Makefile index 956f742..70227b8 100644 --- a/dyninstAPI/tests/rs6000-ibm-aix4.2/Makefile +++ b/dyninstAPI/tests/rs6000-ibm-aix4.2/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile,v 1.16 2001/08/28 19:39:39 schendel Exp $ +# $Id: Makefile,v 1.17 2001/08/29 23:25:30 hollings Exp $ # # Define any symbols needed to invoke configuration changes in make.config @@ -58,6 +58,7 @@ COMPILER1 = $(subst $(BLANK),_,$(COMPILERT)) COMPILER2 = $(subst $(LPAREN),_,$(COMPILER1)) COMPILER = $(subst $(RPAREN),_,$(COMPILER2)) MUTATEE_CFLAGS += -DCOMPILER='"$(COMPILER)"' +LDFLAGS += -lbsd $(TARGET2): $(MUTATEE_SRC) -$(MUTATEE_CC) -g $(MUTATEE_CFLAGS) -Wl,-bnoobjreorder \ diff --git a/dyninstAPI/tests/src/test1.C b/dyninstAPI/tests/src/test1.C index a23fa08..8ce0a7c 100644 --- a/dyninstAPI/tests/src/test1.C +++ b/dyninstAPI/tests/src/test1.C @@ -2244,7 +2244,7 @@ bool printSrcObj(BPatch_sourceObj *p, int level) int i; bool ret = true; - BPatch_Vector *curr; + BPatch_Vector curr; if (!p) return(true); @@ -2265,14 +2265,13 @@ bool printSrcObj(BPatch_sourceObj *p, int level) printf(""); } - curr = p->getSourceObj(); - if (!curr) { + if (!p->getSourceObj(curr)) { // eveything down to functions should have something return((level == 2) ? true : false); } - for (i=0; i < curr->size(); i++) { - p = (*curr)[i]; + for (i=0; i < curr.size(); i++) { + p = curr[i]; ret = printSrcObj(p, level+1) && ret; } -- 1.8.3.1