From 55daa215726c6909e9da87e9271afc25b567692a Mon Sep 17 00:00:00 2001 From: jodom Date: Wed, 29 Jan 2003 23:01:22 +0000 Subject: [PATCH] This commit implements the functions BPatch_function::isSharedLib() and BPatch_module::isSharedLib(). --- dyninstAPI/h/BPatch_function.h | 2 ++ dyninstAPI/h/BPatch_module.h | 1 + dyninstAPI/src/BPatch_function.C | 7 ++++++- dyninstAPI/src/BPatch_module.C | 4 ++++ dyninstAPI/src/symtab.C | 8 +++++++- dyninstAPI/src/symtab.h | 4 +++- 6 files changed, 23 insertions(+), 3 deletions(-) diff --git a/dyninstAPI/h/BPatch_function.h b/dyninstAPI/h/BPatch_function.h index 4daa5de..1c23fff 100644 --- a/dyninstAPI/h/BPatch_function.h +++ b/dyninstAPI/h/BPatch_function.h @@ -143,6 +143,8 @@ public: // Returns true if the function is instrumentable. bool isInstrumentable(); + bool isSharedLib() const; + #ifdef IBM_BPATCH_COMPAT bool getLineNumbers(unsigned int &start, unsigned int &end); diff --git a/dyninstAPI/h/BPatch_module.h b/dyninstAPI/h/BPatch_module.h index 2b9baaa..d745592 100644 --- a/dyninstAPI/h/BPatch_module.h +++ b/dyninstAPI/h/BPatch_module.h @@ -99,6 +99,7 @@ public: // parse stab stuff when needed void parseTypes(); + bool isSharedLib() const; char *parseStabStringSymbol(int line, char *stabstr, void *stabptr); diff --git a/dyninstAPI/src/BPatch_function.C b/dyninstAPI/src/BPatch_function.C index 33168bb..9752044 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.29 2002/12/20 07:49:55 jaw Exp $ +// $Id: BPatch_function.C,v 1.30 2003/01/29 23:01:22 jodom Exp $ #define BPATCH_FILE @@ -708,3 +708,8 @@ bool BPatch_function::isInstrumentable() return ((pd_Function *)func)->isInstrumentable(); } +// Return TRUE if the function resides in a shared lib, FALSE otherwise + +bool BPatch_function::isSharedLib() const { + return mod->isSharedLib(); +} diff --git a/dyninstAPI/src/BPatch_module.C b/dyninstAPI/src/BPatch_module.C index 2f0010c..7efcfc3 100644 --- a/dyninstAPI/src/BPatch_module.C +++ b/dyninstAPI/src/BPatch_module.C @@ -1067,6 +1067,10 @@ LineInformation* BPatch_module::getLineInformation(){ return lineInformation; } +bool BPatch_module::isSharedLib() const { + return mod->isShared(); +} + #ifdef IBM_BPATCH_COMPAT bool BPatch_module::getLineNumbers(unsigned int &start, unsigned int &end) diff --git a/dyninstAPI/src/symtab.C b/dyninstAPI/src/symtab.C index fe5bd2f..1b7290d 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.145 2003/01/02 19:51:20 schendel Exp $ +// $Id: symtab.C,v 1.146 2003/01/29 23:01:22 jodom Exp $ #include #include @@ -1863,3 +1863,9 @@ bool image::findFunction(const string &name, pdvector &retList, return found; } #endif + +// Returns TRUE if module belongs to a shared library, and FALSE otherwise + +bool pdmodule::isShared() const { + return !exec_->isAOut(); +} diff --git a/dyninstAPI/src/symtab.h b/dyninstAPI/src/symtab.h index 712884d..0e8831a 100644 --- a/dyninstAPI/src/symtab.h +++ b/dyninstAPI/src/symtab.h @@ -39,7 +39,7 @@ * incur to third parties resulting from your use of Paradyn. */ -// $Id: symtab.h,v 1.116 2003/01/23 17:55:49 tlmiller Exp $ +// $Id: symtab.h,v 1.117 2003/01/29 23:01:22 jodom Exp $ #ifndef SYMTAB_HDR #define SYMTAB_HDR @@ -668,6 +668,7 @@ public: pdvector *getIncludedFunctions(); function_base *findFunction (const string &name); function_base *findFunctionFromAll(const string &name); + bool isShared() const; #ifndef BPATCH_LIBRARY resource *getResource() { return modResource; } #endif @@ -686,6 +687,7 @@ private: // list of non-excluded found functions in module.... pdvector some_funcs; bool some_funcs_inited; + bool shared_; // if image it belongs to is shared lib }; -- 1.8.3.1