| AbslocInterface.h | | AbslocInterface.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 49 | | skipping to change at line 48 | |
| #include "Absloc.h" | | #include "Absloc.h" | |
| #include "util.h" | | #include "util.h" | |
| | | | |
| class int_function; | | class int_function; | |
| class BPatch_function; | | class BPatch_function; | |
| | | | |
| namespace Dyninst { | | namespace Dyninst { | |
| | | | |
| namespace ParseAPI { | | namespace ParseAPI { | |
| class Function; | | class Function; | |
|
| | | class Block; | |
| }; | | }; | |
| | | | |
| class AbsRegionConverter { | | class AbsRegionConverter { | |
| public: | | public: | |
| DATAFLOW_EXPORT AbsRegionConverter(bool cache, bool stack = true) : | | DATAFLOW_EXPORT AbsRegionConverter(bool cache, bool stack = true) : | |
| cacheEnabled_(cache), stackAnalysisEnabled_(stack) {}; | | cacheEnabled_(cache), stackAnalysisEnabled_(stack) {}; | |
| | | | |
| // Definition: the first AbsRegion represents the expression. | | // Definition: the first AbsRegion represents the expression. | |
| // If it's a memory reference, any other AbsRegions represent | | // If it's a memory reference, any other AbsRegions represent | |
| // registers used in this expression. | | // registers used in this expression. | |
| | | | |
| DATAFLOW_EXPORT void convertAll(InstructionAPI::Expression::Ptr expr, | | DATAFLOW_EXPORT void convertAll(InstructionAPI::Expression::Ptr expr, | |
| Address addr, | | Address addr, | |
| ParseAPI::Function *func, | | ParseAPI::Function *func, | |
|
| | | ParseAPI::Block *block, | |
| std::vector<AbsRegion> ®ions); | | std::vector<AbsRegion> ®ions); | |
| | | | |
| DATAFLOW_EXPORT void convertAll(InstructionAPI::Instruction::Ptr insn, | | DATAFLOW_EXPORT void convertAll(InstructionAPI::Instruction::Ptr insn, | |
| Address addr, | | Address addr, | |
| ParseAPI::Function *func, | | ParseAPI::Function *func, | |
|
| | | ParseAPI::Block *block, | |
| std::vector<AbsRegion> &used, | | std::vector<AbsRegion> &used, | |
| std::vector<AbsRegion> &defined); | | std::vector<AbsRegion> &defined); | |
| | | | |
| // Single converters | | // Single converters | |
| | | | |
| DATAFLOW_EXPORT AbsRegion convert(InstructionAPI::RegisterAST::Ptr reg); | | DATAFLOW_EXPORT AbsRegion convert(InstructionAPI::RegisterAST::Ptr reg); | |
| | | | |
| DATAFLOW_EXPORT AbsRegion convert(InstructionAPI::Expression::Ptr expr, | | DATAFLOW_EXPORT AbsRegion convert(InstructionAPI::Expression::Ptr expr, | |
| Address addr, | | Address addr, | |
|
| ParseAPI::Function *func); | | ParseAPI::Function *func, | |
| | | ParseAPI::Block *block); | |
| | | | |
| // Cons up a stack reference at the current addr | | // Cons up a stack reference at the current addr | |
| DATAFLOW_EXPORT AbsRegion stack(Address addr, | | DATAFLOW_EXPORT AbsRegion stack(Address addr, | |
| ParseAPI::Function *func, | | ParseAPI::Function *func, | |
|
| | | ParseAPI::Block *block, | |
| bool push); | | bool push); | |
| | | | |
| DATAFLOW_EXPORT AbsRegion frame(Address addr, | | DATAFLOW_EXPORT AbsRegion frame(Address addr, | |
| ParseAPI::Function *func, | | ParseAPI::Function *func, | |
|
| | | ParseAPI::Block *block, | |
| bool push); | | bool push); | |
| | | | |
| private: | | private: | |
| // Returns false if the current height is unknown. | | // Returns false if the current height is unknown. | |
| bool getCurrentStackHeight(ParseAPI::Function *func, | | bool getCurrentStackHeight(ParseAPI::Function *func, | |
|
| | | ParseAPI::Block *block, | |
| Address addr, | | Address addr, | |
|
| long &height, int ®ion); | | long &height); | |
| bool getCurrentFrameHeight(ParseAPI::Function *func, | | bool getCurrentFrameHeight(ParseAPI::Function *func, | |
|
| | | ParseAPI::Block *block, | |
| Address addr, | | Address addr, | |
|
| long &height, int ®ion); | | long &height); | |
| | | | |
| bool convertResultToAddr(const InstructionAPI::Result &res, Address &addr
); | | bool convertResultToAddr(const InstructionAPI::Result &res, Address &addr
); | |
| bool convertResultToSlot(const InstructionAPI::Result &res, int &slot); | | bool convertResultToSlot(const InstructionAPI::Result &res, int &slot); | |
| | | | |
| bool usedCache(Address, ParseAPI::Function *, std::vector<AbsRegion> &use
d); | | bool usedCache(Address, ParseAPI::Function *, std::vector<AbsRegion> &use
d); | |
| bool definedCache(Address, ParseAPI::Function *, std::vector<AbsRegion> &
defined); | | bool definedCache(Address, ParseAPI::Function *, std::vector<AbsRegion> &
defined); | |
| | | | |
| // Caching mechanism... | | // Caching mechanism... | |
| typedef std::vector<AbsRegion> RegionVec; | | typedef std::vector<AbsRegion> RegionVec; | |
| | | | |
| | | | |
| skipping to change at line 120 | | skipping to change at line 127 | |
| FuncCache defined_cache_; | | FuncCache defined_cache_; | |
| bool cacheEnabled_; | | bool cacheEnabled_; | |
| bool stackAnalysisEnabled_; | | bool stackAnalysisEnabled_; | |
| }; | | }; | |
| | | | |
| class AssignmentConverter { | | class AssignmentConverter { | |
| public: | | public: | |
| DATAFLOW_EXPORT AssignmentConverter(bool cache, bool stack = true) : cache
Enabled_(cache), aConverter(false, stack) {}; | | DATAFLOW_EXPORT AssignmentConverter(bool cache, bool stack = true) : cache
Enabled_(cache), aConverter(false, stack) {}; | |
| | | | |
| DATAFLOW_EXPORT void convert(InstructionAPI::Instruction::Ptr insn, | | DATAFLOW_EXPORT void convert(InstructionAPI::Instruction::Ptr insn, | |
|
| const Address &addr, | | const Address &addr, | |
| ParseAPI::Function *func, | | ParseAPI::Function *func, | |
| std::vector<Assignment::Ptr> &assignments); | | ParseAPI::Block *block, | |
| | | std::vector<Assignment::Ptr> &assignments); | |
| | | | |
| private: | | private: | |
| void handlePushEquivalent(const InstructionAPI::Instruction::Ptr I, | | void handlePushEquivalent(const InstructionAPI::Instruction::Ptr I, | |
| Address addr, | | Address addr, | |
| ParseAPI::Function *func, | | ParseAPI::Function *func, | |
|
| | | ParseAPI::Block *block, | |
| std::vector<AbsRegion> &operands, | | std::vector<AbsRegion> &operands, | |
| std::vector<Assignment::Ptr> &assignments); | | std::vector<Assignment::Ptr> &assignments); | |
| void handlePopEquivalent(const InstructionAPI::Instruction::Ptr I, | | void handlePopEquivalent(const InstructionAPI::Instruction::Ptr I, | |
| Address addr, | | Address addr, | |
| ParseAPI::Function *func, | | ParseAPI::Function *func, | |
|
| | | ParseAPI::Block *block, | |
| std::vector<AbsRegion> &operands, | | std::vector<AbsRegion> &operands, | |
| std::vector<Assignment::Ptr> &assignments); | | std::vector<Assignment::Ptr> &assignments); | |
| | | | |
| bool cache(ParseAPI::Function *func, Address addr, std::vector<Assignment
::Ptr> &assignments); | | bool cache(ParseAPI::Function *func, Address addr, std::vector<Assignment
::Ptr> &assignments); | |
| | | | |
| typedef std::vector<Assignment::Ptr> AssignmentVec; | | typedef std::vector<Assignment::Ptr> AssignmentVec; | |
| typedef std::map<Address, AssignmentVec> AddrCache; | | typedef std::map<Address, AssignmentVec> AddrCache; | |
| typedef std::map<ParseAPI::Function *, AddrCache> FuncCache; | | typedef std::map<ParseAPI::Function *, AddrCache> FuncCache; | |
| | | | |
| FuncCache cache_; | | FuncCache cache_; | |
| | | | |
End of changes. 15 change blocks. |
| 13 lines changed or deleted | | 23 lines changed or added | |
|
| Annotatable.h | | Annotatable.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 47 | | skipping to change at line 46 | |
| #endif | | #endif | |
| #include "dyntypes.h" | | #include "dyntypes.h" | |
| #include <vector> | | #include <vector> | |
| #include <map> | | #include <map> | |
| #include <typeinfo> | | #include <typeinfo> | |
| #include <string> | | #include <string> | |
| #include <string.h> // for strrchr() | | #include <string.h> // for strrchr() | |
| #include <assert.h> | | #include <assert.h> | |
| #include <stdio.h> | | #include <stdio.h> | |
| #include <stdlib.h> | | #include <stdlib.h> | |
|
| | | #include "Serialization.h" | |
| #include "util.h" | | #include "util.h" | |
|
| #include "dyn_detail/boost/type_traits/is_base_of.hpp" | | | |
| #include "dyn_detail/boost/type_traits/is_pointer.hpp" | | | |
| #include "dyn_detail/boost/type_traits/remove_pointer.hpp" | | | |
| #define serialize_printf serializer_printf | | | |
| | | | |
| namespace Dyninst | | namespace Dyninst | |
| { | | { | |
| | | | |
|
| | | class SerializerBase; | |
| | | class Serializable; | |
| | | typedef Serializable * (*ser_func_t) (void *, SerializerBase *, const char | |
| | | *); | |
| | | | |
| | | #if !defined(SERIALIZATION_DISABLED) | |
| | | #define serialize_printf serializer_printf | |
| COMMON_EXPORT int serializer_printf(const char *format, ...); | | COMMON_EXPORT int serializer_printf(const char *format, ...); | |
|
| COMMON_EXPORT int annotatable_printf(const char *format, ...); | | COMMON_EXPORT Serializable * ser_func_wrapper(void *it, SerializerBase *sb, | |
| | | const char *tag); | |
| | | #endif | |
| COMMON_EXPORT bool annotation_debug_flag(); | | COMMON_EXPORT bool annotation_debug_flag(); | |
|
| | | COMMON_EXPORT int annotatable_printf(const char *format, ...); | |
| | | | |
| typedef unsigned short AnnotationClassID; | | typedef unsigned short AnnotationClassID; | |
| typedef bool (*anno_cmp_func_t)(void *, void*); | | typedef bool (*anno_cmp_func_t)(void *, void*); | |
| | | | |
| extern int newAnnotationClass(); | | extern int newAnnotationClass(); | |
| extern bool void_ptr_cmp_func(void *, void *); | | extern bool void_ptr_cmp_func(void *, void *); | |
| | | | |
|
| class SerializerBase; | | | |
| class Serializable; | | | |
| typedef Serializable * (*ser_func_t) (void *, SerializerBase *, const char | | | |
| *); | | | |
| COMMON_EXPORT Serializable * ser_func_wrapper(void *it, SerializerBase *sb, | | | |
| const char *tag); | | | |
| | | | |
| class AnnotationClassBase | | class AnnotationClassBase | |
| { | | { | |
| friend class Serializable; | | friend class Serializable; | |
| private: | | private: | |
| static std::vector<AnnotationClassBase *> *annotation_types; | | static std::vector<AnnotationClassBase *> *annotation_types; | |
| static dyn_hash_map<std::string, AnnotationClassID> *annotation_ids_b
y_name; | | static dyn_hash_map<std::string, AnnotationClassID> *annotation_ids_b
y_name; | |
| #if 0 | | #if 0 | |
| COMMON_EXPORT static void clearAnnotationIDMap(); | | COMMON_EXPORT static void clearAnnotationIDMap(); | |
| #endif | | #endif | |
| anno_cmp_func_t cmp_func; | | anno_cmp_func_t cmp_func; | |
| | | | |
| skipping to change at line 116 | | skipping to change at line 115 | |
| | | | |
| template <class T> | | template <class T> | |
| class AnnotationClass : public AnnotationClassBase { | | class AnnotationClass : public AnnotationClassBase { | |
| public: | | public: | |
| | | | |
| AnnotationClass(std::string n, | | AnnotationClass(std::string n, | |
| anno_cmp_func_t cmp_func_ = NULL, | | anno_cmp_func_t cmp_func_ = NULL, | |
| ser_func_t s = NULL) : | | ser_func_t s = NULL) : | |
| AnnotationClassBase(n, cmp_func_, s) | | AnnotationClassBase(n, cmp_func_, s) | |
| { | | { | |
|
| | | #if !defined(SERIALIZATION_DISABLED) | |
| if (NULL == s) | | if (NULL == s) | |
| { | | { | |
| // if the type is Serializable, use its serializati
on function | | // if the type is Serializable, use its serializati
on function | |
| // otherwise, leave it NULL so we don't accidentall
y dereference | | // otherwise, leave it NULL so we don't accidentall
y dereference | |
| // a random pointer as if it were automatcally desc
ended from | | // a random pointer as if it were automatcally desc
ended from | |
| // Serializable | | // Serializable | |
|
| | | if (boost::is_base_of<Serializable, T>::value) | |
| if (dyn_detail::boost::is_base_of<Serializable, T>:: | | | |
| value) | | | |
| { | | { | |
| serialize_func = ser_func_wrapper; | | serialize_func = ser_func_wrapper; | |
|
| } | | } else | |
| else if (dyn_detail::boost::is_pointer<T>::value) | | if (boost::is_pointer<T>::value) | |
| { | | { | |
|
| if (dyn_detail::boost::is_base_of<Serializab | | if (boost::is_base_of<Serializable, | |
| le, | | typename boost::remove_point | |
| typename dyn_detail::boost:: | | er<T>::type>::value) | |
| remove_pointer<T>::type>::value) | | | |
| { | | { | |
| serialize_func = ser_func_wrapper; | | serialize_func = ser_func_wrapper; | |
| } | | } | |
| } | | } | |
| } | | } | |
|
| | | #endif | |
| } | | } | |
| | | | |
| const char *getTypeName() { return typeid(T).name();} | | const char *getTypeName() { return typeid(T).name();} | |
| void *allocate() | | void *allocate() | |
| { | | { | |
|
| // If T is (Serializable *) need to allocate a new object | | | |
| , not a new pointer | | | |
| // | | | |
| | | | |
| if (dyn_detail::boost::is_pointer<T>::value) | | | |
| { | | | |
| if (dyn_detail::boost::is_base_of<Serializab | | | |
| le, | | | |
| typename dyn_detail::boost:: | | | |
| remove_pointer<T>::type>::value) | | | |
| { | | | |
| return (void *) new (typename dyn_de | | | |
| tail::boost::remove_pointer<T>::type)(); | | | |
| } | | | |
| } | | | |
| | | | |
| return (void *) new T(); | | return (void *) new T(); | |
| } | | } | |
| | | | |
| size_t size() {return sizeof(T);} | | size_t size() {return sizeof(T);} | |
| #if 0 | | #if 0 | |
| bool isSparselyAnnotatable(); | | bool isSparselyAnnotatable(); | |
| bool isDenselyAnnotatable(); | | bool isDenselyAnnotatable(); | |
| #endif | | #endif | |
| }; | | }; | |
| | | | |
| | | | |
| skipping to change at line 192 | | skipping to change at line 180 | |
| COMMON_EXPORT const char *serPostOp2Str(ser_post_op_t); | | COMMON_EXPORT const char *serPostOp2Str(ser_post_op_t); | |
| | | | |
| class AnnotatableDense; | | class AnnotatableDense; | |
| class AnnotatableSparse; | | class AnnotatableSparse; | |
| COMMON_EXPORT bool is_input(SerializerBase *sb); | | COMMON_EXPORT bool is_input(SerializerBase *sb); | |
| COMMON_EXPORT bool is_output(SerializerBase *sb); | | COMMON_EXPORT bool is_output(SerializerBase *sb); | |
| COMMON_EXPORT unsigned short get_serializer_index(SerializerBase *sb); | | COMMON_EXPORT unsigned short get_serializer_index(SerializerBase *sb); | |
| COMMON_EXPORT bool ser_operation(SerializerBase *, ser_post_op_t &, const c
har *); | | COMMON_EXPORT bool ser_operation(SerializerBase *, ser_post_op_t &, const c
har *); | |
| COMMON_EXPORT bool add_annotations(SerializerBase *, AnnotatableDense *, st
d::vector<ser_rec_t> &); | | COMMON_EXPORT bool add_annotations(SerializerBase *, AnnotatableDense *, st
d::vector<ser_rec_t> &); | |
| COMMON_EXPORT bool add_annotations(SerializerBase *, AnnotatableSparse *, s
td::vector<ser_rec_t> &); | | COMMON_EXPORT bool add_annotations(SerializerBase *, AnnotatableSparse *, s
td::vector<ser_rec_t> &); | |
|
| | | #if !defined(SERIALIZATION_DISABLED) | |
| COMMON_EXPORT bool serialize_annotation_list(void *, std::vector<ser_rec_t>
&, SerializerBase *sb, const char *); | | COMMON_EXPORT bool serialize_annotation_list(void *, std::vector<ser_rec_t>
&, SerializerBase *sb, const char *); | |
| COMMON_EXPORT SerializerBase *getExistingOutputSB(unsigned short); | | COMMON_EXPORT SerializerBase *getExistingOutputSB(unsigned short); | |
| COMMON_EXPORT bool serialize_post_annotation(void *, void *, SerializerBase
*, AnnotationClassBase *acb, sparse_or_dense_anno_t, const char *); | | COMMON_EXPORT bool serialize_post_annotation(void *, void *, SerializerBase
*, AnnotationClassBase *acb, sparse_or_dense_anno_t, const char *); | |
|
| | | #endif | |
| | | | |
|
| class AnnotatableDense | | class COMMON_EXPORT AnnotatableDense | |
| { | | { | |
| friend COMMON_EXPORT bool add_annotations(SerializerBase *, Annotata
bleDense *, std::vector<ser_rec_t> &); | | friend COMMON_EXPORT bool add_annotations(SerializerBase *, Annotata
bleDense *, std::vector<ser_rec_t> &); | |
| friend class SerializerBase; | | friend class SerializerBase; | |
| friend class Serializable; | | friend class Serializable; | |
| typedef void *anno_list_t; | | typedef void *anno_list_t; | |
| | | | |
| /** | | /** | |
| * Inheriting from this class adds a pointer to each object. Multiple | | * Inheriting from this class adds a pointer to each object. Multiple | |
| * types of annotations are stored under this pointer in a | | * types of annotations are stored under this pointer in a | |
| * annotation_type -> anno_list_t map. | | * annotation_type -> anno_list_t map. | |
| | | | |
| skipping to change at line 225 | | skipping to change at line 215 | |
| AnnotationClassID max; | | AnnotationClassID max; | |
| unsigned short serializer_index; | | unsigned short serializer_index; | |
| }; | | }; | |
| | | | |
| aInfo *annotations; | | aInfo *annotations; | |
| | | | |
| // private version of addAnnotation exists for deserialize functi
ons | | // private version of addAnnotation exists for deserialize functi
ons | |
| // to reconstruct annotations without explicit type info -- don't
use in | | // to reconstruct annotations without explicit type info -- don't
use in | |
| // other contexts | | // other contexts | |
| | | | |
|
| COMMON_EXPORT bool addAnnotation(const void *a, AnnotationClassID id) | | bool addAnnotation(const void *a, AnnotationClassID id) | |
| { | | { | |
| if (annotation_debug_flag()) | | if (annotation_debug_flag()) | |
| { | | { | |
| fprintf(stderr, "%s[%d]: Dense(%p) add %s-%d\n",
FILE__, __LINE__, this, | | fprintf(stderr, "%s[%d]: Dense(%p) add %s-%d\n",
FILE__, __LINE__, this, | |
| AnnotationClassBase::findAnnotatio
nClass(id) | | AnnotationClassBase::findAnnotatio
nClass(id) | |
| ? AnnotationClassBase::findAnnotat
ionClass(id)->getName().c_str() | | ? AnnotationClassBase::findAnnotat
ionClass(id)->getName().c_str() | |
| : "bad_anno_id", id); | | : "bad_anno_id", id); | |
| } | | } | |
| | | | |
| unsigned size = id + 1; | | unsigned size = id + 1; | |
| | | | |
| skipping to change at line 268 | | skipping to change at line 258 | |
| annotations->data = (anno_list_t *) realloc(annotat
ions->data, sizeof(anno_list_t *) * size); | | annotations->data = (anno_list_t *) realloc(annotat
ions->data, sizeof(anno_list_t *) * size); | |
| for (unsigned i=old_max; i<size; i++) | | for (unsigned i=old_max; i<size; i++) | |
| annotations->data[i] = NULL; | | annotations->data[i] = NULL; | |
| } | | } | |
| | | | |
| annotations->data[id] = const_cast<void *>(a); | | annotations->data[id] = const_cast<void *>(a); | |
| | | | |
| return true; | | return true; | |
| } | | } | |
| public: | | public: | |
|
| COMMON_EXPORT AnnotatableDense() : annotations(NULL) | | AnnotatableDense() : annotations(NULL) | |
| { | | { | |
| } | | } | |
| | | | |
|
| COMMON_EXPORT ~AnnotatableDense() | | ~AnnotatableDense() | |
| { | | { | |
| if (annotations) | | if (annotations) | |
| { | | { | |
| if (annotations->data) | | if (annotations->data) | |
| free(annotations->data); | | free(annotations->data); | |
| free(annotations); | | free(annotations); | |
| } | | } | |
| } | | } | |
| | | | |
| template<class T> | | template<class T> | |
| | | | |
| skipping to change at line 300 | | skipping to change at line 290 | |
| | | | |
| int id = a_id.getID(); | | int id = a_id.getID(); | |
| T *a_noconst = const_cast<T *>(a); | | T *a_noconst = const_cast<T *>(a); | |
| bool ret = addAnnotation((void *)a_noconst, id); | | bool ret = addAnnotation((void *)a_noconst, id); | |
| if (!ret) | | if (!ret) | |
| { | | { | |
| fprintf(stderr, "%s[%d]: failed to add annotation\
n", FILE__, __LINE__); | | fprintf(stderr, "%s[%d]: failed to add annotation\
n", FILE__, __LINE__); | |
| return ret; | | return ret; | |
| } | | } | |
| | | | |
|
| | | #if !defined(SERIALIZATION_DISABLED) | |
| // If serialization is not enabled, there will be no seria
lizer specified, | | // If serialization is not enabled, there will be no seria
lizer specified, | |
| // so none of the below code will be executed. | | // so none of the below code will be executed. | |
| | | | |
| serialize_printf("%s[%d]: %p addAnnotation: serializer_in
dex = %d\n", | | serialize_printf("%s[%d]: %p addAnnotation: serializer_in
dex = %d\n", | |
| FILE__, __LINE__, this, annotations->serial
izer_index); | | FILE__, __LINE__, this, annotations->serial
izer_index); | |
| | | | |
| if (annotations && ( (unsigned short) -1 != annotations->se
rializer_index)) | | if (annotations && ( (unsigned short) -1 != annotations->se
rializer_index)) | |
| { | | { | |
| SerializerBase *sb = getExistingOutputSB(annotation
s->serializer_index); | | SerializerBase *sb = getExistingOutputSB(annotation
s->serializer_index); | |
| if (!sb) | | if (!sb) | |
| | | | |
| skipping to change at line 326 | | skipping to change at line 317 | |
| if (sf) | | if (sf) | |
| { | | { | |
| // FIXME: for xml support, ser_operation
should have a corresponding | | // FIXME: for xml support, ser_operation
should have a corresponding | |
| // "ser_operation_end()" routine to close
out the xml field. | | // "ser_operation_end()" routine to close
out the xml field. | |
| ser_post_op_t op = sp_add_anno; | | ser_post_op_t op = sp_add_anno; | |
| ser_operation(sb, op, "AnnotationAdd"); | | ser_operation(sb, op, "AnnotationAdd"); | |
| void * aa = (void *) const_cast<T *>(a); | | void * aa = (void *) const_cast<T *>(a); | |
| serialize_post_annotation(this, aa, sb, &a_
id, dense, "PostAnnotation"); | | serialize_post_annotation(this, aa, sb, &a_
id, dense, "PostAnnotation"); | |
| } | | } | |
| } | | } | |
|
| | | #endif | |
| | | | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| template<class T> | | template<class T> | |
| inline bool getAnnotation(T *&a, AnnotationClass<T> &a_id) const | | inline bool getAnnotation(T *&a, AnnotationClass<T> &a_id) const | |
| { | | { | |
| if (!annotations) | | if (!annotations) | |
| return false; | | return false; | |
| | | | |
| | | | |
| skipping to change at line 374 | | skipping to change at line 366 | |
| } | | } | |
| | | | |
| if (!annotations->data[id]) | | if (!annotations->data[id]) | |
| return false; | | return false; | |
| | | | |
| annotations->data[id] = NULL; | | annotations->data[id] = NULL; | |
| | | | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| COMMON_EXPORT void serializeAnnotations(SerializerBase *sb, const | | #if !defined(SERIALIZATION_DISABLED) | |
| char *tag) | | void serializeAnnotations(SerializerBase *sb, const char *tag) | |
| { | | { | |
| serialize_printf("%s[%d]: welcome to serializeAnotations:
\n", FILE__, __LINE__); | | serialize_printf("%s[%d]: welcome to serializeAnotations:
\n", FILE__, __LINE__); | |
| // iterator over possible annotation types | | // iterator over possible annotation types | |
| // if we have any, lookup the serialization function and
call it | | // if we have any, lookup the serialization function and
call it | |
| | | | |
| std::vector<ser_rec_t> my_sers; | | std::vector<ser_rec_t> my_sers; | |
| if (is_output(sb)) | | if (is_output(sb)) | |
| { | | { | |
| // need to figure out how many annotations will b
e serialized apriori | | // need to figure out how many annotations will b
e serialized apriori | |
| // so we can output the size of the list as a hea
der. | | // so we can output the size of the list as a hea
der. | |
| | | | |
| skipping to change at line 446 | | skipping to change at line 439 | |
| { | | { | |
| fprintf(stderr, "%s[%d]: FIXME: failed to serial
ize annotation list\n", | | fprintf(stderr, "%s[%d]: FIXME: failed to serial
ize annotation list\n", | |
| FILE__, __LINE__); | | FILE__, __LINE__); | |
| } | | } | |
| if (!add_annotations(sb, this, my_sers)) | | if (!add_annotations(sb, this, my_sers)) | |
| { | | { | |
| fprintf(stderr, "%s[%d]: failed to update annotat
ion list after deserialize\n", | | fprintf(stderr, "%s[%d]: failed to update annotat
ion list after deserialize\n", | |
| FILE__, __LINE__); | | FILE__, __LINE__); | |
| } | | } | |
| } | | } | |
|
| | | #else | |
| COMMON_EXPORT void annotationsReport() | | void serializeAnnotations(SerializerBase *, const char *) { | |
| | | } | |
| | | #endif | |
| | | void annotationsReport() | |
| { | | { | |
| std::vector<AnnotationClassBase *> atypes; | | std::vector<AnnotationClassBase *> atypes; | |
| if (annotations && annotations->data) | | if (annotations && annotations->data) | |
| { | | { | |
| for (unsigned int i = 0; i < annotations->max; ++i
) | | for (unsigned int i = 0; i < annotations->max; ++i
) | |
| { | | { | |
| if (NULL != annotations->data[i]) | | if (NULL != annotations->data[i]) | |
| { | | { | |
| AnnotationClassBase *acb = Annotat
ionClassBase::findAnnotationClass(i); | | AnnotationClassBase *acb = Annotat
ionClassBase::findAnnotationClass(i); | |
| if (!acb) | | if (!acb) | |
| | | | |
| skipping to change at line 483 | | skipping to change at line 479 | |
| fprintf(stderr, "\t%s-%d, %s\n", atypes[i]
->getName().c_str(), | | fprintf(stderr, "\t%s-%d, %s\n", atypes[i]
->getName().c_str(), | |
| atypes[i]->getID(), atypes
[i]->getTypeName()); | | atypes[i]->getID(), atypes
[i]->getTypeName()); | |
| } | | } | |
| } | | } | |
| } | | } | |
| }; | | }; | |
| | | | |
| #define NON_STATIC_SPARSE_MAP 1 | | #define NON_STATIC_SPARSE_MAP 1 | |
| #define AN_INLINE inline | | #define AN_INLINE inline | |
| | | | |
|
| class AnnotatableSparse | | class COMMON_EXPORT AnnotatableSparse | |
| { | | { | |
| friend class SerializerBase; | | friend class SerializerBase; | |
| friend class Serializable; | | friend class Serializable; | |
| friend COMMON_EXPORT bool add_annotations(SerializerBase *, | | friend COMMON_EXPORT bool add_annotations(SerializerBase *, | |
| AnnotatableSparse *, std::vector<ser_rec_t> &); | | AnnotatableSparse *, std::vector<ser_rec_t> &); | |
| | | | |
| public: | | public: | |
| struct void_ptr_hasher | | struct void_ptr_hasher | |
| { | | { | |
| size_t operator()(const void* a) const | | size_t operator()(const void* a) const | |
| { | | { | |
| return (size_t) a; | | return (size_t) a; | |
| } | | } | |
| }; | | }; | |
| | | | |
| #if defined (_MSC_VER) | | #if defined (_MSC_VER) | |
| typedef dyn_hash_map<void *, void *> annos_by_type_t; | | typedef dyn_hash_map<void *, void *> annos_by_type_t; | |
|
| | | #pragma warning (push) | |
| | | #pragma warning (disable:4251) | |
| #else | | #else | |
| typedef dyn_hash_map<void *, void *, void_ptr_hasher> annos_by_type_t
; | | typedef dyn_hash_map<void *, void *, void_ptr_hasher> annos_by_type_t
; | |
| #endif | | #endif | |
| | | | |
| typedef std::vector<annos_by_type_t *> annos_t; | | typedef std::vector<annos_by_type_t *> annos_t; | |
| | | | |
|
| COMMON_EXPORT ~AnnotatableSparse() | | ~AnnotatableSparse() | |
| { | | { | |
| // We need to remove annotations from the static map when
objects | | // We need to remove annotations from the static map when
objects | |
| // are destroyed: (1) memory may be reclaimed and reuse
d at the same | | // are destroyed: (1) memory may be reclaimed and reuse
d at the same | |
| // place, and (2) regardless of 1, the map can possibly e
xplode to | | // place, and (2) regardless of 1, the map can possibly e
xplode to | |
| // unmanageable sizes, with a lot of unused junk in it if
a lot of i | | // unmanageable sizes, with a lot of unused junk in it if
a lot of i | |
| // annotatable objects are created and destroyed. | | // annotatable objects are created and destroyed. | |
| | | | |
| // Alas this is kinda expensive right now, but the data s
tructure is | | // Alas this is kinda expensive right now, but the data s
tructure is | |
| // set up to minimize search time, not deletion time. It
could | | // set up to minimize search time, not deletion time. It
could | |
| // be changed if this becomes a significant time drain. | | // be changed if this becomes a significant time drain. | |
| | | | |
| skipping to change at line 553 | | skipping to change at line 551 | |
| fprintf(stderr, "%s[%d]: FIXME:
REMOVE FAILED\n", FILE__, __LINE__); | | fprintf(stderr, "%s[%d]: FIXME:
REMOVE FAILED\n", FILE__, __LINE__); | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
| private: | | private: | |
| | | | |
| #if defined (NON_STATIC_SPARSE_MAP) | | #if defined (NON_STATIC_SPARSE_MAP) | |
| //COMMON_EXPORT static annos_t *annos; | | //COMMON_EXPORT static annos_t *annos; | |
| #else | | #else | |
|
| COMMON_EXPORT static annos_t annos; | | static annos_t annos; | |
| #endif | | #endif | |
|
| COMMON_EXPORT annos_t *getAnnos() const; | | annos_t *getAnnos() const; | |
| COMMON_EXPORT static dyn_hash_map<void *, unsigned short> ser_ndx_ | | static dyn_hash_map<void *, unsigned short> ser_ndx_map; | |
| map; | | | |
| | | | |
|
| COMMON_EXPORT annos_by_type_t *getAnnosOfType(AnnotationClassID aid,
bool do_create =false) const | | annos_by_type_t *getAnnosOfType(AnnotationClassID aid, bool do_create
=false) const | |
| { | | { | |
| annos_t &l_annos = *getAnnos(); | | annos_t &l_annos = *getAnnos(); | |
| long nelems_to_create = aid - l_annos.size() + 1; | | long nelems_to_create = aid - l_annos.size() + 1; | |
| | | | |
| if (nelems_to_create > 0) | | if (nelems_to_create > 0) | |
| { | | { | |
| if (!do_create) | | if (!do_create) | |
| { | | { | |
| return NULL; | | return NULL; | |
| } | | } | |
| | | | |
| skipping to change at line 591 | | skipping to change at line 589 | |
| } | | } | |
| | | | |
| template <class T> | | template <class T> | |
| AN_INLINE annos_by_type_t *getAnnosOfType(AnnotationClass<T> &a_id, b
ool do_create =false) const | | AN_INLINE annos_by_type_t *getAnnosOfType(AnnotationClass<T> &a_id, b
ool do_create =false) const | |
| { | | { | |
| AnnotationClassID aid = a_id.getID(); | | AnnotationClassID aid = a_id.getID(); | |
| | | | |
| return getAnnosOfType(aid, do_create); | | return getAnnosOfType(aid, do_create); | |
| } | | } | |
| | | | |
|
| COMMON_EXPORT void *getAnnosForObject(annos_by_type_t *abt, | | void *getAnnosForObject(annos_by_type_t *abt, | |
| void *obj, bool do_create = false) const | | void *obj, bool do_create = false) const | |
| { | | { | |
| assert(abt); | | assert(abt); | |
| assert(obj); | | assert(obj); | |
| | | | |
| void *target = NULL; | | void *target = NULL; | |
| | | | |
| annos_by_type_t::iterator iter = abt->find(obj); | | annos_by_type_t::iterator iter = abt->find(obj); | |
| | | | |
| if (iter == abt->end()) | | if (iter == abt->end()) | |
| | | | |
| skipping to change at line 620 | | skipping to change at line 618 | |
| else | | else | |
| { | | { | |
| target = iter->second; | | target = iter->second; | |
| } | | } | |
| | | | |
| return target; | | return target; | |
| } | | } | |
| | | | |
| // private version of addAnnotation used by deserialize function
to restore | | // private version of addAnnotation used by deserialize function
to restore | |
| // annotation set without explicitly specifying types | | // annotation set without explicitly specifying types | |
|
| COMMON_EXPORT AN_INLINE bool addAnnotation(const void *a, Annotati
onClassID aid) | | AN_INLINE bool addAnnotation(const void *a, AnnotationClassID aid) | |
| { | | { | |
| if (annotation_debug_flag()) | | if (annotation_debug_flag()) | |
| { | | { | |
| fprintf(stderr, "%s[%d]: Sparse(%p) add %s-%d voi
d\n", FILE__, __LINE__, this, | | fprintf(stderr, "%s[%d]: Sparse(%p) add %s-%d voi
d\n", FILE__, __LINE__, this, | |
| AnnotationClassBase::findAnnotatio
nClass(aid) | | AnnotationClassBase::findAnnotatio
nClass(aid) | |
| ? AnnotationClassBase::findAnnotat
ionClass(aid)->getName().c_str() | | ? AnnotationClassBase::findAnnotat
ionClass(aid)->getName().c_str() | |
| : "bad_anno_id", aid); | | : "bad_anno_id", aid); | |
| } | | } | |
| | | | |
| void *obj = this; | | void *obj = this; | |
| | | | |
| skipping to change at line 664 | | skipping to change at line 662 | |
| } | | } | |
| | | | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| public: | | public: | |
| | | | |
|
| COMMON_EXPORT bool operator==(AnnotatableSparse &cmp) | | bool operator==(AnnotatableSparse &cmp) | |
| { | | { | |
| annos_t &l_annos = *getAnnos(); | | annos_t &l_annos = *getAnnos(); | |
| unsigned this_ntypes = l_annos.size(); | | unsigned this_ntypes = l_annos.size(); | |
| unsigned cmp_ntypes = cmp.getAnnos()->size(); | | unsigned cmp_ntypes = cmp.getAnnos()->size(); | |
| unsigned ntypes = (cmp_ntypes > this_ntypes) ? cmp_ntypes : this_n
types; | | unsigned ntypes = (cmp_ntypes > this_ntypes) ? cmp_ntypes : this_n
types; | |
| | | | |
| for (unsigned int i = 0; i < ntypes; ++i) | | for (unsigned int i = 0; i < ntypes; ++i) | |
| { | | { | |
| if ((i >= cmp_ntypes) || (i >= this_ntypes)) | | if ((i >= cmp_ntypes) || (i >= this_ntypes)) | |
| { | | { | |
| | | | |
| skipping to change at line 722 | | skipping to change at line 720 | |
| if ( (cmp_abt_iter == cmp_abt->end()) | | if ( (cmp_abt_iter == cmp_abt->end()) | |
| && (this_abt_iter != this_abt->end())) | | && (this_abt_iter != this_abt->end())) | |
| { | | { | |
| return false; | | return false; | |
| } | | } | |
| | | | |
| AnnotationClassBase *acb = AnnotationClassBase::findAnnotationC
lass(i); | | AnnotationClassBase *acb = AnnotationClassBase::findAnnotationC
lass(i); | |
| | | | |
| if (!acb) | | if (!acb) | |
| { | | { | |
|
| serialize_printf("%s[%d]: cannot find annotation class for | | | |
| id %d\n", | | | |
| FILE__, __LINE__, i); | | | |
| return false; | | return false; | |
| } | | } | |
| | | | |
| // both have annotation -- do the compare | | // both have annotation -- do the compare | |
| anno_cmp_func_t cmpfunc = acb->getCmpFunc(); | | anno_cmp_func_t cmpfunc = acb->getCmpFunc(); | |
| | | | |
| if (!cmpfunc) | | if (!cmpfunc) | |
| { | | { | |
| // even if not explicitly specified, a default pointer-comp
are | | // even if not explicitly specified, a default pointer-comp
are | |
| // function should be returned here. | | // function should be returned here. | |
| | | | |
| skipping to change at line 785 | | skipping to change at line 781 | |
| | | | |
| if (iter->second != a) | | if (iter->second != a) | |
| { | | { | |
| //fprintf(stderr, "%s[%d]: WEIRD:
already have annotation of type %s: %p, replacing with %p\n", FILE__, __LIN
E__, a_id.getName().c_str(), iter->second, a); | | //fprintf(stderr, "%s[%d]: WEIRD:
already have annotation of type %s: %p, replacing with %p\n", FILE__, __LIN
E__, a_id.getName().c_str(), iter->second, a); | |
| iter->second = (void *)const_cast<T
*>(a); | | iter->second = (void *)const_cast<T
*>(a); | |
| } | | } | |
| | | | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | #if !defined(SERIALIZATION_DISABLED) | |
| dyn_hash_map<void *, unsigned short>::iterator serit
er; | | dyn_hash_map<void *, unsigned short>::iterator serit
er; | |
| seriter = ser_ndx_map.find(this); | | seriter = ser_ndx_map.find(this); | |
| if (seriter != ser_ndx_map.end()) | | if (seriter != ser_ndx_map.end()) | |
| { | | { | |
| if (seriter->second != (unsigned short) -1) | | if (seriter->second != (unsigned short) -1) | |
| { | | { | |
| SerializerBase *sb = getExistingOutp
utSB(seriter->second); | | SerializerBase *sb = getExistingOutp
utSB(seriter->second); | |
| if (!sb) | | if (!sb) | |
| { | | { | |
| fprintf(stderr, "%s[%d]: FI
XME: no existing output SB\n", | | fprintf(stderr, "%s[%d]: FI
XME: no existing output SB\n", | |
| | | | |
| skipping to change at line 809 | | skipping to change at line 806 | |
| ser_func_t sf = a_id.getSerializeFun
c(); | | ser_func_t sf = a_id.getSerializeFun
c(); | |
| if (sf) | | if (sf) | |
| { | | { | |
| ser_post_op_t op = sp_add_an
no; | | ser_post_op_t op = sp_add_an
no; | |
| ser_operation(sb, op, "Annot
ationAdd"); | | ser_operation(sb, op, "Annot
ationAdd"); | |
| void *aa = (void *) const_ca
st<T *>(a); | | void *aa = (void *) const_ca
st<T *>(a); | |
| serialize_post_annotation(th
is, aa, sb, &a_id, sparse, "PostAnnotation"); | | serialize_post_annotation(th
is, aa, sb, &a_id, sparse, "PostAnnotation"); | |
| } | | } | |
| } | | } | |
| } | | } | |
|
| | | #endif | |
| | | | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| template<class T> | | template<class T> | |
| AN_INLINE bool getAnnotation(T *&a, AnnotationClass<T> &a_id) const | | AN_INLINE bool getAnnotation(T *&a, AnnotationClass<T> &a_id) const | |
| { | | { | |
| a = NULL; | | a = NULL; | |
| | | | |
| annos_by_type_t *abt = getAnnosOfType(a_id, false /*don't create i
f none*/); | | annos_by_type_t *abt = getAnnosOfType(a_id, false /*don't create i
f none*/); | |
| | | | |
| skipping to change at line 865 | | skipping to change at line 863 | |
| return false; | | return false; | |
| } | | } | |
| else | | else | |
| { | | { | |
| abt->erase(iter); | | abt->erase(iter); | |
| return true; | | return true; | |
| } | | } | |
| return false; | | return false; | |
| } | | } | |
| | | | |
|
| COMMON_EXPORT void serializeAnnotations(SerializerBase *sb, const
char *tag) | | void serializeAnnotations(SerializerBase *sb, const char *) | |
| { | | { | |
| annos_t &l_annos = *getAnnos(); | | annos_t &l_annos = *getAnnos(); | |
| std::vector<ser_rec_t> my_sers; | | std::vector<ser_rec_t> my_sers; | |
| void *obj = this; | | void *obj = this; | |
| if (is_output(sb)) | | if (is_output(sb)) | |
| { | | { | |
| for (AnnotationClassID id = 0; id < l_annos.
size(); ++id) | | for (AnnotationClassID id = 0; id < l_annos.
size(); ++id) | |
| { | | { | |
| annos_by_type_t *abt = getAnnosOfTyp
e(id, false /*don't do create */); | | annos_by_type_t *abt = getAnnosOfTyp
e(id, false /*don't do create */); | |
| if (NULL == abt) continue; | | if (NULL == abt) continue; | |
| | | | |
| skipping to change at line 899 | | skipping to change at line 897 | |
| if (!acb) | | if (!acb) | |
| { | | { | |
| fprintf(stderr, "%s[%d]: FI
XME, cannot find annotation class base for id %d, mode = %s\n", FILE__, __L
INE__, id, is_input(sb) ? "deserialize" : "serialize"); | | fprintf(stderr, "%s[%d]: FI
XME, cannot find annotation class base for id %d, mode = %s\n", FILE__, __L
INE__, id, is_input(sb) ? "deserialize" : "serialize"); | |
| continue; | | continue; | |
| } | | } | |
| | | | |
| ser_func_t sf = acb->getSerializeFun
c(); | | ser_func_t sf = acb->getSerializeFun
c(); | |
| | | | |
| if (NULL == sf) | | if (NULL == sf) | |
| { | | { | |
|
| serialize_printf("%s[%d]: n
o serialization function for this anno: type: %s, name: %s\n", FILE__, __LI
NE__, acb->getTypeName(), acb->getName().c_str()); | | | |
| continue; | | continue; | |
| } | | } | |
| | | | |
| ser_rec_t sr; | | ser_rec_t sr; | |
| sr.acb = acb; | | sr.acb = acb; | |
| sr.data = iter->second; | | sr.data = iter->second; | |
| sr.parent_id = (void *) this; | | sr.parent_id = (void *) this; | |
| sr.sod = sparse; | | sr.sod = sparse; | |
| my_sers.push_back(sr); | | my_sers.push_back(sr); | |
| } | | } | |
| | | | |
|
| if (my_sers.size()) | | ser_ndx_map[this] = get_serializer_i | |
| serialize_printf("%s[%d]: found %lu | | ndex(sb); | |
| req'd serializations for obj %p\n", | | | |
| FILE__, __LINE__, my | | | |
| _sers.size(), this); | | | |
| | | | |
| ser_ndx_map[this] = get_serializer_index(sb) | | | |
| ; | | | |
| } | | } | |
| | | | |
|
| | | #if !defined(SERIALIZATION_DISABLED) | |
| if (!serialize_annotation_list(this, my_sers, sb, ta
g)) | | if (!serialize_annotation_list(this, my_sers, sb, ta
g)) | |
| { | | { | |
| fprintf(stderr, "%s[%d]: FIXME: failed to
serialize annotation list\n", | | fprintf(stderr, "%s[%d]: FIXME: failed to
serialize annotation list\n", | |
| FILE__, __LINE__); | | FILE__, __LINE__); | |
| } | | } | |
|
| | | #endif | |
| | | | |
| if (!add_annotations(sb, this, my_sers)) | | if (!add_annotations(sb, this, my_sers)) | |
| { | | { | |
| fprintf(stderr, "%s[%d]: failed to update a
nnotation list after deserialize\n", | | fprintf(stderr, "%s[%d]: failed to update a
nnotation list after deserialize\n", | |
| FILE__, __LINE__); | | FILE__, __LINE__); | |
| } | | } | |
| } | | } | |
| | | | |
|
| COMMON_EXPORT void annotationsReport() | | void annotationsReport() | |
| { | | { | |
| std::vector<AnnotationClassBase *> atypes; | | std::vector<AnnotationClassBase *> atypes; | |
| annos_t &l_annos = *getAnnos(); | | annos_t &l_annos = *getAnnos(); | |
| | | | |
| for (AnnotationClassID id = 0; id < l_annos.size(); ++id) | | for (AnnotationClassID id = 0; id < l_annos.size(); ++id) | |
| { | | { | |
| annos_by_type_t *abt = getAnnosOfType(id, false /*
don't do create */); | | annos_by_type_t *abt = getAnnosOfType(id, false /*
don't do create */); | |
| if (NULL == abt) continue; | | if (NULL == abt) continue; | |
| | | | |
| annos_by_type_t::iterator iter = abt->find(this); | | annos_by_type_t::iterator iter = abt->find(this); | |
| | | | |
| skipping to change at line 972 | | skipping to change at line 967 | |
| { | | { | |
| fprintf(stderr, "\t%s-%d, %s\n", atypes[i]->getNam
e().c_str(), | | fprintf(stderr, "\t%s-%d, %s\n", atypes[i]->getNam
e().c_str(), | |
| atypes[i]->getID(), atypes[i]->get
TypeName()); | | atypes[i]->getID(), atypes[i]->get
TypeName()); | |
| } | | } | |
| } | | } | |
| | | | |
| }; | | }; | |
| | | | |
| } // namespace | | } // namespace | |
| | | | |
|
| | | #ifdef _MSC_VER | |
| | | #pragma warning(pop) | |
| | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 43 change blocks. |
| 76 lines changed or deleted | | 64 lines changed or added | |
|
| BPatch.h | | BPatch.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 38 | | 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_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_thread.h" | | #include "BPatch_thread.h" | |
| #include "BPatch_type.h" | | #include "BPatch_type.h" | |
| #include "BPatch_eventLock.h" | | #include "BPatch_eventLock.h" | |
| #include "BPatch_process.h" | | #include "BPatch_process.h" | |
|
| #include "BPatch_hybridAnalysis.h" | | #include "BPatch_enums.h" | |
| | | #include "BPatch_callbacks.h" | |
| | | | |
| class BPatch_typeCollection; | | class BPatch_typeCollection; | |
| class BPatch_libInfo; | | class BPatch_libInfo; | |
| class BPatch_module; | | class BPatch_module; | |
|
| class int_function; | | class PCProcess; | |
| class process; | | class PCThread; | |
| | | class PCEventHandler; | |
| | | 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_MAJOR 7 | | #define DYNINST_MAJOR 7 | |
| #define DYNINST_MINOR 0 | | #define DYNINST_MINOR 0 | |
| #define DYNINST_SUBMINOR 0 | | #define DYNINST_SUBMINOR 0 | |
| | | | |
| #ifdef IBM_BPATCH_COMPAT | | #ifdef IBM_BPATCH_COMPAT | |
| typedef void *BPatch_Address; | | typedef void *BPatch_Address; | |
| #endif | | #endif | |
| | | | |
|
| | | #ifdef _MSC_VER | |
| | | #pragma warning(push) | |
| | | #pragma warning(disable:4251) | |
| | | #endif | |
| | | | |
| // BPatch_stats is a collection of instrumentation statistics. | | // BPatch_stats is a collection of instrumentation statistics. | |
| // Introduced to export this information to paradyn, which | | // Introduced to export this information to paradyn, which | |
| // produces a summary of these numbers upon application exit. | | // produces a summary of these numbers upon application exit. | |
| // It probably makes more sense to maintain such numbers on a | | // It probably makes more sense to maintain such numbers on a | |
| // per-process basis. But is set up globally due to historical | | // per-process basis. But is set up globally due to historical | |
| // precendent. | | // precendent. | |
| | | | |
| typedef struct { | | typedef struct { | |
| unsigned int pointsUsed; | | unsigned int pointsUsed; | |
| unsigned int totalMiniTramps; | | unsigned int totalMiniTramps; | |
| | | | |
| skipping to change at line 107 | | skipping to change at line 115 | |
| 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; | |
| // -------------------------------------------------------------------- | | // -------------------------------------------------------------------- | |
| | | | |
|
| class EventRecord; | | | |
| | | | |
| #ifdef DYNINST_CLASS_NAME | | #ifdef DYNINST_CLASS_NAME | |
| #undef DYNINST_CLASS_NAME | | #undef DYNINST_CLASS_NAME | |
| #endif | | #endif | |
| #define DYNINST_CLASS_NAME BPatch | | #define DYNINST_CLASS_NAME BPatch | |
| class BPATCH_DLL_EXPORT BPatch : public BPatch_eventLock { | | 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 process; | | friend class PCProcess; | |
| friend class int_function; | | friend class func_instance; | |
| friend class SignalHandler; | | | |
| friend class BPatch_asyncEventHandler; | | | |
| friend bool handleSigStopNInt(EventRecord &ev); | | | |
| | | | |
| 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 */ | |
| | | | |
| skipping to change at line 174 | | skipping to change at line 177 | |
| void updateStats(); | | void updateStats(); | |
| | | | |
| /* this is used to denote the fully qualified name of the prelink co
mmand on linux */ | | /* this is used to denote the fully qualified name of the prelink co
mmand on linux */ | |
| char *systemPrelinkCommand; | | char *systemPrelinkCommand; | |
| | | | |
| // Wrapper - start process running if it was not deleted. | | // Wrapper - start process running if it was not deleted. | |
| // We use this at the end of callbacks to user code, since those | | // We use this at the end of callbacks to user code, since those | |
| // callbacks may delete BPatch objects. | | // callbacks may delete BPatch objects. | |
| void continueIfExists(int pid); | | void continueIfExists(int pid); | |
| | | | |
|
| /* flag that is set when a mutatee's runnning status changes, | | | |
| for use with pollForStatusChange */ | | | |
| bool mutateeStatusChange; | | | |
| bool waitingForStatusChange; | | | |
| | | | |
| /* Internal notification file descriptor - a pipe */ | | /* Internal notification file descriptor - a pipe */ | |
| int notificationFDOutput_; | | int notificationFDOutput_; | |
| int notificationFDInput_; | | int notificationFDInput_; | |
| // Easier than non-blocking reads... there is either 1 byte in the pipe
or 0. | | // Easier than non-blocking reads... there is either 1 byte in the pipe
or 0. | |
| bool FDneedsPolling_; | | bool FDneedsPolling_; | |
|
| | | | |
| | | // Callbacks // | |
| | | BPatchErrorCallback errorCallback; | |
| | | BPatchForkCallback preForkCallback; | |
| | | BPatchForkCallback postForkCallback; | |
| | | BPatchExecCallback execCallback; | |
| | | BPatchExitCallback exitCallback; | |
| | | BPatchOneTimeCodeCallback oneTimeCodeCallback; | |
| | | BPatchDynLibraryCallback dynLibraryCallback; | |
| | | BPatchAsyncThreadEventCallback threadCreateCallback; | |
| | | BPatchAsyncThreadEventCallback threadDestroyCallback; | |
| | | BPatchDynamicCallSiteCallback dynamicCallSiteCallback; | |
| | | InternalSignalHandlerCallback signalHandlerCallback; | |
| | | BPatch_Set<long> *callbackSignals; | |
| | | InternalCodeOverwriteCallback codeOverwriteCallback; | |
| | | | |
| | | BPatch_Vector<BPatchUserEventCallback> userEventCallbacks; | |
| | | BPatch_Vector<BPatchStopThreadCallback> stopThreadCallbacks; | |
| | | | |
| public: | | public: | |
|
| | | | |
| /* And auxiliary functions for the above */ | | /* And auxiliary functions for the above */ | |
| /* These are NOT part of the API, do not use externally */ | | /* These are NOT part of the API, do not use externally */ | |
| void signalNotificationFD(); // Called when an event happens | | void signalNotificationFD(); // Called when an event happens | |
| void clearNotificationFD(); // Called during poll/waitForStatusChange | | void clearNotificationFD(); // Called during poll/waitForStatusChange | |
| void createNotificationFD(); // Creates the FD | | 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; | |
| | | | |
| // The following are only to be called by the library: | | // The following are only to be called by the library: | |
| // These functions are not locked. | | // These functions are not locked. | |
| void registerProvisionalThread(int pid); | | void registerProvisionalThread(int pid); | |
|
| void registerForkedProcess(process *parentProc, process *childProc); | | void registerForkedProcess(PCProcess *parentProc, PCProcess *childProc) | |
| void registerForkingProcess(int forkingPid, process *proc); | | ; | |
| | | void registerForkingProcess(int forkingPid, PCProcess *proc); | |
| | | | |
|
| void registerExecExit(process *proc); | | void registerExecExit(PCProcess *proc); | |
| void registerExecCleanup(process *proc, char *arg0); | | void registerExecCleanup(PCProcess *proc, char *arg0); | |
| | | | |
|
| void registerNormalExit(process *proc, int exitcode); | | void registerNormalExit(PCProcess *proc, int exitcode); | |
| void registerSignalExit(process *proc, int signalnum); | | void registerSignalExit(PCProcess *proc, int signalnum); | |
| | | | |
|
| void registerThreadExit(process *proc, long tid, bool exiting); | | void registerThreadExit(PCProcess *llproc, PCThread *llthread); | |
| bool registerThreadCreate(BPatch_process *proc, BPatch_thread *newthr); | | bool registerThreadCreate(BPatch_process *proc, BPatch_thread *newthr); | |
| | | | |
| void registerProcess(BPatch_process *process, int pid=0); | | void registerProcess(BPatch_process *process, int pid=0); | |
| void unRegisterProcess(int pid, BPatch_process *proc); | | void unRegisterProcess(int pid, BPatch_process *proc); | |
| | | | |
|
| void launchDeferredOneTimeCode(); | | void registerUserEvent(BPatch_process *process, void *buffer, | |
| | | unsigned int bufsize); | |
| | | | |
| | | void registerDynamicCallsiteEvent(BPatch_process *process, Dyninst::Add | |
| | | ress callTarget, | |
| | | Dyninst::Address callAddr); | |
| | | | |
|
| void registerLoadedModule(process *process, mapped_module *mod); | | void registerStopThreadCallback(BPatchStopThreadCallback stopCB); | |
| void registerUnloadedModule(process *process, mapped_module *mod); | | int getStopThreadCallbackID(BPatchStopThreadCallback stopCB); | |
| | | | |
| | | void registerLoadedModule(PCProcess *process, mapped_module *mod); | |
| | | void registerUnloadedModule(PCProcess *process, mapped_module *mod); | |
| | | | |
| BPatch_thread *getThreadByPid(int pid, bool *exists = NULL); | | BPatch_thread *getThreadByPid(int pid, bool *exists = NULL); | |
| BPatch_process *getProcessByPid(int pid, bool *exists = NULL); | | BPatch_process *getProcessByPid(int pid, bool *exists = NULL); | |
| | | | |
| static void reportError(BPatchErrorLevel severity, int number, const ch
ar *str); | | static void reportError(BPatchErrorLevel severity, int number, const ch
ar *str); | |
| | | | |
| 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 | |
| | | | |
| | | | |
| skipping to change at line 668 | | skipping to change at line 693 | |
| | | | |
| API_EXPORT(Int, (remote), | | API_EXPORT(Int, (remote), | |
| bool, remoteDisconnect, (BPatch_remoteHost &remote)); | | 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), | | API_EXPORT_V(Int, (name), | |
| void, addNonReturningFunc, (std::string name)); | | void, addNonReturningFunc, (std::string name)); | |
| }; | | }; | |
| | | | |
|
| | | #ifdef _MSC_VER | |
| | | #pragma warning(pop) | |
| | | #endif | |
| | | | |
| #endif /* _BPatch_h_ */ | | #endif /* _BPatch_h_ */ | |
| | | | |
End of changes. 18 change blocks. |
| 32 lines changed or deleted | | 63 lines changed or added | |
|
| BPatch_addressSpace.h | | BPatch_addressSpace.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 34 | |
| * 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 | |
| */ | | */ | |
| | | | |
| #ifndef _BPatch_addressSpace_h_ | | #ifndef _BPatch_addressSpace_h_ | |
| #define _BPatch_addressSpace_h_ | | #define _BPatch_addressSpace_h_ | |
| | | | |
|
| #include "BPatch_snippet.h" | | #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_eventLock.h" | |
|
| #include "BPatch_point.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 | |
| | | //#include "Command.h" | |
| | | | |
| | | class BPatch_addressSpace; | |
| | | | |
| | | namespace Dyninst { | |
| | | namespace PatchAPI { | |
| | | class PatchMgr; | |
| | | class DynAddrSpace; | |
| | | class Patcher; | |
| | | class Instance; | |
| | | class PatchFunction; | |
| | | class Point; | |
| | | typedef boost::shared_ptr<PatchMgr> PatchMgrPtr; | |
| | | typedef boost::shared_ptr<DynAddrSpace> DynAddrSpacePtr; | |
| | | typedef boost::shared_ptr<Instance> InstancePtr; | |
| | | PatchMgrPtr convert(const BPatch_addressSpace *); | |
| | | }; | |
| | | namespace SymtabAPI { | |
| | | class Symbol; | |
| | | }; | |
| | | } | |
| | | | |
| | | class BPatch_statement; | |
| | | class BPatch_snippet; | |
| | | class BPatch_point; | |
| | | class BPatch_variableExpr; | |
| | | class BPatch_type; | |
| class AddressSpace; | | class AddressSpace; | |
| class miniTrampHandle; | | class miniTrampHandle; | |
| class miniTramp; | | class miniTramp; | |
| class BPatch; | | class BPatch; | |
|
| | | class BPatch_image; | |
| | | | |
|
| class int_function; | | | |
| struct batchInsertionRecord; | | struct batchInsertionRecord; | |
|
| | | class instPoint; | |
| | | class int_variable; | |
| | | | |
| typedef enum{ | | typedef enum{ | |
| TRADITIONAL_PROCESS, STATIC_EDITOR | | TRADITIONAL_PROCESS, STATIC_EDITOR | |
| } processType; | | } processType; | |
| | | | |
| #ifdef DYNINST_CLASS_NAME | | #ifdef DYNINST_CLASS_NAME | |
| #undef DYNINST_CLASS_NAME | | #undef DYNINST_CLASS_NAME | |
| #endif | | #endif | |
| #define DYNINST_CLASS_NAME BPatchSnippetHandle | | #define DYNINST_CLASS_NAME BPatchSnippetHandle | |
| class BPATCH_DLL_EXPORT BPatchSnippetHandle : public BPatch_eventLock { | | class BPATCH_DLL_EXPORT BPatchSnippetHandle : public BPatch_eventLock { | |
| | | | |
| skipping to change at line 78 | | skipping to change at line 106 | |
| 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; | |
| | | | |
| private: | | private: | |
| // Address Space snippet belogns to | | // Address Space snippet belogns to | |
| BPatch_addressSpace *addSpace_; | | BPatch_addressSpace *addSpace_; | |
| | | | |
| // low-level mappings for removal | | // low-level mappings for removal | |
|
| BPatch_Vector<miniTramp *> mtHandles_; | | std::vector<Dyninst::PatchAPI::InstancePtr> instances_; | |
| | | | |
| // a flag for catchup | | // a flag for catchup | |
| bool catchupNeeded; | | bool catchupNeeded; | |
| // and a list of threads to apply catchup to | | // and a list of threads to apply catchup to | |
| BPatch_Vector<BPatch_thread *> catchup_threads; | | BPatch_Vector<BPatch_thread *> catchup_threads; | |
| | | | |
| BPatchSnippetHandle(BPatch_addressSpace * addSpace); | | BPatchSnippetHandle(BPatch_addressSpace * addSpace); | |
| | | | |
|
| void addMiniTramp(miniTramp *m) { mtHandles_.push_back(m); } | | void addInstance(Dyninst::PatchAPI::InstancePtr p) { instances_.push_ba
ck(p); } | |
| | | | |
| public: | | public: | |
| | | | |
| API_EXPORT_DTOR(_dtor, (), | | API_EXPORT_DTOR(_dtor, (), | |
| ~,BPatchSnippetHandle,()); | | ~,BPatchSnippetHandle,()); | |
| | | | |
| // Returns whether the installed miniTramps use traps. | | // Returns whether the installed miniTramps use traps. | |
| // Not 100% accurate due to internal Dyninst design; we can | | // Not 100% accurate due to internal Dyninst design; we can | |
| // have multiple instances of instrumentation due to function | | // have multiple instances of instrumentation due to function | |
| // relocation. | | // relocation. | |
| API_EXPORT(Int, (), bool, usesTrap, ()); | | 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, (), | | API_EXPORT(Int, (), | |
| BPatch_addressSpace *, getAddressSpace, ()); | | BPatch_addressSpace *, getAddressSpace, ()); | |
| | | | |
| API_EXPORT(Int, (), | | API_EXPORT(Int, (), | |
| BPatch_process *, getProcess, ()); | | BPatch_process *, getProcess, ()); | |
| | | | |
| API_EXPORT(Int, (), | | API_EXPORT(Int, (), | |
| BPatch_Vector<BPatch_thread *> &, getCatchupThreads, ()); | | BPatch_Vector<BPatch_thread *> &, getCatchupThreads, ()); | |
| | | | |
| }; | | }; | |
| | | | |
| skipping to change at line 129 | | skipping to change at line 162 | |
| friend class BPatch_function; | | friend class BPatch_function; | |
| friend class BPatch_frame; | | friend class BPatch_frame; | |
| 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 Dyninst::PatchAPI::PatchMgrPtr Dyninst::PatchAPI::convert(const
BPatch_addressSpace *); | |
| | | | |
| public: | | public: | |
| | | | |
|
| BPatch_function *findOrCreateBPFunc(int_function *ifunc, | | 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, | |
|
| instPoint *ip, | | Dyninst::PatchAPI::Point *ip, | |
| BPatch_procedureLocation pointType = BP | | BPatch_procedureLocation pointType); | |
| atch_locUnknownLocation); | | | |
| | | | |
| BPatch_variableExpr *findOrCreateVariable(int_variable *v, | | BPatch_variableExpr *findOrCreateVariable(int_variable *v, | |
| BPatch_type *type = NULL); | | BPatch_type *type = NULL); | |
| | | | |
| protected: | | protected: | |
| | | | |
| // These callbacks are triggered by lower-level code and forward | | // These callbacks are triggered by lower-level code and forward | |
| // calls up to the findOrCreate functions. | | // calls up to the findOrCreate functions. | |
|
| static BPatch_function *createBPFuncCB(AddressSpace *p, int_function *f); | | static BPatch_function *createBPFuncCB(AddressSpace *p, | |
| static BPatch_point *createBPPointCB(AddressSpace *p, int_function *f, | | Dyninst::PatchAPI::PatchFunction * | |
| instPoint *ip, int type); | | f); | |
| | | static BPatch_point *createBPPointCB(AddressSpace *p, | |
| | | Dyninst::PatchAPI::PatchFunction *f, | |
| | | Dyninst::PatchAPI::Point *ip, | |
| | | int type); | |
| | | | |
| BPatch_Vector<batchInsertionRecord *> *pendingInsertions; | | BPatch_Vector<batchInsertionRecord *> *pendingInsertions; | |
| | | | |
| BPatch_image *image; | | BPatch_image *image; | |
| | | | |
| // AddressSpace * as; | | // AddressSpace * as; | |
| | | | |
| std::vector<BPatch_register> registers_; | | std::vector<BPatch_register> registers_; | |
| | | | |
| protected: | | protected: | |
| | | | |
| skipping to change at line 221 | | skipping to change at line 258 | |
| //Insert new code into the mutatee at multiple points, specifying "wh
en" | | //Insert new code into the mutatee at multiple points, specifying "wh
en" | |
| | | | |
| API_EXPORT_VIRT(AtPointsWhen, (expr, points, when, order), | | API_EXPORT_VIRT(AtPointsWhen, (expr, points, when, order), | |
| BPatchSnippetHandle *,insertSnippet,(const BPatch_snipp
et &expr, | | BPatchSnippetHandle *,insertSnippet,(const BPatch_snipp
et &expr, | |
| const BPatch_Vecto
r<BPatch_point *> &points, | | const BPatch_Vecto
r<BPatch_point *> &points, | |
| BPatch_callWhen wh
en, | | BPatch_callWhen wh
en, | |
| BPatch_snippetOrde
r order = BPatch_firstSnippet)); | | BPatch_snippetOrde
r order = BPatch_firstSnippet)); | |
| | | | |
| virtual void beginInsertionSet() = 0; | | virtual void beginInsertionSet() = 0; | |
| | | | |
|
| virtual bool finalizeInsertionSet(bool atomic, bool *modified) = 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), | | API_EXPORT(Int, (handle), | |
| bool,deleteSnippet,(BPatchSnippetHandle *handle)); | | bool,deleteSnippet,(BPatchSnippetHandle *handle)); | |
| | | | |
| // BPatch_addressSpace::replaceCode | | // BPatch_addressSpace::replaceCode | |
| // | | // | |
| | | | |
| skipping to change at line 258 | | skipping to change at line 295 | |
| API_EXPORT(Int, (point), | | API_EXPORT(Int, (point), | |
| bool,removeFunctionCall,(BPatch_point &point)); | | bool,removeFunctionCall,(BPatch_point &point)); | |
| | | | |
| // BPatch_addressSpace::replaceFunction | | // BPatch_addressSpace::replaceFunction | |
| // | | // | |
| // Replace all calls to a function with calls to another | | // Replace all calls to a function with calls to another | |
| | | | |
| API_EXPORT(Int, (oldFunc, newFunc), | | API_EXPORT(Int, (oldFunc, newFunc), | |
| bool,replaceFunction,(BPatch_function &oldFunc, BPatch_function &newFun
c)); | | bool,replaceFunction,(BPatch_function &oldFunc, BPatch_function &newFun
c)); | |
| | | | |
|
| | | // BPatch_addressSpace::revertReplaceFunction | |
| | | // | |
| | | // Undo the operation of a replace function | |
| | | API_EXPORT(Int, (oldFunc), | |
| | | 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. | |
| | | | |
| | | API_EXPORT(Int, (oldFunc, newFunc, clone), | |
| | | bool,wrapFunction,(BPatch_function *oldFunc, BPatch_function | |
| | | *newFunc, Dyninst::SymtabAPI::Symbol *clone)); | |
| | | | |
| | | // BPatch_addressSpace::revertWrapFunction | |
| | | // | |
| | | // Undo the operations of a wrapFunction, restoring the original | |
| | | // functionality | |
| | | | |
| | | API_EXPORT(Int, (wrappedFunc), | |
| | | bool,revertWrapFunction,(BPatch_function *wrappedFunc)); | |
| | | | |
| // BPatch_addressSpace::getSourceLines | | // BPatch_addressSpace::getSourceLines | |
| // | | // | |
| // Method that retrieves the line number and file name corresponding | | // Method that retrieves the line number and file name corresponding | |
| // to an address | | // to an address | |
| | | | |
| API_EXPORT(Int, (addr, lines), | | API_EXPORT(Int, (addr, lines), | |
| bool,getSourceLines,(unsigned long addr, BPatch_Vector< BPatch_statemen
t > & lines )); | | bool,getSourceLines,(unsigned long addr, BPatch_Vector< BPatch_statemen
t > & lines )); | |
| | | | |
| // BPatch_addressSpace::getAddressRanges | | // BPatch_addressSpace::getAddressRanges | |
| // | | // | |
| // Method that retrieves address range(s) for a given filename and line
number. | | // Method that retrieves address range(s) for a given filename and line
number. | |
| | | | |
| API_EXPORT(Int, (fileName, lineNo, ranges), | | 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 )); | |
| | | | |
|
| | | // DEPRECATED: | |
| // BPatch_addressSpace::findFunctionByAddr | | // BPatch_addressSpace::findFunctionByAddr | |
| // | | // | |
| // Returns the function containing an address | | // Returns the function containing an address | |
| | | | |
| API_EXPORT(Int, (addr), | | API_EXPORT(Int, (addr), | |
| BPatch_function *,findFunctionByAddr,(void *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 | | // BPatch_addressSpace::findFunctionsByAddr | |
| // | | // | |
| // Returns the functions containing an address | | // Returns the functions containing an address | |
|
| // (this is possible if there is shared code | | // (multiple functions are returned when code is shared) | |
| | | | |
| API_EXPORT(Int, (addr,funcs), | | API_EXPORT(Int, (addr,funcs), | |
| bool, findFunctionsByAddr,(Dyninst::Address addr, | | bool, findFunctionsByAddr,(Dyninst::Address addr, | |
| std::vector<BPatch_function*> &funcs)); | | std::vector<BPatch_function*> &funcs)); | |
| | | | |
| // BPatch_addressSpace::getImage | | // BPatch_addressSpace::getImage | |
| // | | // | |
| // Obtain BPatch_image associated with this BPatch_addressSpace | | // Obtain BPatch_image associated with this BPatch_addressSpace | |
| | | | |
| API_EXPORT(Int, (), | | API_EXPORT(Int, (), | |
| BPatch_image *,getImage,()); | | BPatch_image *,getImage,()); | |
| | | | |
| skipping to change at line 332 | | skipping to change at line 400 | |
| // BPatch_addressSpace::createVariable | | // BPatch_addressSpace::createVariable | |
| // | | // | |
| // Wrap an existing piece of allocated memory with a BPatch_variableExp
r. | | // 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 | | // Used (for instance) by the shared memory library to wrap its externa
lly | |
| // allocated memory for use by BPatch. | | // allocated memory for use by BPatch. | |
| | | | |
| API_EXPORT(Int, (name, addr, type), | | API_EXPORT(Int, (name, addr, type), | |
| BPatch_variableExpr *, createVariable, | | BPatch_variableExpr *, createVariable, | |
| (std::string name, Dyninst::Address addr, BPatch_type *type
= NULL)); | | (std::string name, Dyninst::Address addr, BPatch_type *type
= NULL)); | |
| | | | |
|
| API_EXPORT(Int, (regs, includeSPRs), | | API_EXPORT(Int, (regs), | |
| bool, getRegisters, (std::vector<BPatch_register> ®s, boo | | bool, getRegisters, (std::vector<BPatch_register> ®s)); | |
| l includeSPRs = false)); | | | |
| | | | |
| API_EXPORT(Int, (regName, reg), | | API_EXPORT(Int, (regName, reg), | |
| bool, createRegister_NP, (std::string regName, BPatch_register ®)); | | bool, createRegister_NP, (std::string regName, BPatch_register ®)); | |
| | | | |
| API_EXPORT_V(Int, (allowtraps), | | API_EXPORT_V(Int, (allowtraps), | |
| void, allowTraps, (bool allowtraps)); | | void, allowTraps, (bool allowtraps)); | |
| | | | |
| // BPatch_addressSpace::loadLibrary | | // BPatch_addressSpace::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 | |
| // | | // | |
| // the reload argument is used by save the world to determine | | // the reload argument is used by save the world to determine | |
| // if this library should be reloaded by the mutated binary | | // if this library should be reloaded by the mutated binary | |
| // when it starts up. this is up to the user because loading | | // when it starts up. this is up to the user because loading | |
| // an extra shared library could hide access to the 'correct' | | // an extra shared library could hide access to the 'correct' | |
| // function by redefining a function | | // function by redefining a function | |
| | | | |
| API_EXPORT_VIRT(Int, (libname, reload), | | API_EXPORT_VIRT(Int, (libname, reload), | |
|
| bool, loadLibrary,(const char *libname, bool reload = false)); | | BPatch_module *, loadLibrary,(const char *libname, bool reload = false)
); | |
| | | | |
| // BPatch_addressSpace::isStaticExecutable | | // BPatch_addressSpace::isStaticExecutable | |
| // | | // | |
| // Returns true if the underlying image represents a | | // Returns true if the underlying image represents a | |
| // statically-linked executable, false otherwise | | // statically-linked executable, false otherwise | |
| API_EXPORT(Int, (), | | API_EXPORT(Int, (), | |
| bool, isStaticExecutable,()); | | bool, isStaticExecutable,()); | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 23 change blocks. |
| 26 lines changed or deleted | | 94 lines changed or added | |
|
| BPatch_basicBlock.h | | BPatch_basicBlock.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 34 | |
| * 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 | |
| */ | | */ | |
| | | | |
| #ifndef _BPatch_basicBlock_h_ | | #ifndef _BPatch_basicBlock_h_ | |
| #define _BPatch_basicBlock_h_ | | #define _BPatch_basicBlock_h_ | |
| | | | |
|
| #include "BPatch_point.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 "BPatch_eventLock.h" | |
| #include "Instruction.h" | | #include "Instruction.h" | |
|
| | | #include "BPatch_enums.h" | |
| //#include "BPatch_edge.h" | | //#include "BPatch_edge.h" | |
| | | | |
| class image; | | class image; | |
|
| class int_function; | | class func_instance; | |
| class int_basicBlock; | | class instPoint; | |
| | | class block_instance; | |
| | | class BPatch_point; | |
| | | class BPatch_edge; | |
| | | class BPatch_function; | |
| | | class BPatch_flowGraph; | |
| | | 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 ParseAPI { | |
| | | class Block; | |
| | | Block *convert(const BPatch_basicBlock *); | |
| | | }; | |
| | | namespace PatchAPI { | |
| | | class PatchBlock; | |
| | | PatchBlock *convert(const BPatch_basicBlock *); | |
| | | }; | |
| | | }; | |
| | | | |
| /** 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; | |
| | | | |
| skipping to change at line 78 | | skipping to change at line 94 | |
| 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 : public BPatch_eventLock { | |
| 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 int_function; | | 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 | |
| | | Patch_basicBlock *); | |
| | | friend Dyninst::PatchAPI::PatchBlock *Dyninst::PatchAPI::convert(co | |
| | | nst BPatch_basicBlock *); | |
| | | | |
| private: | | private: | |
| /** the internal basic block structure **/ | | /** the internal basic block structure **/ | |
|
| int_basicBlock *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; | | BPatch_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; | |
| | | | |
| | | | |
| skipping to change at line 111 | | skipping to change at line 129 | |
| | | | |
| /** 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; | | BPatch_Set<BPatch_edge*> incomingEdges; | |
| | | | |
| /** the outgoing edges */ | | /** the outgoing edges */ | |
| BPatch_Set<BPatch_edge*> outgoingEdges; | | BPatch_Set<BPatch_edge*> outgoingEdges; | |
| | | | |
|
| | | public: | |
| | | BPatch_flowGraph *fg() const { return flowGraph; } | |
| | | block_instance *block() const { return iblock; } | |
| | | BPatch_function *func() const; | |
| | | func_instance *ifunc() const; | |
| | | | |
| protected: | | protected: | |
| | | | |
| /** constructor of class */ | | /** constructor of class */ | |
|
| BPatch_basicBlock(int_basicBlock *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. | |
|
| int_basicBlock *lowlevel_block() { return iblock; } | | block_instance *lowlevel_block() { return iblock; } | |
| void setlowlevel_block(int_basicBlock *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_function *getCallTarget(); | | BPatch_function *getCallTarget(); | |
| // end internal functions | | // end internal functions | |
| | | | |
|
| | | API_EXPORT(Int, (), | |
| | | 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), | | 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), | | API_EXPORT_V(Int, (targets), | |
| | | | |
| skipping to change at line 271 | | skipping to change at line 300 | |
| 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), | | API_EXPORT(Int, (ops), | |
| BPatch_Vector<BPatch_point*> *,findPoint,(const BPatch_Set<BP
atch_opCode>& ops)); | | BPatch_Vector<BPatch_point*> *,findPoint,(const BPatch_Set<BP
atch_opCode>& ops)); | |
| | | | |
| API_EXPORT(Int, (filter), | | API_EXPORT(Int, (filter), | |
| BPatch_Vector<BPatch_point*> *,findPoint,(bool(*filter)(Dynin
st::InstructionAPI::Instruction::Ptr))); | | BPatch_Vector<BPatch_point*> *,findPoint,(bool(*filter)(Dynin
st::InstructionAPI::Instruction::Ptr))); | |
|
| | | | |
| | | API_EXPORT(Int, (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, (), | | | |
| BPatch_Vector<BPatch_instruction *> *,getInstructions,()); | | | |
| | | | |
| API_EXPORT(Int, (insns), | | API_EXPORT(Int, (insns), | |
| bool, getInstructions, (std::vector<Dyninst::InstructionAPI::I
nstruction::Ptr>& insns)); | | bool, getInstructions, (std::vector<Dyninst::InstructionAPI::I
nstruction::Ptr>& insns)); | |
| API_EXPORT(Addrs, (insnInstances), | | API_EXPORT(Addrs, (insnInstances), | |
| bool, getInstructions, (std::vector<std::pair<Dyninst::Instruc
tionAPI::Instruction::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), | | 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), | | 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::PatchAPI::PatchBlock *() const; | |
| | | | |
| int blockNo() const; | | int blockNo() const; | |
| | | | |
| struct compare { | | struct compare { | |
| int operator()(CONST_EXPORT BPatch_basicBlock *b1, | | int operator()(CONST_EXPORT BPatch_basicBlock *b1, | |
| CONST_EXPORT BPatch_basicBlock *b2) CONST_EXPORT | | CONST_EXPORT BPatch_basicBlock *b2) CONST_EXPORT | |
| { | | { | |
| if (b1->getStartAddress() < b2->getStartAddress()) | | if (b1->getStartAddress() < b2->getStartAddress()) | |
| return -1; | | return -1; | |
| if (b1->getStartAddress() > b2->getStartAddress()) | | if (b1->getStartAddress() > b2->getStartAddress()) | |
| return 1; | | return 1; | |
| | | | |
End of changes. 17 change blocks. |
| 18 lines changed or deleted | | 53 lines changed or added | |
|
| BPatch_flowGraph.h | | BPatch_flowGraph.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 45 | | skipping to change at line 44 | |
| #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_eventLock.h" | |
| #include "BPatch_loopTreeNode.h" | | #include "BPatch_loopTreeNode.h" | |
|
| | | #include "BPatch_edge.h" | |
| | | | |
|
| class int_function; | | class func_instance; | |
| class process; | | | |
| class AddressSpace; | | class AddressSpace; | |
| class BPatch_edge; | | class BPatch_edge; | |
|
| | | 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 | | #ifdef DYNINST_CLASS_NAME | |
| #undef DYNINST_CLASS_NAME | | #undef DYNINST_CLASS_NAME | |
| #endif | | #endif | |
| #define DYNINST_CLASS_NAME BPatch_flowGraph | | #define DYNINST_CLASS_NAME BPatch_flowGraph | |
| | | | |
| class BPATCH_DLL_EXPORT BPatch_flowGraph : | | class BPATCH_DLL_EXPORT BPatch_flowGraph : | |
| public BPatch_eventLock, | | public BPatch_eventLock, | |
| public Dyninst::AnnotatableSparse | | public Dyninst::AnnotatableSparse | |
| { | | { | |
| friend class BPatch_basicBlock; | | friend class BPatch_basicBlock; | |
|
| | | friend class BPatch_edge; | |
| friend class BPatch_function; | | friend class BPatch_function; | |
| friend class dominatorCFG; | | friend class dominatorCFG; | |
|
| friend class int_function; // This is illegal here... keeps us from havin
g 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, | |
| BPatch_Vector<BPatch_basicBlockLoop *>
&loops, | | BPatch_Vector<BPatch_basicBlockLoop *>
&loops, | |
| std::string level); | | std::string level); | |
| | | | |
| BPatch_flowGraph (BPatch_function *func, bool &valid); | | BPatch_flowGraph (BPatch_function *func, bool &valid); | |
| | | | |
|
| int_function *ll_func() const; | | func_instance *ll_func() const; | |
| bool isValid_; | | bool isValid_; | |
|
| | | | |
| | | std::map<const block_instance *, BPatch_basicBlock *> blockMap_; | |
| | | 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 *getBFunction() 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 *findBlockByAddr(Dyninst::Address addr); | |
|
| | | BPatch_basicBlock *findBlock(block_instance *b); | |
| | | 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, (), | | 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), | | API_EXPORT(Int, (blocks), | |
| | | | |
| skipping to change at line 218 | | skipping to change at line 225 | |
| | | | |
| void findAndDeleteUnreachable(); | | void findAndDeleteUnreachable(); | |
| | | | |
| static void findBBForBackEdge(BPatch_edge*, | | static void findBBForBackEdge(BPatch_edge*, | |
| BPatch_Set<BPatch_basicBlock*>&); | | BPatch_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, | |
|
| int_function *func, | | func_instance *func, | |
| unsigned long addr); | | unsigned long addr); | |
| | | | |
|
| void insertCalleeIntoLoopHierarchy(int_function * func, unsigned long add
r); | | void insertCalleeIntoLoopHierarchy(func_instance * func, unsigned long ad
dr); | |
| | | | |
| void dfsPrintLoops(BPatch_loopTreeNode *n); | | void dfsPrintLoops(BPatch_loopTreeNode *n); | |
| | | | |
| void createBackEdges(); | | void createBackEdges(); | |
| void createLoops(); | | void createLoops(); | |
| | | | |
| void dump(); | | void dump(); | |
| | | | |
| void findLoopExitInstPoints(BPatch_basicBlockLoop *loop, | | void findLoopExitInstPoints(BPatch_basicBlockLoop *loop, | |
| BPatch_Vector<BPatch_point*> *points); | | BPatch_Vector<BPatch_point*> *points); | |
| | | | |
End of changes. 13 change blocks. |
| 14 lines changed or deleted | | 21 lines changed or added | |
|
| BPatch_function.h | | BPatch_function.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 38 | | 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_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_point.h" | | #include "BPatch_Set.h" | |
| | | #include "BPatch_enums.h" | |
| #include "BPatch_type.h" | | #include "BPatch_type.h" | |
| #include "BPatch_module.h" | | #include "BPatch_module.h" | |
|
| #include "BPatch_flowGraph.h" | | | |
| #include "BPatch_eventLock.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 int_function; | | class func_instance; | |
| class process; | | | |
| 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; | |
| | | | |
| namespace Dyninst { | | namespace Dyninst { | |
| namespace ParseAPI { | | namespace ParseAPI { | |
| class Function; | | class Function; | |
|
| | | Function *convert(const BPatch_function *); | |
| | | }; | |
| | | namespace PatchAPI { | |
| | | class PatchFunction; | |
| | | PatchFunction *convert(const BPatch_function *); | |
| }; | | }; | |
| }; | | }; | |
| | | | |
| #ifdef DYNINST_CLASS_NAME | | #ifdef DYNINST_CLASS_NAME | |
| #undef DYNINST_CLASS_NAME | | #undef DYNINST_CLASS_NAME | |
| #endif | | #endif | |
| #define DYNINST_CLASS_NAME BPatch_function | | #define DYNINST_CLASS_NAME BPatch_function | |
| | | | |
| class BPATCH_DLL_EXPORT BPatch_function : | | class BPATCH_DLL_EXPORT BPatch_function : | |
| public BPatch_sourceObj, | | public BPatch_sourceObj, | |
| | | | |
| skipping to change at line 91 | | skipping to change at line 95 | |
| 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_point; | | friend class BPatch_point; | |
| friend BPatch_Vector<BPatch_point*> *findPoint( | | friend BPatch_Vector<BPatch_point*> *findPoint( | |
| const BPatch_Set<BPatch_opCode>& ops, | | const BPatch_Set<BPatch_opCode>& ops, | |
| InstrucIter &ii, | | InstrucIter &ii, | |
| BPatch_process *proc, | | BPatch_process *proc, | |
| BPatch_function *bpf); | | BPatch_function *bpf); | |
|
| | | friend Dyninst::ParseAPI::Function *Dyninst::ParseAPI::convert(const BP | |
| | | atch_function *); | |
| | | friend Dyninst::PatchAPI::PatchFunction *Dyninst::PatchAPI::convert(con | |
| | | st BPatch_function *); | |
| | | | |
| //BPatch_process *proc; | | //BPatch_process *proc; | |
| BPatch_addressSpace *addSpace; | | BPatch_addressSpace *addSpace; | |
| AddressSpace *lladdSpace; | | AddressSpace *lladdSpace; | |
| BPatch_type *retType; | | BPatch_type *retType; | |
|
| BPatch_Vector<BPatch_localVar *> params; | | | |
| std::map<BPatch_localVar *, BPatch_variableExpr *> local_vars; | | | |
| BPatch_module *mod; | | BPatch_module *mod; | |
| BPatch_flowGraph* cfg; | | BPatch_flowGraph* cfg; | |
| bool cfgCreated; | | bool cfgCreated; | |
| bool liveInit; | | bool liveInit; | |
| | | | |
| BPatch_point* createMemInstPoint(void *addr, BPatch_memoryAccess* ma); | | BPatch_point* createMemInstPoint(void *addr, BPatch_memoryAccess* ma); | |
| | | | |
|
| int_function *func; | | func_instance *func; | |
| bool varsAndParamsValid; | | bool varsAndParamsValid; | |
| | | | |
| private: | | private: | |
| void constructVarsAndParams(); | | void constructVarsAndParams(); | |
| | | | |
| void identifyParamDependencies(BPatch_function* callee, void* calleeAddr
ess); | | void identifyParamDependencies(BPatch_function* callee, void* calleeAddr
ess); | |
| | | | |
|
| | | #if defined(_MSC_VER) | |
| | | #pragma warning(push) | |
| | | #pragma warning(disable:4251) | |
| | | #endif | |
| | | // Disable warning that these vectors cannot be used externally, | |
| | | // which is irrelevant since the vectors are private | |
| | | std::map<BPatch_localVar *, BPatch_variableExpr *> local_vars; | |
| | | BPatch_Vector<BPatch_localVar *> params; | |
| | | #if defined(_MSC_VER) | |
| | | #pragma warning(pop) | |
| | | #endif | |
| | | | |
| public: | | public: | |
| //dynC internal use only | | //dynC internal use only | |
| bool hasParamDebugInfo(); | | bool hasParamDebugInfo(); | |
|
| | | | |
| public: | | public: | |
| virtual ~BPatch_function(); | | virtual ~BPatch_function(); | |
| | | | |
| // The following are for internal use by the library only: | | // The following are for internal use by the library only: | |
|
| int_function *lowlevel_func() const { return func; } | | func_instance *lowlevel_func() const { return func; } | |
| BPatch_process *getProc() const; | | BPatch_process *getProc() const; | |
| BPatch_addressSpace *getAddSpace() const { return addSpace; } | | BPatch_addressSpace *getAddSpace() const { return addSpace; } | |
| | | | |
|
| BPatch_function(BPatch_addressSpace *_addSpace, int_function *_func, | | BPatch_function(BPatch_addressSpace *_addSpace, func_instance *_func, | |
| BPatch_module *mod = NULL); | | BPatch_module *mod = NULL); | |
|
| BPatch_function(BPatch_addressSpace *_addSpace, int_function *_func, | | BPatch_function(BPatch_addressSpace *_addSpace, func_instance *_func, | |
| BPatch_type * _retType, | | BPatch_type * _retType, | |
| BPatch_module *); | | BPatch_module *); | |
| bool getSourceObj(BPatch_Vector<BPatch_sourceObj *> &); | | bool getSourceObj(BPatch_Vector<BPatch_sourceObj *> &); | |
| BPatch_sourceObj *getObjParent(); | | BPatch_sourceObj *getObjParent(); | |
| BPatch_localVarCollection * localVariables; | | BPatch_localVarCollection * localVariables; | |
| BPatch_localVarCollection * funcParameters; | | BPatch_localVarCollection * funcParameters; | |
| void setReturnType(BPatch_type * _retType){retType = _retType;} | | void setReturnType(BPatch_type * _retType){retType = _retType;} | |
| void setModule(BPatch_module *module) { if (this->mod == NULL) this->mo
d = module;} | | void setModule(BPatch_module *module) { if (this->mod == NULL) this->mo
d = module;} | |
| void removeCFG() { cfg = NULL; } | | void removeCFG() { cfg = NULL; } | |
| void getUnresolvedControlTransfers(BPatch_Vector<BPatch_point *> &unres
olvedCF); | | void getUnresolvedControlTransfers(BPatch_Vector<BPatch_point *> &unres
olvedCF); | |
| void getAbruptEndPoints(BPatch_Vector<BPatch_point *> &abruptEnds); | | void getAbruptEndPoints(BPatch_Vector<BPatch_point *> &abruptEnds); | |
|
| void getCallerPoints(std::vector<BPatch_point*>& callerPoints); | | void getCallerPoints(BPatch_Vector<BPatch_point*>& callerPoints); | |
| void getAllPoints(std::vector<BPatch_point*>& allPoints); | | void getAllPoints(BPatch_Vector<BPatch_point*>& allPoints); | |
| | | | |
| | | void getEntryPoints(BPatch_Vector<BPatch_point *> &entryPoints); | |
| | | void getExitPoints(BPatch_Vector<BPatch_point *> &entryPoints); | |
| | | void getCallPoints(BPatch_Vector<BPatch_point *> &entryPoints); | |
| | | | |
| bool setHandlerFaultAddrAddr(Dyninst::Address addr, bool set); | | bool setHandlerFaultAddrAddr(Dyninst::Address addr, bool set); | |
|
| void fixHandlerReturnAddr(Dyninst::Address addr); | | bool removeInstrumentation(bool useInsertionSet); | |
| bool removeInstrumentation(); | | | |
| bool parseNewEdge(Dyninst::Address source, Dyninst::Address target); | | bool parseNewEdge(Dyninst::Address source, Dyninst::Address target); | |
|
| | | void relocateFunction(); | |
| | | bool getSharedFuncs(std::set<BPatch_function*> &funcs); | |
| | | | |
| void addParam(Dyninst::SymtabAPI::localVar *lvar); | | void addParam(Dyninst::SymtabAPI::localVar *lvar); | |
| | | | |
| // void addParam(const char * _name, BPatch_type *_type, int _linenum, | | // void addParam(const char * _name, BPatch_type *_type, int _linenum, | |
| // long _frameOffset, int _reg = -1, | | // long _frameOffset, int _reg = -1, | |
| // 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. | |
| | | | |
| skipping to change at line 202 | | skipping to change at line 225 | |
| | | | |
| API_EXPORT(Int, (names), | | 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, (), | | API_EXPORT(Int, (), | |
| | | | |
| void *,getBaseAddr,(void)); | | void *,getBaseAddr,(void)); | |
| | | | |
|
| // BPatch_function::getSize | | | |
| // Returns the size of the function in bytes (end of last block - star | | | |
| t of first block) | | | |
| API_EXPORT(Int, (), | | | |
| | | | |
| unsigned int,getSize,()); | | | |
| | | | |
| // BPatch_function::getSize | | | |
| // Returns the number of contiguous bytes a function takes up followin | | | |
| g its entry point | | | |
| // This may be different from getSize if the function is disjoint | | | |
| API_EXPORT(Int, (), | | | |
| unsigned int,getContiguousSize,()); | | | |
| | | | |
| // 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, (), | | 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 | |
| | | | |
| | | | |
| skipping to change at line 256 | | skipping to change at line 267 | |
| | | | |
| BPatch_Vector<BPatch_point *> *,findPoint,(CONST_EXPORT BPatch_procedur
eLocation 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), | | API_EXPORT(ByOp, (ops), | |
| | | | |
| BPatch_Vector<BPatch_point *> *,findPoint,(const BPatch_Set<BPatch_opCo
de>& ops)); | | BPatch_Vector<BPatch_point *> *,findPoint,(const BPatch_Set<BPatch_opCo
de>& ops)); | |
| | | | |
|
| | | // BPatch_function::findPoint | |
| | | // | |
| | | // Returns a BPatch_point that corresponds with the provided address. | |
| | | Returns NULL | |
| | | // if the address does not correspond with an instruction. | |
| | | API_EXPORT(Int, (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), | | 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 | |
| | | | |
| | | | |
| skipping to change at line 331 | | skipping to change at line 349 | |
| | | | |
| // 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, () ); | | 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)); | | API_EXPORT( Int, (funcs), bool, findOverlapping, (BPatch_Vector<BPatch_
function *> &funcs)); | |
| | | | |
| // Get the underlying ParseAPI Function | | // Get the underlying ParseAPI Function | |
|
| API_EXPORT( Int, (), Dyninst::ParseAPI::Function *, getParseAPIFunc, ()
); | | operator Dyninst::ParseAPI::Function *() const; | |
| | | | |
|
| #ifdef IBM_BPATCH_COMPAT | | // Get the underlying PatchAPI Function | |
| API_EXPORT(Int, (start, end), | | operator Dyninst::PatchAPI::PatchFunction *() const; | |
| | | | |
| bool,getLineNumbers,(unsigned int &start, unsigned int &end)); | | | |
| | | | |
| API_EXPORT(Int, (), | | | |
| | | | |
| void *,getAddress,()); | | | |
| | | | |
| API_EXPORT(Int, (start, end), | | API_EXPORT(Int, (start, end), | |
|
| | | | |
| bool,getAddressRange,(void * &start, void * &end)); | | bool,getAddressRange,(void * &start, void * &end)); | |
| | | | |
|
| API_EXPORT(Int, (), | | API_EXPORT(Int, (start, end), | |
| | | bool,getAddressRange,(Dyninst::Address &start, Dyninst::Addr | |
| BPatch_type *,returnType,()); | | ess &end)); | |
| | | | |
| API_EXPORT_V(Int, (vect), | | | |
| | | | |
| void,getIncPoints,(BPatch_Vector<BPatch_point *> &vect)); | | | |
| | | | |
| API_EXPORT(Int, (), | | API_EXPORT(Int, (), | |
|
| | | unsigned int,getFootprint,()); | |
| | | | |
|
| int,getMangledNameLen,()); | | | |
| | | | |
| API_EXPORT_V(Int, (points), | | | |
| | | | |
| void,getExcPoints,(BPatch_Vector<BPatch_point*> &points)); | | | |
| | | | |
| API_EXPORT(DPCL, (), | | | |
| | | | |
| const char *,getName,()); | | | |
| | | | |
| #endif | | | |
| }; | | }; | |
| | | | |
| #endif /* _BPatch_function_h_ */ | | #endif /* _BPatch_function_h_ */ | |
| | | | |
End of changes. 26 change blocks. |
| 63 lines changed or deleted | | 61 lines changed or added | |
|
| BPatch_image.h | | BPatch_image.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 38 | | 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_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_addressSpace.h" | | | |
| #include "BPatch_point.h" | | | |
| #include "BPatch_snippet.h" | | | |
| #include "BPatch_module.h" | | #include "BPatch_module.h" | |
| #include "BPatch_type.h" | | #include "BPatch_type.h" | |
| #include "BPatch_eventLock.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 process; | | | |
| class image; | | class image; | |
| class int_variable; | | class int_variable; | |
|
| | | class BPatch_point; | |
| | | 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; | |
| | | | |
| | | namespace Dyninst { | |
| | | namespace PatchAPI { | |
| | | class PatchMgr; | |
| | | typedef boost::shared_ptr<PatchMgr> PatchMgrPtr; | |
| | | PatchMgrPtr convert(const BPatch_image *); | |
| | | } | |
| | | } | |
| | | | |
| #ifdef DYNINST_CLASS_NAME | | #ifdef DYNINST_CLASS_NAME | |
| #undef DYNINST_CLASS_NAME | | #undef DYNINST_CLASS_NAME | |
| #endif | | #endif | |
| #define DYNINST_CLASS_NAME BPatch_image | | #define DYNINST_CLASS_NAME BPatch_image | |
| | | | |
| class BPATCH_DLL_EXPORT BPatch_image: public BPatch_sourceObj, public BPatc
h_eventLock { | | class BPATCH_DLL_EXPORT BPatch_image: public BPatch_sourceObj, public BPatc
h_eventLock { | |
| friend class BPatch; // registerLoaded... callbacks | | friend class BPatch; // registerLoaded... callbacks | |
| friend class BPatch_module; // access to findOrCreate... | | friend class BPatch_module; // access to findOrCreate... | |
|
| friend class process; // Which also needs findOrCreate because we upcal
l when a library is loaded. | | | |
| 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 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_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 | |
| | | | |
| skipping to change at line 161 | | skipping to change at line 170 | |
| | | | |
| BPatch_Vector<BPatch_parRegion *> *, | | BPatch_Vector<BPatch_parRegion *> *, | |
| getParRegions,(bool incUninstrumentable = false)); | | getParRegions,(bool incUninstrumentable = false)); | |
| | | | |
| // BPatch_image::getModules | | // BPatch_image::getModules | |
| // | | // | |
| // Returns a vector of all modules in this image | | // Returns a vector of all modules in this image | |
| API_EXPORT(Int, (), | | API_EXPORT(Int, (), | |
| BPatch_Vector<BPatch_module *> *,getModules,()); | | BPatch_Vector<BPatch_module *> *,getModules,()); | |
| | | | |
|
| | | // BPatch_image::getObjects | |
| | | // | |
| | | // Returns a vector of all objects in this image | |
| | | API_EXPORT_V(Int, (objs), | |
| | | void, getObjects, (std::vector<BPatch_object *> &objs)); | |
| | | | |
| API_EXPORT(Int, (mods), | | API_EXPORT(Int, (mods), | |
| bool,getModules,(BPatch_Vector<BPatch_module*> &mods)); | | bool,getModules,(BPatch_Vector<BPatch_module*> &mods)); | |
| | | | |
| // BPatch_image::findModule | | // BPatch_image::findModule | |
| // | | // | |
| // Returns a module matching <name> if present in image, NULL if not f
ound | | // Returns a module matching <name> if present in image, NULL if not f
ound | |
| // if <substring_match> is set, the first module that has <name> as a
substring | | // if <substring_match> is set, the first module that has <name> as a
substring | |
| // of its name is returned (eg, to find "libpthread.so.1", search for
"libpthread" | | // of its name is returned (eg, to find "libpthread.so.1", search for
"libpthread" | |
| // with substring_match set to true) | | // with substring_match set to true) | |
| API_EXPORT(Int, (name, substring_match), | | API_EXPORT(Int, (name, substring_match), | |
| | | | |
| BPatch_module *,findModule,(const char *name, bool substring_match = fa
lse)); | | BPatch_module *,findModule,(const char *name, bool substring_match = fa
lse)); | |
| | | | |
| // BPatch_image::getGlobalVariables | | // BPatch_image::getGlobalVariables | |
| // | | // | |
| // Returns the global variables defined in this image | | // Returns the global variables defined in this image | |
| API_EXPORT(Int, (), | | API_EXPORT(Int, (), | |
| | | | |
| BPatch_Vector<BPatch_variableExpr *> *,getGlobalVariables,()); | | BPatch_Vector<BPatch_variableExpr *> *,getGlobalVariables,()); | |
| | | | |
|
| // BPatch_image::createInstPointAtAddr | | | |
| // | | | |
| // Returns a pointer to a BPatch_point object representing an | | | |
| // instrumentation point at the given address. | | | |
| // Returns NULL on failure. | | | |
| API_EXPORT(Int, (address), | | | |
| | | | |
| BPatch_point *,createInstPointAtAddr,(void *address)); | | | |
| | | | |
| // BPatch_image::createInstPointAtAddr | | | |
| // | | | |
| // Returns a pointer to a BPatch_point object representing an | | | |
| // instrumentation point at the given address. If the BPatch_function | | | |
| // argument is given it has to be the function that address belongs to | | | |
| or NULL. | | | |
| // The function is used to bypass the function that the address belong | | | |
| s to | | | |
| // The alternative argument is used to retrieve the point if the new p | | | |
| oint | | | |
| // intersects with another already existing one. | | | |
| // Returns NULL on failure. | | | |
| API_EXPORT(WithAlt, (address, alternative, bpf), | | | |
| | | | |
| BPatch_point *,createInstPointAtAddr,(void *address, | | | |
| BPatch_point** alternative, | | | |
| BPatch_function* bpf = NULL)); | | | |
| | | | |
| // 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 <name>, if <name> is a regul
ar | |
| // expression, a (slower) regex search will be performed. | | // expression, a (slower) regex search will be performed. | |
| // Returns NULL on failure. | | // Returns NULL on failure. | |
| API_EXPORT(Int, (name, funcs, showError, regex_case_sensitive, incUnins
trumentable), | | API_EXPORT(Int, (name, funcs, showError, regex_case_sensitive, incUnins
trumentable), | |
| | | | |
| BPatch_Vector<BPatch_function*> *,findFunction,(const char *name, | | BPatch_Vector<BPatch_function*> *,findFunction,(const char *name, | |
| BPatch_Vector<BPatch_fu
nction*> &funcs, | | BPatch_Vector<BPatch_fu
nction*> &funcs, | |
| bool showError=true, | | bool showError=true, | |
| | | | |
| skipping to change at line 263 | | skipping to change at line 254 | |
| | | | |
| BPatch_variableExpr *,findVariable,(BPatch_point &scp, const
char *nm, bool showError=true)); | | BPatch_variableExpr *,findVariable,(BPatch_point &scp, const
char *nm, bool showError=true)); | |
| | | | |
| // BPatch_image::findType | | // BPatch_image::findType | |
| // | | // | |
| // Returns a BPatch_type corresponding to <name>, if exists, NULL if n
ot found | | // Returns a BPatch_type corresponding to <name>, if exists, NULL if n
ot found | |
| API_EXPORT(Int, (name), | | API_EXPORT(Int, (name), | |
| | | | |
| BPatch_type *,findType,(const char *name)); | | BPatch_type *,findType,(const char *name)); | |
| | | | |
|
| | | // BPatch_image::findPoints | |
| | | // | |
| | | // 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 | |
| | | // if there is not overlapping code. | |
| | | API_EXPORT(Int, (addr, points), | |
| | | bool, findPoints, (Dyninst::Address addr, std::vector<BPatch_point *> & | |
| | | points)); | |
| | | | |
| // BPatch_image::getAddressRanges | | // BPatch_image::getAddressRanges | |
| // | | // | |
| // method to retrieve addresses corresponding to a line in a file | | // method to retrieve addresses corresponding to a line in a file | |
| API_EXPORT(Int, (fileName, lineNo, ranges), | | API_EXPORT(Int, (fileName, lineNo, ranges), | |
| | | | |
| bool,getAddressRanges,( const char * fileName, unsigned int lineNo, | | bool,getAddressRanges,( const char * fileName, unsigned int lineNo, | |
| std::vector<std::pair<unsigned long, unsigned l
ong> > & ranges )); | | std::vector<std::pair<unsigned long, unsigned l
ong> > & ranges )); | |
| | | | |
| API_EXPORT(Int, (addr, lines), | | API_EXPORT(Int, (addr, lines), | |
| bool,getSourceLines,( unsigned long addr, BPatch_Vector<BPatch_statemen
t> & lines )); | | bool,getSourceLines,( unsigned long addr, BPatch_Vector<BPatch_statemen
t> & lines )); | |
| | | | |
| skipping to change at line 344 | | skipping to change at line 343 | |
| API_EXPORT(Int, (name, len), | | API_EXPORT(Int, (name, len), | |
| | | | |
| char *,programName,(char *name, unsigned int len)); | | char *,programName,(char *name, unsigned int len)); | |
| | | | |
| API_EXPORT(Int, (), | | API_EXPORT(Int, (), | |
| int,lpType,()); | | int,lpType,()); | |
| #endif | | #endif | |
| | | | |
| private: | | private: | |
| BPatch_addressSpace *addSpace; | | BPatch_addressSpace *addSpace; | |
|
| BPatch_Vector<BPatch_module *> modlist; | | | |
| BPatch_Vector<BPatch_module *> removed_list; | | | |
| BPatch_module *defaultModule; | | BPatch_module *defaultModule; | |
| | | | |
|
| BPatch_module *findModule(mapped_module *base); | | | |
| BPatch_module *findOrCreateModule(mapped_module *base); | | BPatch_module *findOrCreateModule(mapped_module *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) | |
| | | #pragma warning(push) | |
| | | #pragma warning(disable:4251) | |
| | | #endif | |
| | | typedef std::map<mapped_module *, BPatch_module *> ModMap; | |
| | | typedef std::map<mapped_object *, BPatch_object *> ObjMap; | |
| | | | |
| | | ModMap modmap; | |
| | | ObjMap objmap; | |
| | | | |
| | | // Annoying backwards-compatible return type | |
| | | std::vector<BPatch_module *> modlist; | |
| | | | |
| | | BPatch_Vector<BPatch_module *> removed_list; | |
| BPatch_Vector<BPatch_point *> unresolvedCF; | | BPatch_Vector<BPatch_point *> unresolvedCF; | |
|
| | | #if defined(_MSC_VER) | |
| | | #pragma warning(pop) | |
| | | #endif | |
| | | | |
|
| // These private "find" functions convert from internal int_function | | // 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); | | bool incUninstrumentable = false); | |
| void sieveFunctionsInImage(image *img, | | void sieveFunctionsInImage(image *img, | |
| BPatch_Vector<BPatch_function *> *funcs, | | BPatch_Vector<BPatch_function *> *funcs, | |
| BPatchFunctionNameSieve bpsieve, | | BPatchFunctionNameSieve bpsieve, | |
| void *user_data, | | void *user_data, | |
| bool incUninstrumentable = false); | | bool incUninstrumentable = false); | |
| | | | |
| | | | |
End of changes. 18 change blocks. |
| 43 lines changed or deleted | | 58 lines changed or added | |
|
| BPatch_module.h | | BPatch_module.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 38 | | 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_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_eventLock.h" | |
|
| #include "BPatch_hybridAnalysis.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; | |
| | | | |
|
| class process; | | | |
| class BPatch_image; | | class BPatch_image; | |
| class BPatch_function; | | class BPatch_function; | |
| class BPatch_typeCollection; | | class BPatch_typeCollection; | |
| class BPatch_builtInTypeCollection; | | class BPatch_builtInTypeCollection; | |
| class BPatch_addressSpace; | | class BPatch_addressSpace; | |
| class BPatch_process; | | class BPatch_process; | |
| class BPatch_statement; | | class BPatch_statement; | |
|
| class int_function; | | class func_instance; | |
| class int_variable; | | class int_variable; | |
| class instPoint; | | class instPoint; | |
| class AddressSpace; | | class AddressSpace; | |
| class BPatch_snippet; | | class BPatch_snippet; | |
| class BPatchSnippetHandle; | | class BPatchSnippetHandle; | |
|
| | | class BPatch_module; | |
| | | | |
|
| namespace Dyninst { namespace ParseAPI { class CodeObject; }} | | namespace Dyninst { | |
| | | namespace ParseAPI { | |
| | | class CodeObject; | |
| | | CodeObject *convert(const BPatch_module *); | |
| | | } | |
| | | namespace PatchAPI { | |
| | | class PatchObject; | |
| | | PatchObject *convert(const BPatch_module *); | |
| | | class PatchFunction; | |
| | | class Point; | |
| | | } | |
| | | namespace SymtabAPI { | |
| | | class Symtab; | |
| | | Symtab *convert(const BPatch_module *); | |
| | | } | |
| | | } | |
| | | | |
| extern BPatch_builtInTypeCollection * builtInTypes; | | extern BPatch_builtInTypeCollection * builtInTypes; | |
| | | | |
| #ifdef DYNINST_CLASS_NAME | | #ifdef DYNINST_CLASS_NAME | |
| #undef DYNINST_CLASS_NAME | | #undef DYNINST_CLASS_NAME | |
| #endif | | #endif | |
| #define DYNINST_CLASS_NAME BPatch_module | | #define DYNINST_CLASS_NAME BPatch_module | |
| | | | |
| class BPATCH_DLL_EXPORT BPatch_module: public BPatch_sourceObj, public BPat
ch_eventLock{ | | class BPATCH_DLL_EXPORT BPatch_module: public BPatch_sourceObj, public BPat
ch_eventLock{ | |
| | | | |
|
| friend class process; | | | |
| 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; | |
|
| | | friend Dyninst::ParseAPI::CodeObject *Dyninst::ParseAPI::convert(const | |
| | | BPatch_module *); | |
| | | friend Dyninst::PatchAPI::PatchObject *Dyninst::PatchAPI::convert(const | |
| | | BPatch_module *); | |
| | | friend Dyninst::SymtabAPI::Symtab *Dyninst::SymtabAPI::convert(const BP | |
| | | atch_module *); | |
| | | | |
|
| typedef std::map<int_function*, BPatch_function*> BPatch_funcMap; | | typedef std::map<Dyninst::PatchAPI::PatchFunction*, | |
| | | BPatch_function*> BPatch_funcMap; | |
| typedef std::map<int_variable*, BPatch_variableExpr*> BPatch_varMap; | | typedef std::map<int_variable*, BPatch_variableExpr*> BPatch_varMap; | |
|
| typedef std::map<instPoint*, BPatch_point*> BPatch_instpMap; | | typedef std::map<Dyninst::PatchAPI::Point *, | |
| | | BPatch_point*> BPatch_instpMap; | |
| | | | |
| BPatch_addressSpace *addSpace; | | BPatch_addressSpace *addSpace; | |
| AddressSpace *lladdSpace; | | AddressSpace *lladdSpace; | |
| mapped_module *mod; | | mapped_module *mod; | |
| BPatch_image *img; | | BPatch_image *img; | |
| AddressSpace *getAS(); | | AddressSpace *getAS(); | |
| | | | |
| public: | | public: | |
| | | | |
| // This function should go away when paradyn is on top of dyninst | | // This function should go away when paradyn is on top of dyninst | |
| | | | |
| skipping to change at line 113 | | skipping to change at line 131 | |
| mapped_module *_mod, | | mapped_module *_mod, | |
| BPatch_image *img); | | BPatch_image *img); | |
| virtual ~BPatch_module(); | | virtual ~BPatch_module(); | |
| bool getSourceObj(BPatch_Vector<BPatch_sourceObj *>&); | | bool getSourceObj(BPatch_Vector<BPatch_sourceObj *>&); | |
| BPatch_sourceObj *getObjParent(); | | BPatch_sourceObj *getObjParent(); | |
| void parseTypes(); | | void parseTypes(); | |
| char *parseStabStringSymbol(int line, char *stabstr, void *stabptr); | | char *parseStabStringSymbol(int line, char *stabstr, void *stabptr); | |
| void setDefaultNamespacePrefix(char *name); | | void setDefaultNamespacePrefix(char *name); | |
| 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 protectAnalyzedCode();// pages that have analyzed code become read
-only | | bool setAnalyzedCodeWriteable(bool writeable);//sets write perm's analy
zed code pages | |
| bool isSystemLib(); | | bool isSystemLib(); | |
|
| | | bool remove(BPatch_function*); | |
| | | 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), | | 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 | |
| | | | |
| skipping to change at line 172 | | skipping to change at line 192 | |
| // 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), | | 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)); | |
| | | | |
|
| // FIXME: This (undocumented) method only works for function entry addr | | // BPatch_addressSpace::findFunctionByEntry | |
| esses. | | // Returns the function starting at the given address | |
| | | API_EXPORT(Int, (entry), | |
| | | BPatch_function *,findFunctionByEntry,(Dyninst::Address entry)); | |
| | | | |
| | | // FIXME: This method is (undocumented) | |
| API_EXPORT(Int, (addr, funcs, notify_on_failure, incUninstrumentable), | | 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, ()); | | API_EXPORT(Int, (), 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), | | 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 | |
| | | // | |
| | | // 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 | |
| | | // if there is not overlapping code. | |
| | | API_EXPORT(Int, (addr, points), | |
| | | bool, findPoints, (Dyninst::Address addr, std::vector<BPatch_point *> & | |
| | | 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), | | 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, (), | | API_EXPORT(Int, (), | |
| | | | |
| | | | |
| skipping to change at line 292 | | skipping to change at line 325 | |
| 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, (), | | API_EXPORT(Int, (), | |
| std::vector<struct BPatch_module::Statement>, getStatements, ()); | | std::vector<struct BPatch_module::Statement>, getStatements, ()); | |
| #endif | | #endif | |
| | | | |
|
| // Tentative ParseAPI exposure | | | |
| API_EXPORT(Int, (), | | | |
| Dyninst::ParseAPI::CodeObject *, getCodeObject, ()); | | | |
| | | | |
| 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(); | |
| void parseDwarfTypes(); | | void parseDwarfTypes(); | |
| | | | |
| | | | |
End of changes. 17 change blocks. |
| 25 lines changed or deleted | | 59 lines changed or added | |
|
| BPatch_point.h | | BPatch_point.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 38 | | 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_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_eventLock.h" | |
|
| #include "BPatch_snippet.h" // snippetOrder | | | |
| #include "BPatch_Set.h" | | #include "BPatch_Set.h" | |
|
| | | #include "BPatch_enums.h" | |
| | | | |
| class InstrucIter; | | class InstrucIter; | |
|
| class process; | | | |
| 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; | |
| class BPatchSnippetHandle; | | class BPatchSnippetHandle; | |
| class BPatch_basicBlockLoop; | | class BPatch_basicBlockLoop; | |
|
| | | class BPatch_point; | |
| class BPatch_process; | | class BPatch_process; | |
| class BPatch_frame; | | class BPatch_frame; | |
| class BPatch_edge; | | class BPatch_edge; | |
|
| | | class BPatch_snippet; | |
| | | class BPatch_addressSpace; | |
| | | class AddressSpace; | |
| | | class BPatch_register; | |
| | | | |
| #include "Instruction.h" | | #include "Instruction.h" | |
| | | | |
|
| /* | | namespace Dyninst { | |
| * Used to specify whether a snippet is to be called before the instruction | | namespace PatchAPI { | |
| s | | class Instance; | |
| * at the point where it is inserted, or after. | | class Point; | |
| */ | | typedef boost::shared_ptr<Instance> InstancePtr; | |
| typedef enum { | | Point *convert(const BPatch_point *, BPatch_callWhen); | |
| BPatch_callBefore, | | } | |
| BPatch_callAfter, | | } | |
| BPatch_callUnset | | | |
| } BPatch_callWhen; | | | |
| | | | |
| /* | | /* | |
| * Provide these definitions for backwards compatability. | | * Provide these definitions for backwards compatability. | |
| * | | * | |
| */ | | */ | |
| #define BPatch_entry BPatch_locEntry | | #define BPatch_entry BPatch_locEntry | |
| #define BPatch_exit BPatch_locExit | | #define BPatch_exit BPatch_locExit | |
| #define BPatch_subroutine BPatch_locSubroutine | | #define BPatch_subroutine BPatch_locSubroutine | |
| #define BPatch_longJump BPatch_locLongJump | | #define BPatch_longJump BPatch_locLongJump | |
| #define BPatch_allLocations BPatch_locAllLocations | | #define BPatch_allLocations BPatch_locAllLocations | |
| /* #define BPatch_instruction BPatch_locInstruction */ | | /* #define BPatch_instruction BPatch_locInstruction */ | |
| #define BPatch_arbitrary BPatch_locInstruction | | #define BPatch_arbitrary BPatch_locInstruction | |
| | | | |
| #if defined (IBM_BPATCH_COMPAT) | | #if defined (IBM_BPATCH_COMPAT) | |
| #define BPatch_locBasicBlockLoopEntry BPatch_locLoopEntry | | #define BPatch_locBasicBlockLoopEntry BPatch_locLoopEntry | |
| #define BPatch_locBasicBlockLoopExit BPatch_locLoopExit | | #define BPatch_locBasicBlockLoopExit BPatch_locLoopExit | |
| #endif | | #endif | |
|
| /* | | | |
| * Used with BPatch_function::findPoint to specify which of the possible | | | |
| * instrumentation points within a procedure should be returned. | | | |
| */ | | | |
| typedef enum eBPatch_procedureLocation { | | | |
| BPatch_locEntry, | | | |
| BPatch_locExit, | | | |
| BPatch_locSubroutine, | | | |
| BPatch_locLongJump, | | | |
| BPatch_locAllLocations, | | | |
| BPatch_locInstruction, | | | |
| BPatch_locUnknownLocation, | | | |
| 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_locLoopEntry, | | | |
| BPatch_locLoopExit, | | | |
| BPatch_locLoopStartIter, | | | |
| BPatch_locLoopEndIter, | | | |
| BPatch_locVarInitStart, // not yet used | | | |
| BPatch_locVarInitEnd, // not yet used | | | |
| BPatch_locStatement // not yet used | | | |
| } BPatch_procedureLocation; | | | |
| | | | |
| /* VG (09/07/01) Created */ | | | |
| | | | |
| typedef enum BPatch_opCode { | | | |
| BPatch_opLoad, | | | |
| BPatch_opStore, | | | |
| BPatch_opPrefetch | | | |
| } BPatch_opCode; | | | |
| | | | |
| /* 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 | | #ifdef DYNINST_CLASS_NAME | |
| #undef DYNINST_CLASS_NAME | | #undef DYNINST_CLASS_NAME | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 140 | | skipping to change at line 107 | |
| class BPATCH_DLL_EXPORT BPatch_point : public BPatch_eventLock { | | 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 process; | | | |
| friend class BPatch_edge; | | friend class BPatch_edge; | |
| friend class BPatch_snippet; | | friend class BPatch_snippet; | |
|
| | | friend Dyninst::PatchAPI::Point *Dyninst::PatchAPI::convert(const BPatc
h_point *, BPatch_callWhen); | |
| | | | |
|
| static BPatch_point* createInstructionInstPoint(//BPatch_process *proc, | | private: | |
| BPatch_addressSpace *ad | | | |
| dSpace, | | | |
| void*address, | | | |
| BPatch_function* bpf = | | | |
| NULL); | | | |
| // Create a set of points, all that match a given op in the given instr | | | |
| uciter. | | | |
| | | | |
| static BPatch_Vector<BPatch_point *> *getPoints(const BPatch_Set<BPatch | | | |
| _opCode> &ops, | | | |
| InstrucIter &ii, | | | |
| BPatch_function *bpf); | | | |
| | | | |
| BPatch_addressSpace *addSpace; | | BPatch_addressSpace *addSpace; | |
| AddressSpace *lladdSpace; | | AddressSpace *lladdSpace; | |
| BPatch_function *func; | | BPatch_function *func; | |
| BPatch_basicBlockLoop *loop; | | BPatch_basicBlockLoop *loop; | |
|
| | | | |
| | | // We have a disconnect between how BPatch represents a point | |
| | | // (e.g., an instruction) and how the internals represent a point | |
| | | // (e.g., pre-instruction). We handle this here with a secondary | |
| | | // instPoint that is defined to be the "after" equivalent. | |
| instPoint *point; | | instPoint *point; | |
|
| | | 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, BPatch_procedureLocation _pointType, | | instPoint *_point, instPoint *_secondary, | |
| | | 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, | |
| // and later need to override it to a specific type (e.g., loop entry) | | // and later need to override it to a specific type (e.g., loop entry) | |
| void overrideType(BPatch_procedureLocation loc) { pointType = loc; } | | void overrideType(BPatch_procedureLocation loc) { pointType = loc; } | |
| | | | |
|
| // dynamic_call_site_flag: | | | |
| // 0: is not dynamic call site | | | |
| // 1: is dynamic call site | | | |
| // 2: dynamic status unknown (initial value) | | | |
| int dynamic_call_site_flag; | | | |
| | | | |
| // a snippet used in monitoring of dynamic calls | | // a snippet used in monitoring of dynamic calls | |
| // maybe we want BPatchSnippetHandle here | | // maybe we want BPatchSnippetHandle here | |
|
| miniTramp *dynamic_point_monitor_func; | | Dyninst::PatchAPI::InstancePtr dynamic_point_monitor_func; | |
| | | | |
|
| instPoint * getPoint() {return point;} | | instPoint *getPoint() const {return point;} | |
| | | instPoint *getPoint(BPatch_callWhen when) const; | |
| BPatch_Vector<BPatchSnippetHandle *> preSnippets; | | | |
| BPatch_Vector<BPatchSnippetHandle *> postSnippets; | | | |
| BPatch_Vector<BPatchSnippetHandle *> allSnippets; | | | |
| | | | |
| // If we're edge inst | | // If we're edge inst | |
| BPatch_edge *edge_; | | BPatch_edge *edge_; | |
| | | | |
| void recordSnippet(BPatch_callWhen, BPatch_snippetOrder, | | void recordSnippet(BPatch_callWhen, BPatch_snippetOrder, | |
| BPatchSnippetHandle*); | | BPatchSnippetHandle*); | |
|
| bool deleteSnippet(BPatchSnippetHandle* handle); | | bool removeSnippet(BPatchSnippetHandle* handle); | |
| | | | |
| void attachMemAcc(BPatch_memoryAccess *memacc); | | void attachMemAcc(BPatch_memoryAccess *memacc); | |
| | | | |
| AddressSpace *getAS(); | | AddressSpace *getAS(); | |
| | | | |
|
| | | private: | |
| | | #if defined(_MSC_VER) | |
| | | #pragma warning(push) | |
| | | #pragma warning(disable:4251) | |
| | | #endif | |
| | | // Disable warning that these vectors cannot be used externally, | |
| | | // which is irrelevant since the vectors are private | |
| | | BPatch_Vector<BPatchSnippetHandle *> preSnippets; | |
| | | BPatch_Vector<BPatchSnippetHandle *> postSnippets; | |
| | | BPatch_Vector<BPatchSnippetHandle *> allSnippets; | |
| | | #if defined(_MSC_VER) | |
| | | #pragma warning(pop) | |
| | | #endif | |
| | | | |
| public: | | public: | |
| //~BPatch_point() { delete memacc; }; | | //~BPatch_point() { delete memacc; }; | |
| | | | |
| // Internal functions, DO NOT USE. | | // Internal functions, DO NOT USE. | |
| // Hack to get edge information. DO NOT USE. | | // Hack to get edge information. DO NOT USE. | |
|
| const 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; } | |
|
| bool getCFTargets(BPatch_Vector<Dyninst::Address> &targets); | | | |
| Dyninst::Address getCallFallThroughAddr(); | | Dyninst::Address getCallFallThroughAddr(); | |
|
| void setResolved(); | | bool patchPostCallArea(); | |
| Dyninst::Address getSavedTarget(); | | | |
| // End internal functions | | // End internal functions | |
| | | | |
| //Added for DynC... | | //Added for DynC... | |
| API_EXPORT(Int, (), | | API_EXPORT(Int, (), | |
| | | | |
| BPatch_addressSpace *, getAddressSpace, ()); | | BPatch_addressSpace *, getAddressSpace, ()); | |
| | | | |
| // Get the loop ID | | // Get the loop ID | |
| API_EXPORT(Int, (), | | API_EXPORT(Int, (), | |
| | | | |
| | | | |
End of changes. 23 change blocks. |
| 86 lines changed or deleted | | 50 lines changed or added | |
|
| BPatch_process.h | | BPatch_process.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 38 | | 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_eventLock.h" | |
|
| #include "BPatch_point.h" | | | |
| #include "BPatch_addressSpace.h" | | #include "BPatch_addressSpace.h" | |
|
| #include "BPatch_hybridAnalysis.h" | | #include "BPatch_enums.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 process; | | class PCProcess; | |
| class AddressSpace; | | class AddressSpace; | |
|
| class dyn_thread; | | 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_funcMap; | | class BPatch_funcMap; | |
| class BPatch_instpMap; | | class BPatch_instpMap; | |
|
| class int_function; | | class func_instance; | |
| class rpcMgr; | | class rpcMgr; | |
| class HybridAnalysis; | | class HybridAnalysis; | |
| struct batchInsertionRecord; | | struct batchInsertionRecord; | |
| | | | |
| typedef enum { | | typedef enum { | |
| BPatch_nullEvent, | | BPatch_nullEvent, | |
| BPatch_newConnectionEvent, | | BPatch_newConnectionEvent, | |
| BPatch_internalShutDownEvent, | | BPatch_internalShutDownEvent, | |
| BPatch_threadCreateEvent, | | BPatch_threadCreateEvent, | |
| BPatch_threadDestroyEvent, | | BPatch_threadDestroyEvent, | |
| | | | |
| skipping to change at line 84 | | skipping to change at line 83 | |
| BPatch_errorEvent, | | BPatch_errorEvent, | |
| BPatch_dynLibraryEvent, | | BPatch_dynLibraryEvent, | |
| BPatch_preForkEvent, | | BPatch_preForkEvent, | |
| BPatch_postForkEvent, | | BPatch_postForkEvent, | |
| BPatch_execEvent, | | BPatch_execEvent, | |
| BPatch_exitEvent, | | BPatch_exitEvent, | |
| BPatch_signalEvent, | | BPatch_signalEvent, | |
| BPatch_oneTimeCodeEvent | | BPatch_oneTimeCodeEvent | |
| } BPatch_asyncEventType; | | } BPatch_asyncEventType; | |
| | | | |
|
| typedef long dynthread_t; | | typedef Dyninst::THR_ID dynthread_t; | |
| | | | |
| typedef struct { | | typedef struct { | |
| BPatch_snippet snip; | | BPatch_snippet snip; | |
| BPatchSnippetHandle *sh; | | BPatchSnippetHandle *sh; | |
| BPatch_thread *thread; | | BPatch_thread *thread; | |
| } BPatch_catchupInfo; | | } BPatch_catchupInfo; | |
| | | | |
|
| class EventRecord; | | | |
| class OneTimeCodeCallback; | | | |
| /* | | /* | |
| * 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; | |
|
| OneTimeCodeCallback *cb; | | BPatchOneTimeCodeCallback cb; | |
| void *returnValue; | | void *returnValue; | |
| unsigned thrID; | | unsigned thrID; | |
| public: | | public: | |
|
| OneTimeCodeInfo(bool _synchronous, void *_userData, OneTimeCodeCallback
*_cb, unsigned _thrID) : | | OneTimeCodeInfo(bool _synchronous, void *_userData, BPatchOneTimeCodeCal
lback _cb, unsigned _thrID) : | |
| synchronous(_synchronous), completed(false), userData(_userData), cb(
_cb), | | synchronous(_synchronous), completed(false), userData(_userData), 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; } | |
| | | | |
|
| OneTimeCodeCallback *getCallback() { return cb;} | | BPatchOneTimeCodeCallback getCallback() { return cb;} | |
| | | | |
| }; | | }; | |
| | | | |
| /* | | /* | |
| * Represents a process | | * Represents a process | |
| */ | | */ | |
| #ifdef DYNINST_CLASS_NAME | | #ifdef DYNINST_CLASS_NAME | |
| #undef DYNINST_CLASS_NAME | | #undef DYNINST_CLASS_NAME | |
| #endif | | #endif | |
| #define DYNINST_CLASS_NAME BPatch_process | | #define DYNINST_CLASS_NAME BPatch_process | |
| | | | |
| skipping to change at line 151 | | skipping to change at line 148 | |
| 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 process; | | | |
| friend class SignalHandler; | | | |
| friend int handleSignal(EventRecord &ev); | | | |
| friend void threadDeleteWrapper(BPatch_process *, BPatch_thread *); | | | |
| friend bool pollForStatusChange(); | | | |
| friend class AsyncThreadEventCallback; | | | |
| 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 rpcMgr; | | friend class PCEventHandler; // to deliver events for callbacks | |
| friend class EventRecord; | | | |
| friend bool handleThreadCreate(process *, EventRecord &, unsigned, int, | | | |
| dynthread_t, unsigned long, unsigned long); | | | |
| | | | |
| 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 | |
|
| process *llproc; | | PCProcess *llproc; | |
| | | | |
| BPatch_Vector<BPatch_thread *> threads; | | BPatch_Vector<BPatch_thread *> threads; | |
| | | | |
|
| // Due to interactions of internal events and signal handling, | | | |
| // we need to keep an internal variable of whether the user | | | |
| // should observe us as stopped. This is set by internal | | | |
| // code if a "stop" is a real stop. | | | |
| bool isVisiblyStopped; | | | |
| bool isAttemptingAStop; | | | |
| | | | |
| 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; | |
| | | | |
|
| bool unreportedStop; | | | |
| bool unreportedTermination; | | | |
| | | | |
| // BPatch-level; once the callbacks are sent by the llproc, we're termi
nated | | // BPatch-level; once the callbacks are sent by the llproc, we're termi
nated | |
| // Used because callbacks go (and can clean up user code) before the lo
w-level process | | // Used because callbacks go (and can clean up user code) before the lo
w-level process | |
| // sets flags. | | // sets flags. | |
| bool terminated; | | bool terminated; | |
| bool reportedExit; | | bool reportedExit; | |
| | | | |
|
| //When an async RPC is posted on a stopped process we post it, but have | | | |
| n't | | | |
| // yet launched it. The next process level continue should start the R | | | |
| PC | | | |
| // going. unstarteRPC is true if we have a posted but not launced RPC. | | | |
| bool unstartedRPC; | | | |
| | | | |
| void setUnreportedStop(bool new_value) { unreportedStop = new_value; } | | | |
| void setUnreportedTermination(bool new_value) {unreportedTermination = | | | |
| new_value;} | | | |
| | | | |
| 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 pendingUnreportedStop() { return unreportedStop;} | | | |
| bool pendingUnreportedTermination() { return unreportedTermination; } | | | |
| | | | |
| bool statusIsStopped(); | | | |
| bool statusIsTerminated(); | | bool statusIsTerminated(); | |
| | | | |
|
| | | 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;} | |
| | | | |
|
| int activeOneTimeCodes_; | | | |
| bool resumeAfterCompleted_; | | | |
| | | | |
| HybridAnalysis *hybridAnalysis_; | | HybridAnalysis *hybridAnalysis_; | |
| | | | |
|
| static int oneTimeCodeCallbackDispatch(process *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
e | | BPatch_thread *thread, // == NULL if proc-wid
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); | |
| void oneTimeCodeCompleted(bool isSynchronous); | | | |
| | | | |
| 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(process *proc); | | BPatch_process(PCProcess *proc); | |
| | | | |
|
| // Create a new thread in this proc | | void triggerThreadCreate(PCThread *thread); | |
| BPatch_thread *createOrUpdateBPThread(int lwp, dynthread_t tid, unsigne | | void triggerInitialThreadEvents(); | |
| d index, | | | |
| unsigned long stack_start, | | | |
| unsigned long start_addr); | | | |
| BPatch_thread *handleThreadCreate(unsigned index, int lwpid, dynthread_ | | | |
| t threadid, | | | |
| unsigned long stack_top, unsigned long start_pc | | | |
| , process *proc = NULL); | | | |
| void deleteBPThread(BPatch_thread *thrd); | | void deleteBPThread(BPatch_thread *thrd); | |
| | | | |
|
| bool updateThreadInfo(); | | | |
| | | | |
| 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 Dynins
t | | // this function should go away as soon as Paradyn links against Dynins
t | |
|
| process *lowlevel_process() { return llproc; } | | PCProcess *lowlevel_process() const { return llproc; } | |
| // These internal funcs trigger callbacks registered to matching events | | // These internal funcs trigger callbacks registered to matching events | |
|
| bool triggerStopThread(instPoint *intPoint, int_function *intFunc, | | bool triggerStopThread(instPoint *intPoint, func_instance *intFunc, | |
| int cb_ID, void *retVal); | | int cb_ID, void *retVal); | |
|
| bool triggerSignalHandlerCB(instPoint *point, int_function *func, long
signum, | | bool triggerSignalHandlerCB(instPoint *point, func_instance *func, long
signum, | |
| BPatch_Vector<Dyninst::Address> *handlers); | | BPatch_Vector<Dyninst::Address> *handlers); | |
|
| bool triggerCodeOverwriteCB(Dyninst::Address fault_instruc, | | bool triggerCodeOverwriteCB(instPoint * faultPoint, | |
| Dyninst::Address viol_target); | | Dyninst::Address faultTarget); | |
| bool setMemoryAccessRights(Dyninst::Address start, Dyninst::Address siz
e, | | bool setMemoryAccessRights(Dyninst::Address start, Dyninst::Address siz
e, | |
| int rights); | | int rights); | |
| unsigned char *makeShadowPage(Dyninst::Address pageAddress); | | unsigned char *makeShadowPage(Dyninst::Address pageAddress); | |
| void overwriteAnalysisUpdate | | void overwriteAnalysisUpdate | |
| ( std::map<Dyninst::Address,unsigned char*>& owPages, //input | | ( std::map<Dyninst::Address,unsigned char*>& owPages, //input | |
|
| std::vector<Dyninst::Address>& deadBlockAddrs, //output | | std::vector<std::pair<Dyninst::Address,int> >& deadBlocks, //outp
ut | |
| std::vector<BPatch_function*>& owFuncs, //output | | std::vector<BPatch_function*>& owFuncs, //output | |
|
| | | std::set<BPatch_function *> &monitorFuncs, //output | |
| bool &changedPages, bool &changedCode ); //output | | bool &changedPages, bool &changedCode ); //output | |
|
| // take a function and split off the blocks that correspond to the rang | | | |
| e | | | |
| bool removeFunctionSubRange | | | |
| (BPatch_function &curFunc, | | | |
| Dyninst::Address startAddr, | | | |
| Dyninst::Address endAddr, | | | |
| std::vector<Dyninst::Address> &blockAddrs); | | | |
| HybridAnalysis *getHybridAnalysis() { return hybridAnalysis_; } | | HybridAnalysis *getHybridAnalysis() { return hybridAnalysis_; } | |
| bool protectAnalyzedCode(); | | bool protectAnalyzedCode(); | |
| // DO NOT USE | | // DO NOT USE | |
| // This is an internal debugging function | | // This is an internal debugging function | |
| API_EXPORT_V(Int, (), | | API_EXPORT_V(Int, (), | |
| void, debugSuicide,()); | | void, debugSuicide,()); | |
| // | | // | |
| // End internal functions | | // End internal functions | |
| | | | |
| // BPatch_process::~BPatch_process | | // BPatch_process::~BPatch_process | |
| | | | |
| skipping to change at line 450 | | skipping to change at line 404 | |
| API_EXPORT(Int, (file, terminate), | | API_EXPORT(Int, (file, terminate), | |
| bool,dumpCore,(const char *file, bool terminate)); | | bool,dumpCore,(const char *file, bool terminate)); | |
| | | | |
| // BPatch_process::dumpImage | | // BPatch_process::dumpImage | |
| // | | // | |
| // Write contents of memory to <file> | | // Write contents of memory to <file> | |
| | | | |
| API_EXPORT(Int, (file), | | API_EXPORT(Int, (file), | |
| bool,dumpImage,(const char *file)); | | bool,dumpImage,(const char *file)); | |
| | | | |
|
| // BPatch_process::dumpPatchedImage | | | |
| // | | | |
| // Write executable image of mutatee, including runtime modifications, | | | |
| to <file> | | | |
| | | | |
| API_EXPORT(Int, (file), | | | |
| char *,dumpPatchedImage,(const char* file)); | | | |
| | | | |
| // BPatch_process::getInheritedVariable | | // BPatch_process::getInheritedVariable | |
| // | | // | |
| // | | // | |
| | | | |
| API_EXPORT(Int, (pVar), | | API_EXPORT(Int, (pVar), | |
| BPatch_variableExpr *,getInheritedVariable,(BPatch_variableExpr &pVar))
; | | BPatch_variableExpr *,getInheritedVariable,(BPatch_variableExpr &pVar))
; | |
| | | | |
| // BPatch_process::getInheritedSnippet | | // BPatch_process::getInheritedSnippet | |
| // | | // | |
| // | | // | |
| | | | |
| skipping to change at line 545 | | skipping to change at line 492 | |
| // The other thing this method does is clear the 0xabababababababab val
ue that | | // 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 | | // 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 | | // 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 | | // sets to true for debugged processes. We are clearing that flag, but
by the | |
| // time we do, the value is already written to disk. | | // time we do, the value is already written to disk. | |
| // | | // | |
| // Various system calls can still be used by the debuggee to recognize
that | | // Various system calls can still be used by the debuggee to recognize
that | |
| // it is being debugged, so this is not a complete solution. | | // it is being debugged, so this is not a complete solution. | |
| API_EXPORT(Int, (), | | API_EXPORT(Int, (), | |
| bool,hideDebugger,()); | | bool,hideDebugger,()); | |
|
| | | #if 0 | |
| | | API_EXPORT_V(Int, (), | |
| | | void, printDefensiveStats, ()); | |
| | | #endif | |
| // BPatch_process::enableDumpPatchedImage | | // BPatch_process::enableDumpPatchedImage | |
| // | | // | |
| // | | // | |
| API_EXPORT_V(Int, (), | | API_EXPORT_V(Int, (), | |
| void,enableDumpPatchedImage,()); | | void,enableDumpPatchedImage,()); | |
| | | | |
| #ifdef IBM_BPATCH_COMPAT | | #ifdef IBM_BPATCH_COMPAT | |
| API_EXPORT(Int, (name, loadaddr), | | 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), | | API_EXPORT_VIRT(Int, (libname, reload), | |
|
| bool, loadLibrary,(const char *libname, bool reload = false)); | | BPatch_module *, loadLibrary,(const char *libname, bool reload = false)
); | |
| | | | |
| }; | | }; | |
| | | | |
| #endif /* BPatch_process_h_ */ | | #endif /* BPatch_process_h_ */ | |
| | | | |
End of changes. 38 change blocks. |
| 97 lines changed or deleted | | 38 lines changed or added | |
|
| BPatch_snippet.h | | BPatch_snippet.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 45 | | skipping to change at line 44 | |
| #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_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 "dyn_detail/boost/shared_ptr.hpp" | | #include "BPatch_enums.h" | |
| | | #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; | |
| | | | |
|
| namespace dyn_detail | | typedef boost::shared_ptr<AstNode> AstNodePtr; | |
| { | | | |
| namespace boost { | | namespace boost { | |
|
| template< typename T > class shared_ptr; | | template< typename T > class shared_ptr; | |
| template<> class shared_ptr<AstNode *>; | | template<> class shared_ptr<AstNode *>; | |
| } | | | |
| } | | } | |
| | | | |
|
| typedef dyn_detail::boost::shared_ptr<AstNode> AstNodePtr; | | namespace Dyninst { | |
| | | namespace PatchAPI { | |
| | | class Snippet; | |
| | | typedef boost::shared_ptr<Snippet> SnippetPtr; | |
| | | SnippetPtr convert(const BPatch_snippet *); | |
| | | } | |
| | | } | |
| | | | |
| class AstNode; | | class AstNode; | |
|
| class process; | | | |
| class BPatch_process; | | class BPatch_process; | |
| class BPatch_function; | | class BPatch_function; | |
| class BPatch_point; | | class BPatch_point; | |
| class BPatch_addressSpace; | | class BPatch_addressSpace; | |
| class int_variable; | | class int_variable; | |
|
| | | class mapped_object; | |
| /* | | | |
| * Used to specify whether a snippet should be installed before other snipp | | | |
| ets | | | |
| * that have previously been inserted at the same point, or after. | | | |
| */ | | | |
| typedef enum { | | | |
| BPatch_firstSnippet, | | | |
| BPatch_lastSnippet | | | |
| } BPatch_snippetOrder; | | | |
| | | | |
| typedef enum { | | typedef enum { | |
| BPatch_lt, | | BPatch_lt, | |
| BPatch_eq, | | BPatch_eq, | |
| BPatch_gt, | | BPatch_gt, | |
| BPatch_le, | | BPatch_le, | |
| BPatch_ne, | | BPatch_ne, | |
| BPatch_ge, | | BPatch_ge, | |
| BPatch_and, | | BPatch_and, | |
| BPatch_or | | BPatch_or | |
| | | | |
| skipping to change at line 125 | | skipping to change at line 121 | |
| BPatch_deref | | BPatch_deref | |
| #endif | | #endif | |
| } BPatch_unOp; | | } BPatch_unOp; | |
| | | | |
| #ifdef DYNINST_CLASS_NAME | | #ifdef DYNINST_CLASS_NAME | |
| #undef DYNINST_CLASS_NAME | | #undef DYNINST_CLASS_NAME | |
| #endif | | #endif | |
| #define DYNINST_CLASS_NAME BPatch_snippet | | #define DYNINST_CLASS_NAME BPatch_snippet | |
| | | | |
| class BPATCH_DLL_EXPORT BPatch_snippet : public BPatch_eventLock { | | 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; | |
| friend class BPatch_ifMachineConditionExpr; | | friend class BPatch_ifMachineConditionExpr; | |
| friend class BPatch_sequence; | | friend class BPatch_sequence; | |
| friend class BPatch_insnExpr; | | friend class BPatch_insnExpr; | |
| friend class BPatch_stopThreadExpr; | | friend class BPatch_stopThreadExpr; | |
|
| | | friend class BPatch_shadowExpr; | |
| friend class BPatch_utilExpr; | | friend class BPatch_utilExpr; | |
| friend AstNodePtr generateArrayRef(const BPatch_snippet &lOperand, | | friend AstNodePtr generateArrayRef(const BPatch_snippet &lOperand, | |
| const BPatch_snippet &rOperand); | | const BPatch_snippet &rOperand); | |
| friend AstNodePtr generateFieldRef(const BPatch_snippet &lOperand, | | friend AstNodePtr generateFieldRef(const BPatch_snippet &lOperand, | |
| const BPatch_snippet &rOperand); | | const BPatch_snippet &rOperand); | |
| friend AstNodePtr generateVariableBase(const BPatch_snippet &lOperand); | | friend AstNodePtr generateVariableBase(const BPatch_snippet &lOperand); | |
|
| | | 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(AstNodePtr ast) {BPatch_snippet(); ast_wrapper = ast;} | |
| | | | |
| skipping to change at line 329 | | skipping to change at line 328 | |
| // 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), | | 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 | | #ifdef DYNINST_CLASS_NAME | |
| #undef DYNINST_CLASS_NAME | | #undef DYNINST_CLASS_NAME | |
| #endif | | #endif | |
|
| #define DYNINST_CLASS_NAME BPatch_funcJumpExpr | | | |
| | | | |
| class BPATCH_DLL_EXPORT BPatch_funcJumpExpr : public BPatch_snippet { | | | |
| | | | |
| // BPatch_funcJumpExpr::BPatch_funcJumpExpr | | | |
| // Creates a representation of a jump to a function without linkage | | | |
| private: | | | |
| API_EXPORT_CTOR(Int, (func, genCall), | | | |
| BPatch_funcJumpExpr,(const BPatch_function &func, bool g | | | |
| enCall)); | | | |
| public: | | | |
| API_EXPORT_CTOR(Int, (func), | | | |
| BPatch_funcJumpExpr,(const BPatch_function& func)); | | | |
| }; | | | |
| | | | |
| #ifdef DYNINST_CLASS_NAME | | | |
| #undef DYNINST_CLASS_NAME | | | |
| #endif | | | |
| #define DYNINST_CLASS_NAME BPatch_ifExpr | | #define DYNINST_CLASS_NAME BPatch_ifExpr | |
| | | | |
| class BPATCH_DLL_EXPORT BPatch_ifExpr : public BPatch_snippet { | | class BPATCH_DLL_EXPORT BPatch_ifExpr : public BPatch_snippet { | |
| | | | |
| // 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), | | 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)); | |
| | | | |
| | | | |
| skipping to change at line 385 | | skipping to change at line 367 | |
| BPatch_nullExpr,()); | | BPatch_nullExpr,()); | |
| | | | |
| }; | | }; | |
| | | | |
| #ifdef DYNINST_CLASS_NAME | | #ifdef DYNINST_CLASS_NAME | |
| #undef DYNINST_CLASS_NAME | | #undef DYNINST_CLASS_NAME | |
| #endif | | #endif | |
| #define DYNINST_CLASS_NAME BPatch_paramExpr | | #define DYNINST_CLASS_NAME BPatch_paramExpr | |
| | | | |
| class BPATCH_DLL_EXPORT BPatch_paramExpr : public BPatch_snippet { | | class BPATCH_DLL_EXPORT BPatch_paramExpr : public BPatch_snippet { | |
|
| | | | |
| // 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
) | |
|
| API_EXPORT_CTOR(Int, (n), | | // n is the index of the parameter that should be retrieved | |
| BPatch_paramExpr,(int n)); | | // loc indicates whether the parameter lookup will be added at the ca | |
| | | ll, | |
| | | // at the function's entry point, or whether Dyninst should guess | |
| | | // 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)); | |
| }; | | }; | |
| | | | |
| #ifdef DYNINST_CLASS_NAME | | #ifdef DYNINST_CLASS_NAME | |
| #undef DYNINST_CLASS_NAME | | #undef DYNINST_CLASS_NAME | |
| #endif | | #endif | |
| #define DYNINST_CLASS_NAME BPatch_retExpr | | #define DYNINST_CLASS_NAME BPatch_retExpr | |
| | | | |
| class BPATCH_DLL_EXPORT BPatch_retExpr : public BPatch_snippet { | | class BPATCH_DLL_EXPORT BPatch_retExpr : public BPatch_snippet { | |
| | | | |
| // 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, (), | | API_EXPORT_CTOR(Int, (), | |
| BPatch_retExpr,()); | | BPatch_retExpr,()); | |
| }; | | }; | |
| | | | |
| #ifdef DYNINST_CLASS_NAME | | #ifdef DYNINST_CLASS_NAME | |
| #undef DYNINST_CLASS_NAME | | #undef DYNINST_CLASS_NAME | |
| #endif | | #endif | |
|
| | | #define DYNINST_CLASS_NAME BPatch_retAddrExpr | |
| | | | |
| | | class BPATCH_DLL_EXPORT BPatch_retAddrExpr : public BPatch_snippet { | |
| | | | |
| | | // BPatch_retAddrExpr::BPatch_retAddrExpr | |
| | | // Represents the return address from the function in which the | |
| | | // snippet is inserted | |
| | | API_EXPORT_CTOR(Int, (), | |
| | | BPatch_retAddrExpr,()); | |
| | | }; | |
| | | | |
| | | #ifdef DYNINST_CLASS_NAME | |
| | | #undef DYNINST_CLASS_NAME | |
| | | #endif | |
| #define DYNINST_CLASS_NAME BPatch_registerExpr | | #define DYNINST_CLASS_NAME BPatch_registerExpr | |
| | | | |
| class BPATCH_DLL_EXPORT BPatch_registerExpr : public BPatch_snippet { | | class BPATCH_DLL_EXPORT BPatch_registerExpr : public BPatch_snippet { | |
| 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), | | API_EXPORT_CTOR(Int, (reg), | |
| BPatch_registerExpr, (BPatch_register reg)); | | BPatch_registerExpr, (BPatch_register reg)); | |
|
| | | API_EXPORT_CTOR(Int, (reg), | |
| | | BPatch_registerExpr, (Dyninst::MachRegister reg)); | |
| }; | | }; | |
| | | | |
| #ifdef DYNINST_CLASS_NAME | | #ifdef DYNINST_CLASS_NAME | |
| #undef DYNINST_CLASS_NAME | | #undef DYNINST_CLASS_NAME | |
| #endif | | #endif | |
| #define DYNINST_CLASS_NAME BPatch_sequence | | #define DYNINST_CLASS_NAME BPatch_sequence | |
| | | | |
| class BPATCH_DLL_EXPORT BPatch_sequence : public BPatch_snippet { | | class BPATCH_DLL_EXPORT BPatch_sequence : public BPatch_snippet { | |
| | | | |
| // BPatch_sequence::BPatch_sequence | | // BPatch_sequence::BPatch_sequence | |
| | | | |
| skipping to change at line 711 | | skipping to change at line 712 | |
| | | | |
| typedef enum { | | typedef enum { | |
| BPatch_noInterp, | | BPatch_noInterp, | |
| BPatch_interpAsTarget, | | BPatch_interpAsTarget, | |
| BPatch_interpAsReturnAddr, | | BPatch_interpAsReturnAddr, | |
| } BPatch_stInterpret; | | } BPatch_stInterpret; | |
| | | | |
| #ifdef DYNINST_CLASS_NAME | | #ifdef DYNINST_CLASS_NAME | |
| #undef DYNINST_CLASS_NAME | | #undef DYNINST_CLASS_NAME | |
| #endif | | #endif | |
|
| | | #define DYNINST_CLASS_NAME BPatch_shadowExpr | |
| | | | |
| | | class BPATCH_DLL_EXPORT BPatch_shadowExpr : public BPatch_snippet { | |
| | | | |
| | | // BPatch_stopThreadExpr | |
| | | // This snippet type stops the thread that executes it. It | |
| | | // evaluates a calculation snippet and triggers a callback to the | |
| | | // user program with the result of the calculation and a pointer to | |
| | | // the BPatch_point at which the snippet was inserted | |
| | | API_EXPORT_CTOR(Int, (entry, cb, calculation, useCache, interp), | |
| | | BPatch_shadowExpr, | |
| | | (bool entry, | |
| | | const BPatchStopThreadCallback &cb, | |
| | | const BPatch_snippet &calculation, | |
| | | bool useCache = false, | |
| | | BPatch_stInterpret interp = BPatch_noInterp)); | |
| | | }; | |
| | | | |
| | | #ifdef DYNINST_CLASS_NAME | |
| | | #undef DYNINST_CLASS_NAME | |
| | | #endif | |
| #define DYNINST_CLASS_NAME BPatch_stopThreadExpr | | #define DYNINST_CLASS_NAME BPatch_stopThreadExpr | |
| | | | |
| class BPATCH_DLL_EXPORT BPatch_stopThreadExpr : public BPatch_snippet { | | class BPATCH_DLL_EXPORT BPatch_stopThreadExpr : public BPatch_snippet { | |
| | | | |
| // 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), | | API_EXPORT_CTOR(Int, (cb, calculation, useCache, interp), | |
| BPatch_stopThreadExpr, | | BPatch_stopThreadExpr, | |
| (const BPatchStopThreadCallback &cb, | | (const BPatchStopThreadCallback &cb, | |
| const BPatch_snippet &calculation, | | const BPatch_snippet &calculation, | |
| bool useCache = false, | | bool useCache = false, | |
| BPatch_stInterpret interp = BPatch_noInterp)); | | BPatch_stInterpret interp = BPatch_noInterp)); | |
| | | | |
|
| | | // for internal use in conjunction with memory emulation and defensive | |
| | | // mode analysis | |
| | | BPatch_stopThreadExpr( | |
| | | const BPatchStopThreadCallback &cb, | |
| | | const BPatch_snippet &calculation, | |
| | | const mapped_object &obj, | |
| | | bool useCache = false, | |
| | | BPatch_stInterpret interp = BPatch_noInterp); | |
| }; | | }; | |
| | | | |
| #ifdef DYNINST_CLASS_NAME | | #ifdef DYNINST_CLASS_NAME | |
| #undef DYNINST_CLASS_NAME | | #undef DYNINST_CLASS_NAME | |
| #endif | | #endif | |
| #define DYNINST_CLASS_NAME BPatch_originalAddressExpr | | #define DYNINST_CLASS_NAME BPatch_originalAddressExpr | |
| | | | |
| class BPATCH_DLL_EXPORT BPatch_originalAddressExpr : public BPatch_snippet | | class BPATCH_DLL_EXPORT BPatch_originalAddressExpr : public BPatch_snippet | |
| { | | { | |
| | | | |
| | | | |
| skipping to change at line 778 | | skipping to change at line 807 | |
| { | | { | |
| | | | |
| // 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, (), | | 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 | |
| | | { | |
| | | | |
| | | // BPatch_scrambleRegistersExpr | |
| | | // Set all GPR to flag value. | |
| | | | |
| | | API_EXPORT_CTOR(Int, (), | |
| | | BPatch_scrambleRegistersExpr, ()); | |
| | | }; | |
| | | | |
| #endif /* _BPatch_snippet_h_ */ | | #endif /* _BPatch_snippet_h_ */ | |
| | | | |
End of changes. 21 change blocks. |
| 47 lines changed or deleted | | 92 lines changed or added | |
|
| BPatch_thread.h | | BPatch_thread.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 46 | | skipping to change at line 45 | |
| | | | |
| #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_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 process; | | 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 dyn_thread; | | class PCThread; | |
| | | | |
|
| typedef long dynthread_t; | | typedef Dyninst::THR_ID dynthread_t; | |
| | | | |
| /* | | /* | |
| * Represents a thread of execution. | | * Represents a thread of execution. | |
| */ | | */ | |
| #ifdef DYNINST_CLASS_NAME | | #ifdef DYNINST_CLASS_NAME | |
| #undef DYNINST_CLASS_NAME | | #undef DYNINST_CLASS_NAME | |
| #endif | | #endif | |
| #define DYNINST_CLASS_NAME BPatch_thread | | #define DYNINST_CLASS_NAME BPatch_thread | |
| | | | |
| class BPATCH_DLL_EXPORT BPatch_thread : public BPatch_eventLock { | | class BPATCH_DLL_EXPORT BPatch_thread : public BPatch_eventLock { | |
| 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; | |
|
| friend bool pollForStatusChange(); | | | |
| friend class BPatch_asyncEventHandler; | | | |
| friend class AsyncThreadEventCallback; | | | |
| friend class process; | | | |
| | | | |
| BPatch_process *proc; | | BPatch_process *proc; | |
|
| dyn_thread *llthread; | | PCThread *llthread; | |
| unsigned index; | | // Sometimes we get per-thread exit notifications, sometimes we | |
| bool updated; | | // just get whole-process. So keep track of whether we've notified | |
| bool doa; | | // the user of an exit so we don't duplicate when the process exits. | |
| bool reported_to_user; //Have we notified this user of thread creation | | bool madeExitCallback_; | |
| yet? | | | |
| // If thread is doa, keep a record of the tid around so that user | | | |
| // callbacks can get the right tid, even if they can't do anything els | | | |
| e | | | |
| // with it. | | | |
| dynthread_t doa_tid; | | | |
| bool deleted_callback_made; | | | |
| bool is_deleted; | | | |
| bool legacy_destructor; | | | |
| | | | |
| protected: | | protected: | |
|
| BPatch_thread(BPatch_process *parent, dyn_thread *dthr); | | BPatch_thread(BPatch_process *parent, PCThread *thr); | |
| BPatch_thread(BPatch_process *parent, int ind, int lwp_id, dynthread_t | | | |
| async_tid); | | | |
| | | | |
|
| void setDynThread(dyn_thread *thr); | | | |
| //Generator for above constructor | | //Generator for above constructor | |
|
| static BPatch_thread *createNewThread(BPatch_process *proc, int ind, | | static BPatch_thread *createNewThread(BPatch_process *proc, PCThread *t | |
| int lwp_id, dynthread_t async_tid | | hr); | |
| ); | | | |
| void deleteThread(bool cleanup = true); | | | |
| void removeThreadFromProc(); | | | |
| void updateValues(dynthread_t tid, unsigned long stack_start, | | | |
| BPatch_function *initial_func, int lwp_id); | | | |
| | | | |
|
| public: | | // Currently only used on an exec to replace the underlying PCThread | |
| | | void updateThread(PCThread *newThr); | |
| | | | |
| | | bool madeExitCallback() { return madeExitCallback_; } | |
| | | void setMadeExitCallback() { madeExitCallback_ = true; } | |
| | | | |
|
| void markVisiblyStopped(bool new_state); | | public: | |
| bool isVisiblyStopped(); | | | |
| | | | |
| // 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), | | 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, (), | | API_EXPORT(Int, (), | |
| BPatch_process *, getProcess, ()); | | BPatch_process *, getProcess, ()); | |
| | | | |
| API_EXPORT(Int, (), | | API_EXPORT(Int, (), | |
| dynthread_t, getTid, ()); | | dynthread_t, getTid, ()); | |
| | | | |
| API_EXPORT(Int, (), | | API_EXPORT(Int, (), | |
|
| int, getLWP, ()); | | Dyninst::LWP, getLWP, ()); | |
| | | | |
| API_EXPORT(Int, (), | | API_EXPORT(Int, (), | |
| unsigned, getBPatchID, ()); | | unsigned, getBPatchID, ()); | |
| | | | |
| API_EXPORT(Int, (), | | API_EXPORT(Int, (), | |
| BPatch_function *, getInitialFunc, ()); | | BPatch_function *, getInitialFunc, ()); | |
| | | | |
| API_EXPORT(Int, (), | | API_EXPORT(Int, (), | |
| unsigned long, getStackTopAddr, ()); | | unsigned long, getStackTopAddr, ()); | |
| | | | |
| | | | |
| skipping to change at line 148 | | skipping to change at line 132 | |
| | | | |
| // 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), | | 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), | | API_EXPORT(Int, (expr, userData, cb), | |
| bool,oneTimeCodeAsync,(const BPatch_snippet &expr, void *userData = NUL
L, BPatchOneTimeCodeCallback cb = NULL)); | | bool,oneTimeCodeAsync,(const BPatch_snippet &expr, void *userData = NUL
L, BPatchOneTimeCodeCallback cb = NULL)); | |
|
| | | | |
| /* | | | |
| // DO NOT USE | | | |
| // this function should go away as soon as Paradyn links against Dynins | | | |
| t | | | |
| process *lowlevel_process() { return proc->llproc; } | | | |
| */ | | | |
| | | | |
| }; | | }; | |
| | | | |
| #endif /* BPatch_thread_h_ */ | | #endif /* BPatch_thread_h_ */ | |
| | | | |
End of changes. 14 change blocks. |
| 51 lines changed or deleted | | 24 lines changed or added | |
|
| CFG.h | | CFG.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 44 | | skipping to change at line 43 | |
| #include <vector> | | #include <vector> | |
| #include <set> | | #include <set> | |
| #include <map> | | #include <map> | |
| #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> | |
| namespace Dyninst { | | namespace Dyninst { | |
| namespace ParseAPI { | | namespace ParseAPI { | |
| | | | |
|
| | | class CFGModifier; | |
| | | class CodeObject; | |
| | | | |
| enum EdgeTypeEnum { | | enum EdgeTypeEnum { | |
| CALL = 0, | | CALL = 0, | |
| COND_TAKEN, | | COND_TAKEN, | |
| COND_NOT_TAKEN, | | COND_NOT_TAKEN, | |
| INDIRECT, | | INDIRECT, | |
| DIRECT, | | DIRECT, | |
| FALLTHROUGH, | | FALLTHROUGH, | |
| CATCH, | | CATCH, | |
| CALL_FT, // fallthrough after call instruction | | CALL_FT, // fallthrough after call instruction | |
| RET, | | RET, | |
| NOEDGE, | | NOEDGE, | |
| _edgetype_end_ | | _edgetype_end_ | |
| }; | | }; | |
| | | | |
|
| | | PARSER_EXPORT std::string format(EdgeTypeEnum e); | |
| | | | |
| #define FLIST_BADNEXT ((void*)0x111) | | #define FLIST_BADNEXT ((void*)0x111) | |
| #define FLIST_BADPREV ((void*)0x222) | | #define FLIST_BADPREV ((void*)0x222) | |
| | | | |
| /* | | /* | |
| * All CFG objects extend allocatable, which | | * All CFG objects extend allocatable, which | |
| * allows them to be added and removed from | | * allows them to be added and removed from | |
| * accounting structures in constant time | | * accounting structures in constant time | |
| */ | | */ | |
| class allocatable { | | class allocatable { | |
| public: | | public: | |
| | | | |
| skipping to change at line 127 | | skipping to change at line 130 | |
| } | | } | |
| aprev_->anext_ = &new_elem; | | aprev_->anext_ = &new_elem; | |
| new_elem.aprev_ = aprev_; | | new_elem.aprev_ = aprev_; | |
| new_elem.anext_ = this; | | new_elem.anext_ = this; | |
| aprev_ = &new_elem; | | aprev_ = &new_elem; | |
| } | | } | |
| }; | | }; | |
| | | | |
| class Block; | | class Block; | |
| class Edge : public allocatable { | | class Edge : public allocatable { | |
|
| | | friend class CFGModifier; | |
| protected: | | protected: | |
| Block * _source; | | Block * _source; | |
| Block * _target; | | Block * _target; | |
| | | | |
| private: | | private: | |
| | | | |
| #if defined(_MSC_VER) | | #if defined(_MSC_VER) | |
| typedef unsigned __int16 uint16_t; | | typedef unsigned __int16 uint16_t; | |
| typedef unsigned __int8 uint8_t; | | typedef unsigned __int8 uint8_t; | |
| #else | | #else | |
| | | | |
| skipping to change at line 155 | | skipping to change at line 159 | |
| uint16_t _type_enum; | | uint16_t _type_enum; | |
| uint8_t _sink; | | uint8_t _sink; | |
| uint8_t _interproc; // modifier for interprocedural branches | | uint8_t _interproc; // modifier for interprocedural branches | |
| // (tail calls) | | // (tail calls) | |
| }; | | }; | |
| EdgeType _type; | | EdgeType _type; | |
| | | | |
| public: | | public: | |
| PARSER_EXPORT Edge(Block * source, | | PARSER_EXPORT Edge(Block * source, | |
| Block * target, | | Block * target, | |
|
| EdgeTypeEnum type) : | | EdgeTypeEnum type); | |
| _source(source), | | PARSER_EXPORT virtual ~Edge(); | |
| _target(target), | | | |
| _type(type,false) { } | | | |
| | | | |
| PARSER_EXPORT virtual ~Edge() { } | | | |
| | | | |
| PARSER_EXPORT virtual Block * src() const { return _source; } | | PARSER_EXPORT virtual Block * src() const { return _source; } | |
| PARSER_EXPORT virtual Block * trg() const { return _target; } | | PARSER_EXPORT virtual Block * trg() const { return _target; } | |
| PARSER_EXPORT EdgeTypeEnum type() const { | | PARSER_EXPORT EdgeTypeEnum type() const { | |
| return static_cast<EdgeTypeEnum>(_type._type_enum); | | return static_cast<EdgeTypeEnum>(_type._type_enum); | |
| } | | } | |
| bool sinkEdge() const { return _type._sink != 0; } | | bool sinkEdge() const { return _type._sink != 0; } | |
|
| bool interproc() const { return _type._interproc != 0; } | | bool interproc() const { | |
| | | return (_type._interproc != 0 || | |
| | | type() == CALL || | |
| | | type() == RET); | |
| | | } | |
| | | | |
| | | bool intraproc() const { | |
| | | return !interproc(); | |
| | | } | |
| | | | |
| PARSER_EXPORT void install(); | | PARSER_EXPORT void install(); | |
| | | | |
|
| | | /* removes from blocks (and if of type CALL, from finalized source func | |
| | | tions ) */ | |
| | | PARSER_EXPORT void uninstall(); | |
| | | | |
| | | PARSER_EXPORT static void destroy(Edge *, CodeObject *); | |
| | | | |
| friend class CFGFactory; | | friend class CFGFactory; | |
| friend class Parser; | | friend class Parser; | |
| }; | | }; | |
| | | | |
| /* | | /* | |
| * Iteration over edges can be controlled by an EdgePredicate. | | * Iteration over edges can be controlled by an EdgePredicate. | |
| * Edges are returned only if pred(edge) evaluates true. | | * Edges are returned only if pred(edge) evaluates true. | |
| * | | * | |
| * EdgePredicates are composable by AND. | | * EdgePredicates are composable by AND. | |
| */ | | */ | |
| | | | |
| skipping to change at line 268 | | skipping to change at line 281 | |
| _forward(forward), | | _forward(forward), | |
| _backward(backward) { } | | _backward(backward) { } | |
| PARSER_EXPORT ~SingleContextOrInterproc() { } | | PARSER_EXPORT ~SingleContextOrInterproc() { } | |
| PARSER_EXPORT bool pred_impl(Edge *) const; | | PARSER_EXPORT bool pred_impl(Edge *) const; | |
| }; | | }; | |
| | | | |
| class CodeObject; | | class CodeObject; | |
| class CodeRegion; | | class CodeRegion; | |
| class Block : public Dyninst::interval<Address>, | | class Block : public Dyninst::interval<Address>, | |
| public allocatable { | | public allocatable { | |
|
| | | friend class CFGModifier; | |
| public: | | public: | |
| typedef ContainerWrapper< | | typedef ContainerWrapper< | |
| std::vector<Edge*>, | | std::vector<Edge*>, | |
| Edge*, | | Edge*, | |
| Edge*, | | Edge*, | |
| EdgePredicate | | EdgePredicate | |
| > edgelist; | | > 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 size() const { return _end - _start; } | | PARSER_EXPORT Address size() const { return _end - _start; } | |
| | | | |
| PARSER_EXPORT bool parsed() const { return _parsed; } | | PARSER_EXPORT bool parsed() const { return _parsed; } | |
| | | | |
| PARSER_EXPORT CodeObject * obj() const { return _obj; } | | PARSER_EXPORT CodeObject * obj() const { return _obj; } | |
| PARSER_EXPORT CodeRegion * region() const { return _region; } | | PARSER_EXPORT CodeRegion * region() const { return _region; } | |
| | | | |
| /* Edge access */ | | /* Edge access */ | |
|
| PARSER_EXPORT edgelist & sources() { return _srclist; } | | PARSER_EXPORT const edgelist & sources() const { return _srclist; } | |
| PARSER_EXPORT edgelist & targets() { 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); | |
| | | | |
|
| | | 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; | |
| | | | |
| // XXX debugging | | // XXX debugging | |
| if(b1 != b2) | | if(b1 != b2) | |
| fprintf(stderr,"FATAL: blocks %p [%lx,%lx) and %p [%lx,%lx)
" | | fprintf(stderr,"FATAL: blocks %p [%lx,%lx) and %p [%lx,%lx)
" | |
| "conflict",b1,b1->start(),b1->end(), | | "conflict",b1,b1->start(),b1->end(), | |
| b2,b2->start(),b2->end()); | | b2,b2->start(),b2->end()); | |
| | | | |
| assert(b1 == b2); | | assert(b1 == b2); | |
| return false; | | return false; | |
| } | | } | |
| }; | | }; | |
| | | | |
|
| | | static void destroy(Block *b); | |
| | | | |
| private: | | private: | |
| void addSource(Edge * e); | | void addSource(Edge * e); | |
| void addTarget(Edge * e); | | void addTarget(Edge * e); | |
| void removeTarget(Edge * e); | | void removeTarget(Edge * e); | |
| void removeSource(Edge * e); | | void removeSource(Edge * e); | |
| void removeFunc(Function *); | | void removeFunc(Function *); | |
|
| | | void updateEnd(Address addr); | |
| | | | |
| private: | | private: | |
| CodeObject * _obj; | | CodeObject * _obj; | |
| CodeRegion * _region; | | CodeRegion * _region; | |
| | | | |
| Address _start; | | Address _start; | |
| Address _end; | | Address _end; | |
| Address _lastInsn; | | Address _lastInsn; | |
| | | | |
| std::vector<Edge *> _sources; | | std::vector<Edge *> _sources; | |
| | | | |
| skipping to change at line 407 | | skipping to change at line 427 | |
| TAMPER_NONE, | | TAMPER_NONE, | |
| TAMPER_REL, | | TAMPER_REL, | |
| TAMPER_ABS, | | TAMPER_ABS, | |
| TAMPER_NONZERO | | TAMPER_NONZERO | |
| }; | | }; | |
| | | | |
| class CodeObject; | | class CodeObject; | |
| class CodeRegion; | | class CodeRegion; | |
| class FuncExtent; | | class FuncExtent; | |
| class Function : public allocatable, public AnnotatableSparse { | | class Function : public allocatable, public AnnotatableSparse { | |
|
| | | friend class CFGModifier; | |
| protected: | | protected: | |
| Address _start; | | Address _start; | |
| CodeObject * _obj; | | CodeObject * _obj; | |
| CodeRegion * _region; | | CodeRegion * _region; | |
| InstructionSource * _isrc; | | InstructionSource * _isrc; | |
| | | | |
| FuncSource _src; | | FuncSource _src; | |
| FuncReturnStatus _rs; | | FuncReturnStatus _rs; | |
| | | | |
| std::string _name; | | std::string _name; | |
| | | | |
| skipping to change at line 438 | | skipping to change at line 459 | |
| typedef ContainerWrapper< | | typedef ContainerWrapper< | |
| std::set<Edge*>, | | std::set<Edge*>, | |
| Edge*, | | Edge*, | |
| Edge* | | Edge* | |
| > edgelist; | | > edgelist; | |
| | | | |
| PARSER_EXPORT Function(Address addr, string name, CodeObject * obj, | | PARSER_EXPORT Function(Address addr, string name, CodeObject * obj, | |
| CodeRegion * region, InstructionSource * isource); | | CodeRegion * region, InstructionSource * isource); | |
| | | | |
| PARSER_EXPORT virtual ~Function(); | | PARSER_EXPORT virtual ~Function(); | |
|
| | | | |
| PARSER_EXPORT virtual const string & name(); | | PARSER_EXPORT virtual const string & name(); | |
| | | | |
| PARSER_EXPORT Address addr() const { return _start; } | | PARSER_EXPORT Address addr() const { return _start; } | |
| PARSER_EXPORT CodeRegion * region() const { return _region; } | | PARSER_EXPORT CodeRegion * region() const { return _region; } | |
| PARSER_EXPORT InstructionSource * isrc() const { return _isrc; } | | PARSER_EXPORT InstructionSource * isrc() const { return _isrc; } | |
| PARSER_EXPORT CodeObject * obj() const { return _obj; } | | PARSER_EXPORT CodeObject * obj() const { return _obj; } | |
| PARSER_EXPORT FuncSource src() const { return _src; } | | PARSER_EXPORT FuncSource src() const { return _src; } | |
| PARSER_EXPORT FuncReturnStatus retstatus() const { return _rs; } | | PARSER_EXPORT FuncReturnStatus retstatus() const { return _rs; } | |
| PARSER_EXPORT Block * entry() const { return _entry; } | | PARSER_EXPORT Block * entry() const { return _entry; } | |
| PARSER_EXPORT bool parsed() const { return _parsed; } | | PARSER_EXPORT bool parsed() const { return _parsed; } | |
| | | | |
| /* Basic block and CFG access */ | | /* Basic block and CFG access */ | |
| PARSER_EXPORT blocklist & blocks(); | | PARSER_EXPORT blocklist & blocks(); | |
| PARSER_EXPORT bool contains(Block *b); | | PARSER_EXPORT bool contains(Block *b); | |
| PARSER_EXPORT edgelist & callEdges(); | | PARSER_EXPORT edgelist & callEdges(); | |
| PARSER_EXPORT blocklist & returnBlocks(); | | PARSER_EXPORT blocklist & returnBlocks(); | |
|
| | | PARSER_EXPORT blocklist & exitBlocks(); | |
| | | | |
| /* Function details */ | | /* Function details */ | |
| PARSER_EXPORT bool hasNoStackFrame() const { return _no_stack_frame; } | | PARSER_EXPORT bool hasNoStackFrame() const { return _no_stack_frame; } | |
| PARSER_EXPORT bool savesFramePointer() const { return _saves_fp; } | | PARSER_EXPORT bool savesFramePointer() const { return _saves_fp; } | |
| PARSER_EXPORT bool cleansOwnStack() const { return _cleans_stack; } | | PARSER_EXPORT bool cleansOwnStack() const { return _cleans_stack; } | |
| | | | |
| /* Parse updates and obfuscation */ | | /* Parse updates and obfuscation */ | |
|
| PARSER_EXPORT void set_retstatus(FuncReturnStatus rs) { _rs = rs; } | | PARSER_EXPORT void setEntryBlock(Block *new_entry); | |
| PARSER_EXPORT void deleteBlocks( vector<Block*> & dead_funcs, | | PARSER_EXPORT void set_retstatus(FuncReturnStatus rs); | |
| Block * new_entry ); | | PARSER_EXPORT void removeBlock( Block* ); | |
| PARSER_EXPORT StackTamper stackTamper() { return _tamper; } | | | |
| | | PARSER_EXPORT StackTamper tampersStack(bool recalculate=false); | |
| | | | |
| struct less | | struct less | |
| { | | { | |
| bool operator()(const Function * f1, const Function * f2) const | | bool operator()(const Function * f1, const Function * f2) const | |
| { | | { | |
| return f1->addr() < f2->addr(); | | return f1->addr() < f2->addr(); | |
| } | | } | |
| }; | | }; | |
| | | | |
| /* Contiguous code segments of function */ | | /* Contiguous code segments of function */ | |
| PARSER_EXPORT std::vector<FuncExtent *> const& extents(); | | PARSER_EXPORT std::vector<FuncExtent *> const& extents(); | |
| | | | |
|
| | | /* This should not remain here - this is an experimental fix for | |
| | | defensive mode CFG inconsistency */ | |
| | | void invalidateCache() { _cache_valid = false; } | |
| | | | |
| | | static void destroy(Function *f); | |
| | | | |
| private: | | private: | |
| std::vector<Block *> const& blocks_int(); | | std::vector<Block *> const& blocks_int(); | |
| void delayed_link_return(CodeObject * co, Block * retblk); | | void delayed_link_return(CodeObject * co, Block * retblk); | |
| void finalize(); | | void finalize(); | |
| | | | |
| bool _parsed; | | bool _parsed; | |
| bool _cache_valid; | | bool _cache_valid; | |
| blocklist _bl; | | blocklist _bl; | |
| std::vector<Block *> _blocks; | | std::vector<Block *> _blocks; | |
| std::vector<FuncExtent *> _extents; | | std::vector<FuncExtent *> _extents; | |
| | | | |
| skipping to change at line 498 | | skipping to change at line 528 | |
| /* rapid lookup for edge predicate tests */ | | /* rapid lookup for edge predicate tests */ | |
| //typedef dyn_hash_map<Address, Block*> blockmap; | | //typedef dyn_hash_map<Address, Block*> blockmap; | |
| typedef std::map<Address, Block*> blockmap; | | typedef std::map<Address, Block*> blockmap; | |
| blockmap _bmap; | | blockmap _bmap; | |
| | | | |
| /* rapid lookup for interprocedural queries */ | | /* rapid lookup for interprocedural queries */ | |
| std::set<Edge *> _call_edges; | | std::set<Edge *> _call_edges; | |
| edgelist _call_edge_list; | | edgelist _call_edge_list; | |
| std::vector<Block *> _return_blocks; | | std::vector<Block *> _return_blocks; | |
| blocklist _retBL; | | blocklist _retBL; | |
|
| | | // Superset of return blocks; this includes all blocks where | |
| | | // execution leaves the function without coming back, including | |
| | | // returns, calls to non-returning calls, tail calls, etc. | |
| | | // Might want to include exceptions... | |
| | | std::vector<Block *> _exit_blocks; | |
| | | blocklist _exitBL; | |
| | | | |
| /* function details */ | | /* function details */ | |
| bool _no_stack_frame; | | bool _no_stack_frame; | |
| bool _saves_fp; | | bool _saves_fp; | |
| bool _cleans_stack; | | bool _cleans_stack; | |
| StackTamper _tamper; | | StackTamper _tamper; | |
| Address _tamper_addr; | | Address _tamper_addr; | |
| | | | |
| /*** Internal parsing methods and state ***/ | | /*** Internal parsing methods and state ***/ | |
| void add_block(Block *b); | | void add_block(Block *b); | |
| | | | |
|
| | | friend void Edge::uninstall(); | |
| friend class Parser; | | friend class Parser; | |
| friend class CFGFactory; | | friend class CFGFactory; | |
| friend class CodeObject; | | friend class CodeObject; | |
| }; | | }; | |
| | | | |
| /* Describes a contiguous extent of a Function object */ | | /* Describes a contiguous extent of a Function object */ | |
| class FuncExtent : public Dyninst::interval<Address> { | | class FuncExtent : public Dyninst::interval<Address> { | |
| private: | | private: | |
| Function * _func; | | Function * _func; | |
| Address _start; | | Address _start; | |
| | | | |
End of changes. 23 change blocks. |
| 22 lines changed or deleted | | 60 lines changed or added | |
|
| CodeObject.h | | CodeObject.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 55 | | skipping to change at line 54 | |
| namespace Dyninst { | | namespace Dyninst { | |
| namespace ParseAPI { | | namespace ParseAPI { | |
| | | | |
| /** A CodeObject defines a collection of binary code, for example a binary, | | /** A CodeObject defines a collection of binary code, for example a binary, | |
| dynamic library, archive, memory snapshot, etc. In the context of | | dynamic library, archive, memory snapshot, etc. In the context of | |
| Dyninst, it maps to an image object. | | Dyninst, it maps to an image object. | |
| **/ | | **/ | |
| | | | |
| class Parser; // internals | | class Parser; // internals | |
| class ParseCallback; | | class ParseCallback; | |
|
| | | class ParseCallbackManager; | |
| | | class CFGModifier; | |
| | | | |
| class CodeObject { | | class CodeObject { | |
|
| | | friend class CFGModifier; | |
| public: | | public: | |
| PARSER_EXPORT static void version(int& major, int& minor, int& maintena
nce); | | PARSER_EXPORT static void version(int& major, int& minor, int& maintena
nce); | |
| typedef ContainerWrapper< | | typedef ContainerWrapper< | |
| std::set<Function*,Function::less>, | | std::set<Function*,Function::less>, | |
| Function*, | | Function*, | |
| Function* | | Function* | |
| > funclist; | | > funclist; | |
| | | | |
| PARSER_EXPORT CodeObject(CodeSource * cs, | | PARSER_EXPORT CodeObject(CodeSource * cs, | |
|
| CFGFactory * fact = NULL, | | CFGFactory * fact = NULL, | |
| ParseCallback * cb = NULL, | | ParseCallback * cb = NULL, | |
| bool defensiveMode = false); | | bool defensiveMode = false); | |
| PARSER_EXPORT ~CodeObject(); | | PARSER_EXPORT ~CodeObject(); | |
| | | | |
| /** Parsing interface **/ | | /** Parsing interface **/ | |
| | | | |
| // `hint-based' parsing | | // `hint-based' parsing | |
| PARSER_EXPORT void parse(); | | PARSER_EXPORT void parse(); | |
| | | | |
| // `exact-target' parsing; optinally recursive | | // `exact-target' parsing; optinally recursive | |
| PARSER_EXPORT void parse(Address target, bool recursive); | | PARSER_EXPORT void parse(Address target, bool recursive); | |
| | | | |
|
| // adds new edges to parsed functions | | // `even-more-exact-target' parsing; optinally recursive | |
| PARSER_EXPORT bool parseNewEdges( vector<Block*> & sources, | | PARSER_EXPORT void parse(CodeRegion *cr, Address target, bool recursive | |
| vector<Address> & targets, | | ); | |
| vector<EdgeTypeEnum> & edge_types); | | | |
| | | // parses new edges in already parsed functions | |
| | | struct NewEdgeToParse { | |
| | | Block *source; | |
| | | Address target; | |
| | | EdgeTypeEnum edge_type; | |
| | | NewEdgeToParse(Block *a, Address b, EdgeTypeEnum c) : source | |
| | | (a), target(b), edge_type(c) {}; | |
| | | }; | |
| | | | |
| | | PARSER_EXPORT bool parseNewEdges( vector<NewEdgeToParse> & worklist ); | |
| | | | |
| // `speculative' parsing | | // `speculative' parsing | |
| PARSER_EXPORT void parseGaps(CodeRegion *cr); | | PARSER_EXPORT void parseGaps(CodeRegion *cr); | |
| | | | |
| /** Lookup routines **/ | | /** Lookup routines **/ | |
| | | | |
| // functions | | // functions | |
| PARSER_EXPORT Function * findFuncByEntry(CodeRegion * cr, Address entry
); | | PARSER_EXPORT Function * findFuncByEntry(CodeRegion * cr, Address entry
); | |
| PARSER_EXPORT int findFuncs(CodeRegion * cr, | | PARSER_EXPORT int findFuncs(CodeRegion * cr, | |
| Address addr, | | Address addr, | |
| | | | |
| skipping to change at line 104 | | skipping to change at line 114 | |
| // Find functions overlapping the range [start,end) | | // Find functions overlapping the range [start,end) | |
| PARSER_EXPORT int findFuncs(CodeRegion * cr, | | PARSER_EXPORT int findFuncs(CodeRegion * cr, | |
| Address start, Address end, | | Address start, Address end, | |
| std::set<Function*> & funcs); | | std::set<Function*> & funcs); | |
| PARSER_EXPORT funclist & funcs() { return flist; } | | PARSER_EXPORT funclist & funcs() { return flist; } | |
| | | | |
| // blocks | | // blocks | |
| PARSER_EXPORT Block * findBlockByEntry(CodeRegion * cr, Address entry); | | PARSER_EXPORT Block * findBlockByEntry(CodeRegion * cr, Address entry); | |
| PARSER_EXPORT int findBlocks(CodeRegion * cr, | | PARSER_EXPORT int findBlocks(CodeRegion * cr, | |
| Address addr, std::set<Block*> & blocks); | | Address addr, std::set<Block*> & blocks); | |
|
| | | PARSER_EXPORT Block * findNextBlock(CodeRegion * cr, Address addr); | |
| | | | |
| /* Misc */ | | /* Misc */ | |
| PARSER_EXPORT CodeSource * cs() const { return _cs; } | | PARSER_EXPORT CodeSource * cs() const { return _cs; } | |
| PARSER_EXPORT CFGFactory * fact() const { return _fact; } | | PARSER_EXPORT CFGFactory * fact() const { return _fact; } | |
| PARSER_EXPORT bool defensiveMode() { return defensive; } | | PARSER_EXPORT bool defensiveMode() { return defensive; } | |
|
| PARSER_EXPORT void deleteFunc(Function *); | | | |
| | | PARSER_EXPORT bool isIATcall(Address insn, std::string &calleeName); | |
| | | | |
| | | // This is for callbacks; it is often much more efficient to | |
| | | // batch callbacks and deliver them all at once than one at a time. | |
| | | // Particularly if we're deleting code, it's better to get | |
| | | // "The following blocks were deleted" than "block 1 was deleted; | |
| | | // block 2 lost an edge; block 2 was deleted..." | |
| | | | |
| | | PARSER_EXPORT void startCallbackBatch(); | |
| | | PARSER_EXPORT void finishCallbackBatch(); | |
| | | PARSER_EXPORT void registerCallback(ParseCallback *cb); | |
| | | PARSER_EXPORT void unregisterCallback(ParseCallback *cb); | |
| | | | |
| /* | | /* | |
| * Calling finalize() forces completion of all on-demand | | * Calling finalize() forces completion of all on-demand | |
| * parsing operations for this object, if any remain. | | * parsing operations for this object, if any remain. | |
| */ | | */ | |
| PARSER_EXPORT void finalize(); | | PARSER_EXPORT void finalize(); | |
| | | | |
|
| | | /* | |
| | | * Deletion support | |
| | | */ | |
| | | PARSER_EXPORT void destroy(Edge *); | |
| | | PARSER_EXPORT void destroy(Block *); | |
| | | PARSER_EXPORT void destroy(Function *); | |
| | | | |
| | | /* | |
| | | * Hacky "for insertion" method | |
| | | */ | |
| | | PARSER_EXPORT Address getFreeAddr() const; | |
| | | | |
| private: | | private: | |
| void process_hints(); | | void process_hints(); | |
| void add_edge(Block *src, Block *trg, EdgeTypeEnum et); | | void add_edge(Block *src, Block *trg, EdgeTypeEnum et); | |
|
| // allows Function to (re-)finalize | | | |
| friend void Function::deleteBlocks(vector<Block*> &, Block *); | | | |
| // allows Functions to link up return edges after-the-fact | | // allows Functions to link up return edges after-the-fact | |
| friend void Function::delayed_link_return(CodeObject *,Block*); | | friend void Function::delayed_link_return(CodeObject *,Block*); | |
| // allows Functions to finalize (need Parser access) | | // allows Functions to finalize (need Parser access) | |
| friend void Function::finalize(); | | friend void Function::finalize(); | |
|
| | | // allows Function entry blocks to be moved to new regions | |
| | | friend void Function::setEntryBlock(Block *); | |
| | | | |
|
| private: | | private: | |
| CodeSource * _cs; | | CodeSource * _cs; | |
| CFGFactory * _fact; | | CFGFactory * _fact; | |
|
| ParseCallback * _pcb; | | ParseCallbackManager * _pcb; | |
| | | | |
| Parser * parser; // parser implementation | | Parser * parser; // parser implementation | |
| | | | |
| bool owns_factory; | | bool owns_factory; | |
|
| bool owns_pcb; | | | |
| bool defensive; | | bool defensive; | |
| funclist flist; | | funclist flist; | |
|
| | | | |
| }; | | }; | |
| | | | |
| }//namespace ParseAPI | | }//namespace ParseAPI | |
| }//namespace Dyninst | | }//namespace Dyninst | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 15 change blocks. |
| 21 lines changed or deleted | | 56 lines changed or added | |
|
| CodeSource.h | | CodeSource.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 45 | | skipping to change at line 44 | |
| #include <vector> | | #include <vector> | |
| #include <utility> | | #include <utility> | |
| #include <string> | | #include <string> | |
| | | | |
| #include <Symtab.h> | | #include <Symtab.h> | |
| #include "IBSTree.h" | | #include "IBSTree.h" | |
| #include "dyntypes.h" | | #include "dyntypes.h" | |
| | | | |
| #include "InstructionSource.h" | | #include "InstructionSource.h" | |
| | | | |
|
| | | class StatContainer; | |
| | | | |
| namespace Dyninst { | | namespace Dyninst { | |
| namespace ParseAPI { | | namespace ParseAPI { | |
| | | | |
|
| | | class CFGModifier; | |
| | | | |
| /** A CodeSource is a very simple contract that allows a | | /** A CodeSource is a very simple contract that allows a | |
| CodeObject to get the information it needs to pull code | | CodeObject to get the information it needs to pull code | |
| from some binary source | | from some binary source | |
| **/ | | **/ | |
| | | | |
| class CodeRegion : public Dyninst::InstructionSource, public Dyninst::inter
val<Address> { | | class CodeRegion : public Dyninst::InstructionSource, public Dyninst::inter
val<Address> { | |
| public: | | public: | |
| | | | |
| /* Fills a vector with any names associated with the function at at | | /* Fills a vector with any names associated with the function at at | |
| a given address in this code sources, e.g. symbol names in the | | a given address in this code sources, e.g. symbol names in the | |
| | | | |
| skipping to change at line 77 | | skipping to change at line 80 | |
| Optional | | Optional | |
| */ | | */ | |
| PARSER_EXPORT virtual bool findCatchBlock(Address /* addr */, Address &
/* catchStart */) | | PARSER_EXPORT virtual bool findCatchBlock(Address /* addr */, Address &
/* catchStart */) | |
| { return false; } | | { return false; } | |
| | | | |
| /** interval implementation **/ | | /** interval implementation **/ | |
| PARSER_EXPORT Address low() const =0; | | PARSER_EXPORT Address low() const =0; | |
| PARSER_EXPORT Address high() const =0; | | PARSER_EXPORT Address high() const =0; | |
| | | | |
| PARSER_EXPORT bool contains(Address) const; | | PARSER_EXPORT bool contains(Address) const; | |
|
| | | | |
| | | PARSER_EXPORT virtual bool wasUserAdded() const { return false; } | |
| | | | |
| }; | | }; | |
| | | | |
| /* A starting point for parsing */ | | /* A starting point for parsing */ | |
| struct Hint { | | struct Hint { | |
| Hint() : _addr(0), _reg(NULL), _name("") { } | | Hint() : _addr(0), _reg(NULL), _name("") { } | |
| Hint(Address a, CodeRegion * r, std::string s) : | | Hint(Address a, CodeRegion * r, std::string s) : | |
| _addr(a), _reg(r), _name(s) { } | | _addr(a), _reg(r), _name(s) { } | |
| | | | |
| Address _addr; | | Address _addr; | |
| CodeRegion * _reg; | | CodeRegion * _reg; | |
| std::string _name; | | std::string _name; | |
| }; | | }; | |
| | | | |
| class CodeSource : public Dyninst::InstructionSource { | | class CodeSource : public Dyninst::InstructionSource { | |
|
| | | friend class CFGModifier; | |
| private: | | private: | |
| bool _regions_overlap; | | bool _regions_overlap; | |
| | | | |
| protected: | | protected: | |
| /* | | /* | |
| * Imelmentors of CodeSource can fill the following | | * Imelmentors of CodeSource can fill the following | |
| * structures with available information. Some | | * structures with available information. Some | |
| * of this information is optional. | | * of this information is optional. | |
| */ | | */ | |
| | | | |
| | | | |
| skipping to change at line 160 | | skipping to change at line 167 | |
| PARSER_EXPORT std::vector<CodeRegion *> const& regions() const { return
_regions; } | | PARSER_EXPORT std::vector<CodeRegion *> const& regions() const { return
_regions; } | |
| PARSER_EXPORT int findRegions(Address addr, set<CodeRegion *> & ret) co
nst; | | PARSER_EXPORT int findRegions(Address addr, set<CodeRegion *> & ret) co
nst; | |
| PARSER_EXPORT bool regionsOverlap() const { return _regions_overlap; } | | PARSER_EXPORT bool regionsOverlap() const { return _regions_overlap; } | |
| | | | |
| PARSER_EXPORT Address getTOC() const { return _table_of_contents; } | | PARSER_EXPORT Address getTOC() const { return _table_of_contents; } | |
| /* If the binary file type supplies per-function | | /* If the binary file type supplies per-function | |
| * TOC's (e.g. ppc64 Linux), override. | | * TOC's (e.g. ppc64 Linux), override. | |
| */ | | */ | |
| PARSER_EXPORT virtual Address getTOC(Address) const { return _table_of_
contents; } | | PARSER_EXPORT virtual Address getTOC(Address) const { return _table_of_
contents; } | |
| | | | |
|
| | | // statistics accessor | |
| | | PARSER_EXPORT virtual void print_stats() const { return; } | |
| | | PARSER_EXPORT virtual bool have_stats() const { return false; } | |
| | | | |
| | | // manage statistics | |
| | | virtual void incrementCounter(std::string /*name*/) const { return; } | |
| | | virtual void addCounter(std::string /*name*/, int /*num*/) const { retu | |
| | | rn; } | |
| | | virtual void decrementCounter(std::string /*name*/) const { return; } | |
| | | | |
| protected: | | protected: | |
| CodeSource() : _regions_overlap(false), | | CodeSource() : _regions_overlap(false), | |
| _table_of_contents(0) {} | | _table_of_contents(0) {} | |
| virtual ~CodeSource() {} | | virtual ~CodeSource() {} | |
| | | | |
| void addRegion(CodeRegion *); | | void addRegion(CodeRegion *); | |
|
| | | | |
| | | private: | |
| | | // statistics | |
| | | virtual bool init_stats() { return false; } | |
| | | | |
| }; | | }; | |
| | | | |
| /** SymtabCodeRegion and SymtabCodeSource implement CodeSource for program | | /** SymtabCodeRegion and SymtabCodeSource implement CodeSource for program | |
| binaries supported by the SymtabAPI | | binaries supported by the SymtabAPI | |
| **/ | | **/ | |
| | | | |
| class SymtabCodeRegion : public CodeRegion { | | class SymtabCodeRegion : public CodeRegion { | |
| private: | | private: | |
| SymtabAPI::Symtab * _symtab; | | SymtabAPI::Symtab * _symtab; | |
| SymtabAPI::Region * _region; | | SymtabAPI::Region * _region; | |
| | | | |
| skipping to change at line 208 | | skipping to change at line 229 | |
| PARSER_EXPORT SymtabAPI::Region * symRegion() const { return _region; } | | PARSER_EXPORT SymtabAPI::Region * symRegion() const { return _region; } | |
| }; | | }; | |
| | | | |
| class SymtabCodeSource : public CodeSource { | | class SymtabCodeSource : public CodeSource { | |
| private: | | private: | |
| SymtabAPI::Symtab * _symtab; | | SymtabAPI::Symtab * _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; | |
|
| | | | |
| | | // Stats information | |
| | | StatContainer * stats_parse; | |
| | | bool _have_stats; | |
| | | | |
| public: | | public: | |
| struct hint_filt { | | struct hint_filt { | |
| virtual ~hint_filt() { } | | virtual ~hint_filt() { } | |
| virtual bool operator()(SymtabAPI::Function * f) =0; | | virtual bool operator()(SymtabAPI::Function * f) =0; | |
| }; | | }; | |
| | | | |
| PARSER_EXPORT SymtabCodeSource(SymtabAPI::Symtab *, | | PARSER_EXPORT SymtabCodeSource(SymtabAPI::Symtab *, | |
| hint_filt *, | | hint_filt *, | |
| bool allLoadedRegions=false); | | bool allLoadedRegions=false); | |
| PARSER_EXPORT SymtabCodeSource(SymtabAPI::Symtab *); | | PARSER_EXPORT SymtabCodeSource(SymtabAPI::Symtab *); | |
| PARSER_EXPORT SymtabCodeSource(char *); | | PARSER_EXPORT SymtabCodeSource(char *); | |
| | | | |
| PARSER_EXPORT ~SymtabCodeSource(); | | PARSER_EXPORT ~SymtabCodeSource(); | |
| | | | |
| 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(SymtabAPI::Region *, Address newDiskSiz | |
| | | e); | |
| | | | |
| PARSER_EXPORT Address baseAddress() const; | | PARSER_EXPORT Address baseAddress() const; | |
| PARSER_EXPORT Address loadAddress() const; | | PARSER_EXPORT Address loadAddress() const; | |
| PARSER_EXPORT Address getTOC(Address addr) const; | | PARSER_EXPORT Address getTOC(Address addr) const; | |
| PARSER_EXPORT SymtabAPI::Symtab * getSymtabObject() {return _symtab;} | | PARSER_EXPORT SymtabAPI::Symtab * getSymtabObject() {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; | |
| 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; | |
| | | | |
| PARSER_EXPORT void removeHint(Hint); | | PARSER_EXPORT void removeHint(Hint); | |
| | | | |
| PARSER_EXPORT static void addNonReturning(std::string func_name); | | PARSER_EXPORT static void addNonReturning(std::string func_name); | |
|
| | | | |
| | | // statistics accessor | |
| | | PARSER_EXPORT void print_stats() const; | |
| | | PARSER_EXPORT bool have_stats() const { return _have_stats; } | |
| | | | |
| | | // manage statistics | |
| | | void incrementCounter(std::string name) const; | |
| | | void addCounter(std::string name, int num) const; | |
| | | void decrementCounter(std::string name) const; | |
| | | | |
| private: | | private: | |
| void init(hint_filt *, bool); | | void init(hint_filt *, bool); | |
| void init_regions(hint_filt *, bool); | | void init_regions(hint_filt *, bool); | |
| void init_hints(dyn_hash_map<void*, CodeRegion*> &, hint_filt*); | | void init_hints(dyn_hash_map<void*, CodeRegion*> &, hint_filt*); | |
| void init_linkage(); | | void init_linkage(); | |
| | | | |
| CodeRegion * lookup_region(const Address addr) const; | | CodeRegion * lookup_region(const Address addr) const; | |
|
| | | void removeRegion(CodeRegion &); // removes from region tree | |
| | | | |
| void overlapping_warn(const char * file, unsigned line) const; | | void overlapping_warn(const char * file, unsigned line) const; | |
|
| | | | |
| | | // statistics | |
| | | bool init_stats(); | |
| | | | |
| }; | | }; | |
| | | | |
| inline bool CodeRegion::contains(const Address addr) const | | inline bool CodeRegion::contains(const Address addr) const | |
| { | | { | |
| return addr >= offset() && addr < (offset() + length()); | | return addr >= offset() && addr < (offset() + length()); | |
| } | | } | |
| | | | |
| } | | } | |
| } | | } | |
| | | | |
| | | | |
End of changes. 13 change blocks. |
| 7 lines changed or deleted | | 52 lines changed or added | |
|
| Event.h | | Event.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 38 | | 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 | |
| */ | | */ | |
| #if !defined(EVENT_H_) | | #if !defined(EVENT_H_) | |
| #define EVENT_H_ | | #define EVENT_H_ | |
| | | | |
| #include <string> | | #include <string> | |
| #include <set> | | #include <set> | |
| #include "dyntypes.h" | | #include "dyntypes.h" | |
| #include "EventType.h" | | #include "EventType.h" | |
|
| #include "Process.h" | | #include "PCProcess.h" | |
| | | #include "util.h" | |
| | | | |
|
| #include "dyn_detail/boost/shared_ptr.hpp" | | | |
| #include "dyn_detail/boost/enable_shared_from_this.hpp" | | | |
| | | | |
| class installed_breakpoint; | | | |
| class HandlerPool; | | class HandlerPool; | |
|
| | | class HandleCallbacks; | |
| | | | |
| namespace Dyninst { | | namespace Dyninst { | |
| namespace ProcControlAPI { | | namespace ProcControlAPI { | |
| | | | |
|
| class ArchEvent | | class PC_EXPORT ArchEvent | |
| { | | { | |
| private: | | private: | |
| std::string name; | | std::string name; | |
| public: | | public: | |
| ArchEvent(std::string name_ = std::string("")); | | ArchEvent(std::string name_ = std::string("")); | |
| virtual ~ArchEvent(); | | virtual ~ArchEvent(); | |
| std::string getName(); | | std::string getName(); | |
| }; | | }; | |
| | | | |
| class Handler; | | class Handler; | |
| class EventTerminate; | | class EventTerminate; | |
| class EventExit; | | class EventExit; | |
| class EventCrash; | | class EventCrash; | |
|
| | | class EventForceTerminate; | |
| class EventExec; | | class EventExec; | |
| class EventBreakpoint; | | class EventBreakpoint; | |
| class EventStop; | | class EventStop; | |
| class EventNewThread; | | class EventNewThread; | |
|
| | | class EventNewUserThread; | |
| | | class EventNewLWP; | |
| class EventThreadDestroy; | | class EventThreadDestroy; | |
|
| | | class EventUserThreadDestroy; | |
| | | class EventLWPDestroy; | |
| class EventFork; | | class EventFork; | |
| class EventSignal; | | class EventSignal; | |
| class EventBootstrap; | | class EventBootstrap; | |
| class EventRPC; | | class EventRPC; | |
| class EventSingleStep; | | class EventSingleStep; | |
| class EventBreakpointClear; | | class EventBreakpointClear; | |
|
| | | class EventBreakpointRestore; | |
| class EventLibrary; | | class EventLibrary; | |
|
| class EventRPCInternal; | | class EventRPCLaunch; | |
| class EventAsync; | | class EventAsync; | |
| class EventChangePCStop; | | class EventChangePCStop; | |
|
| | | class EventPreBootstrap; | |
| | | class EventDetach; | |
| | | class EventIntBootstrap; | |
| | | class EventNop; | |
| | | class EventThreadDB; | |
| | | class EventWinStopThreadDestroy; | |
| | | | |
|
| class Event : public dyn_detail::boost::enable_shared_from_this<Event> | | class PC_EXPORT Event : public boost::enable_shared_from_this<Event> | |
| { | | { | |
|
| friend void dyn_detail::boost::checked_delete<Event>(Event *); | | friend void boost::checked_delete<Event>(Event *); | |
| friend void dyn_detail::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; | |
| public: | | public: | |
|
| typedef dyn_detail::boost::shared_ptr<Event> ptr; | | typedef boost::shared_ptr<Event> ptr; | |
| typedef dyn_detail::boost::shared_ptr<const Event> const_ptr; | | typedef boost::shared_ptr<const Event> const_ptr; | |
| typedef dyn_detail::boost::weak_ptr<Event> weak_ptr; | | typedef boost::weak_ptr<Event> weak_ptr; | |
| | | | |
| Event(EventType etype_, Thread::ptr thread_ = Thread::ptr()); | | Event(EventType etype_, Thread::ptr thread_ = Thread::ptr()); | |
| virtual ~Event(); | | virtual ~Event(); | |
| | | | |
| typedef enum { | | typedef enum { | |
| unset, | | unset, | |
| async, | | async, | |
| sync_thread, | | sync_thread, | |
| sync_process | | sync_process | |
| } SyncType; | | } SyncType; | |
| | | | |
| EventType getEventType() const; | | EventType getEventType() const; | |
| Thread::const_ptr getThread() const; | | Thread::const_ptr getThread() const; | |
| Process::const_ptr getProcess() const; | | Process::const_ptr getProcess() const; | |
| SyncType getSyncType() const; | | SyncType getSyncType() const; | |
| std::string name() const; | | std::string name() const; | |
| | | | |
| void setThread(Thread::const_ptr t); | | void setThread(Thread::const_ptr t); | |
| void setProcess(Process::const_ptr p); | | void setProcess(Process::const_ptr p); | |
| void setSyncType(SyncType t); | | void setSyncType(SyncType t); | |
|
| | | | |
| void setSuppressCB(bool b); | | void setSuppressCB(bool b); | |
|
| | | | |
| virtual bool suppressCB() const; | | virtual bool suppressCB() const; | |
| virtual bool triggersCB() const; | | virtual bool triggersCB() const; | |
| virtual bool canFastHandle() const; | | virtual bool canFastHandle() const; | |
|
| | | virtual bool userEvent() const; | |
| | | virtual void setUserEvent(bool b); | |
| virtual bool procStopper() const; | | virtual bool procStopper() const; | |
|
| | | | |
| Event::weak_ptr subservientTo() const; | | Event::weak_ptr subservientTo() const; | |
| void addSubservientEvent(Event::ptr ev); | | void addSubservientEvent(Event::ptr ev); | |
| | | | |
|
| dyn_detail::boost::shared_ptr<EventTerminate> getEventTerminate(); | | boost::shared_ptr<EventTerminate> getEventTerminate(); | |
| dyn_detail::boost::shared_ptr<const EventTerminate> getEventTerminate() | | boost::shared_ptr<const EventTerminate> getEventTerminate() const; | |
| const; | | | |
| | | boost::shared_ptr<EventExit> getEventExit(); | |
| | | boost::shared_ptr<const EventExit> getEventExit() const; | |
| | | | |
| | | boost::shared_ptr<EventCrash> getEventCrash(); | |
| | | boost::shared_ptr<const EventCrash> getEventCrash() const; | |
| | | | |
| | | boost::shared_ptr<EventForceTerminate> getEventForceTerminate(); | |
| | | boost::shared_ptr<const EventForceTerminate> getEventForceTerminate() co | |
| | | nst; | |
| | | | |
| | | boost::shared_ptr<EventExec> getEventExec(); | |
| | | boost::shared_ptr<const EventExec> getEventExec() const; | |
| | | | |
| | | boost::shared_ptr<EventStop> getEventStop(); | |
| | | boost::shared_ptr<const EventStop> getEventStop() const; | |
| | | | |
| | | boost::shared_ptr<EventBreakpoint> getEventBreakpoint(); | |
| | | boost::shared_ptr<const EventBreakpoint> getEventBreakpoint() const; | |
| | | | |
| | | boost::shared_ptr<EventNewThread> getEventNewThread(); | |
| | | boost::shared_ptr<const EventNewThread> getEventNewThread() const; | |
| | | | |
| | | boost::shared_ptr<EventNewUserThread> getEventNewUserThread(); | |
| | | boost::shared_ptr<const EventNewUserThread> getEventNewUserThread() cons | |
| | | t; | |
| | | | |
|
| dyn_detail::boost::shared_ptr<EventExit> getEventExit(); | | boost::shared_ptr<EventNewLWP> getEventNewLWP(); | |
| dyn_detail::boost::shared_ptr<const EventExit> getEventExit() const; | | boost::shared_ptr<const EventNewLWP> getEventNewLWP() const; | |
| | | | |
|
| dyn_detail::boost::shared_ptr<EventCrash> getEventCrash(); | | boost::shared_ptr<EventThreadDestroy> getEventThreadDestroy(); | |
| dyn_detail::boost::shared_ptr<const EventCrash> getEventCrash() const; | | boost::shared_ptr<const EventThreadDestroy> getEventThreadDestroy() cons | |
| | | t; | |
| | | | |
|
| dyn_detail::boost::shared_ptr<EventExec> getEventExec(); | | boost::shared_ptr<EventUserThreadDestroy> getEventUserThreadDestroy(); | |
| dyn_detail::boost::shared_ptr<const EventExec> getEventExec() const; | | boost::shared_ptr<const EventUserThreadDestroy> getEventUserThreadDestro | |
| | | y() const; | |
| | | | |
|
| dyn_detail::boost::shared_ptr<EventStop> getEventStop(); | | boost::shared_ptr<EventLWPDestroy> getEventLWPDestroy(); | |
| dyn_detail::boost::shared_ptr<const EventStop> getEventStop() const; | | boost::shared_ptr<const EventLWPDestroy> getEventLWPDestroy() const; | |
| | | | |
|
| dyn_detail::boost::shared_ptr<EventBreakpoint> getEventBreakpoint(); | | boost::shared_ptr<EventFork> getEventFork(); | |
| dyn_detail::boost::shared_ptr<const EventBreakpoint> getEventBreakpoint( | | boost::shared_ptr<const EventFork> getEventFork() const; | |
| ) const; | | | |
| | | | |
|
| dyn_detail::boost::shared_ptr<EventNewThread> getEventNewThread(); | | boost::shared_ptr<EventSignal> getEventSignal(); | |
| dyn_detail::boost::shared_ptr<const EventNewThread> getEventNewThread() | | boost::shared_ptr<const EventSignal> getEventSignal() const; | |
| const; | | | |
| | | | |
|
| dyn_detail::boost::shared_ptr<EventThreadDestroy> getEventThreadDestroy( | | boost::shared_ptr<EventBootstrap> getEventBootstrap(); | |
| ); | | boost::shared_ptr<const EventBootstrap> getEventBootstrap() const; | |
| dyn_detail::boost::shared_ptr<const EventThreadDestroy> getEventThreadDe | | | |
| stroy() const; | | | |
| | | | |
|
| dyn_detail::boost::shared_ptr<EventFork> getEventFork(); | | boost::shared_ptr<EventPreBootstrap> getEventPreBootstrap(); | |
| dyn_detail::boost::shared_ptr<const EventFork> getEventFork() const; | | boost::shared_ptr<const EventPreBootstrap> getEventPreBootstrap() const; | |
| | | | |
|
| dyn_detail::boost::shared_ptr<EventSignal> getEventSignal(); | | boost::shared_ptr<EventRPC> getEventRPC(); | |
| dyn_detail::boost::shared_ptr<const EventSignal> getEventSignal() const; | | boost::shared_ptr<const EventRPC> getEventRPC() const; | |
| | | | |
|
| dyn_detail::boost::shared_ptr<EventBootstrap> getEventBootstrap(); | | boost::shared_ptr<EventRPCLaunch> getEventRPCLaunch(); | |
| dyn_detail::boost::shared_ptr<const EventBootstrap> getEventBootstrap() | | boost::shared_ptr<const EventRPCLaunch> getEventRPCLaunch() const; | |
| const; | | | |
| | | | |
|
| dyn_detail::boost::shared_ptr<EventRPC> getEventRPC(); | | boost::shared_ptr<EventSingleStep> getEventSingleStep(); | |
| dyn_detail::boost::shared_ptr<const EventRPC> getEventRPC() const; | | boost::shared_ptr<const EventSingleStep> getEventSingleStep() const; | |
| | | | |
|
| dyn_detail::boost::shared_ptr<EventRPCInternal> getEventRPCInternal(); | | boost::shared_ptr<EventBreakpointClear> getEventBreakpointClear(); | |
| dyn_detail::boost::shared_ptr<const EventRPCInternal> getEventRPCInterna | | boost::shared_ptr<const EventBreakpointClear> getEventBreakpointClear() | |
| l() const; | | const; | |
| | | | |
|
| dyn_detail::boost::shared_ptr<EventSingleStep> getEventSingleStep(); | | boost::shared_ptr<EventBreakpointRestore> getEventBreakpointRestore(); | |
| dyn_detail::boost::shared_ptr<const EventSingleStep> getEventSingleStep( | | boost::shared_ptr<const EventBreakpointRestore> getEventBreakpointRestor | |
| ) const; | | e() const; | |
| | | | |
|
| dyn_detail::boost::shared_ptr<EventBreakpointClear> getEventBreakpointCl | | boost::shared_ptr<EventLibrary> getEventLibrary(); | |
| ear(); | | boost::shared_ptr<const EventLibrary> getEventLibrary() const; | |
| dyn_detail::boost::shared_ptr<const EventBreakpointClear> getEventBreakp | | | |
| ointClear() const; | | | |
| | | | |
|
| dyn_detail::boost::shared_ptr<EventLibrary> getEventLibrary(); | | boost::shared_ptr<EventAsync> getEventAsync(); | |
| dyn_detail::boost::shared_ptr<const EventLibrary> getEventLibrary() cons | | boost::shared_ptr<const EventAsync> getEventAsync() const; | |
| t; | | | |
| | | | |
|
| dyn_detail::boost::shared_ptr<EventAsync> getEventAsync(); | | boost::shared_ptr<EventChangePCStop> getEventChangePCStop(); | |
| dyn_detail::boost::shared_ptr<const EventAsync> getEventAsync() const; | | boost::shared_ptr<const EventChangePCStop> getEventChangePCStop() const; | |
| | | | |
|
| dyn_detail::boost::shared_ptr<EventChangePCStop> getEventChangePCStop(); | | boost::shared_ptr<EventDetach> getEventDetach(); | |
| dyn_detail::boost::shared_ptr<const EventChangePCStop> getEventChangePCS | | boost::shared_ptr<const EventDetach> getEventDetach() const; | |
| top() const; | | | |
| | | | |
|
| | | boost::shared_ptr<EventIntBootstrap> getEventIntBootstrap(); | |
| | | boost::shared_ptr<const EventIntBootstrap> getEventIntBootstrap() const; | |
| | | | |
| | | boost::shared_ptr<EventNop> getEventNop(); | |
| | | boost::shared_ptr<const EventNop> getEventNop() const; | |
| | | | |
| | | boost::shared_ptr<EventThreadDB> getEventThreadDB(); | |
| | | boost::shared_ptr<const EventThreadDB> getEventThreadDB() const; | |
| | | | |
| | | boost::shared_ptr<EventWinStopThreadDestroy> getEventWinStopThreadDestro | |
| | | y(); | |
| | | boost::shared_ptr<const EventWinStopThreadDestroy> getEventWinStopThread | |
| | | Destroy() const; | |
| | | | |
| | | //Not meant for public consumption | |
| | | 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; | |
| bool suppress_cb; | | bool suppress_cb; | |
|
| }; | | bool user_event; | |
| | | bool handling_started; | |
| | | bool noted_event; | |
| | | }; | |
| | | | |
| | | template<typename OS> | |
| | | OS& operator<<(OS& str, Event& e) | |
| | | { | |
| | | str << e.getEventType().name() << " event is "; | |
| | | switch(e.getSyncType()) | |
| | | { | |
| | | case Event::async: | |
| | | str << "asynchronous "; | |
| | | break; | |
| | | case Event::sync_thread: | |
| | | str << "thread synchronous "; | |
| | | break; | |
| | | case Event::sync_process: | |
| | | str << "process synchronous "; | |
| | | break; | |
| | | default: | |
| | | str << "<UNKNOWN SYNC TYPE> "; | |
| | | break; | |
| | | } | |
| | | str << "on " << (e.getProcess() ? e.getProcess()->getPid() : -1); | |
| | | str << "/" << ((e.getThread()) ? e.getThread()->getLWP() : (Dyninst | |
| | | ::LWP) -1); | |
| | | str << "\n"; | |
| | | return str; | |
| | | } | |
| | | | |
|
| class EventTerminate : public Event | | class PC_EXPORT EventTerminate : public Event | |
| { | | { | |
|
| friend void dyn_detail::boost::checked_delete<EventTerminate>(EventTermi | | friend void boost::checked_delete<EventTerminate>(EventTerminate *); | |
| nate *); | | friend void boost::checked_delete<const EventTerminate>(const EventTermi | |
| friend void dyn_detail::boost::checked_delete<const EventTerminate>(cons | | nate *); | |
| t EventTerminate *); | | | |
| public: | | public: | |
|
| typedef dyn_detail::boost::shared_ptr<EventTerminate> ptr; | | typedef boost::shared_ptr<EventTerminate> ptr; | |
| typedef dyn_detail::boost::shared_ptr<const EventTerminate> const_ptr; | | typedef boost::shared_ptr<const EventTerminate> const_ptr; | |
| EventTerminate(EventType type_); | | EventTerminate(EventType type_); | |
| virtual ~EventTerminate(); | | virtual ~EventTerminate(); | |
| }; | | }; | |
| | | | |
|
| class EventExit : public EventTerminate | | class PC_EXPORT EventExit : public EventTerminate | |
| { | | { | |
|
| friend void dyn_detail::boost::checked_delete<EventExit>(EventExit *); | | friend void boost::checked_delete<EventExit>(EventExit *); | |
| friend void dyn_detail::boost::checked_delete<const EventExit>(const Eve | | friend void boost::checked_delete<const EventExit>(const EventExit *); | |
| ntExit *); | | | |
| private: | | private: | |
| int exitcode; | | int exitcode; | |
| public: | | public: | |
|
| typedef dyn_detail::boost::shared_ptr<EventExit> ptr; | | typedef boost::shared_ptr<EventExit> ptr; | |
| typedef dyn_detail::boost::shared_ptr<const EventExit> const_ptr; | | typedef boost::shared_ptr<const EventExit> const_ptr; | |
| int getExitCode() const; | | int getExitCode() const; | |
| EventExit(EventType::Time eventtime, int exitcode_); | | EventExit(EventType::Time eventtime, int exitcode_); | |
| virtual ~EventExit(); | | virtual ~EventExit(); | |
| }; | | }; | |
| | | | |
|
| class EventCrash : public EventTerminate | | class PC_EXPORT EventCrash : public EventTerminate | |
| { | | { | |
|
| friend void dyn_detail::boost::checked_delete<EventCrash>(EventCrash *); | | friend void boost::checked_delete<EventCrash>(EventCrash *); | |
| friend void dyn_detail::boost::checked_delete<const EventCrash>(const Ev | | friend void boost::checked_delete<const EventCrash>(const EventCrash *); | |
| entCrash *); | | | |
| private: | | private: | |
| int termsig; | | int termsig; | |
| public: | | public: | |
|
| typedef dyn_detail::boost::shared_ptr<EventCrash> ptr; | | typedef boost::shared_ptr<EventCrash> ptr; | |
| typedef dyn_detail::boost::shared_ptr<const EventCrash> const_ptr; | | typedef boost::shared_ptr<const EventCrash> const_ptr; | |
| int getTermSignal() const; | | int getTermSignal() const; | |
| EventCrash(int termsig); | | EventCrash(int termsig); | |
| virtual ~EventCrash(); | | virtual ~EventCrash(); | |
| }; | | }; | |
| | | | |
|
| class EventExec : public Event | | class PC_EXPORT EventForceTerminate : public EventTerminate | |
| | | { | |
| | | friend void boost::checked_delete<EventForceTerminate>(EventForceTermina | |
| | | te *); | |
| | | friend void boost::checked_delete<const EventForceTerminate>(const Event | |
| | | ForceTerminate *); | |
| | | private: | |
| | | int termsig; | |
| | | public: | |
| | | typedef boost::shared_ptr<EventForceTerminate> ptr; | |
| | | typedef boost::shared_ptr<const EventForceTerminate> const_ptr; | |
| | | int getTermSignal() const; | |
| | | EventForceTerminate(int termsig); | |
| | | virtual ~EventForceTerminate(); | |
| | | }; | |
| | | | |
| | | class PC_EXPORT EventExec : public Event | |
| { | | { | |
|
| friend void dyn_detail::boost::checked_delete<EventExec>(EventExec *); | | friend void boost::checked_delete<EventExec>(EventExec *); | |
| friend void dyn_detail::boost::checked_delete<const EventExec>(const Eve | | friend void boost::checked_delete<const EventExec>(const EventExec *); | |
| ntExec *); | | | |
| private: | | private: | |
| std::string execpath; | | std::string execpath; | |
| public: | | public: | |
|
| typedef dyn_detail::boost::shared_ptr<EventExec> ptr; | | typedef boost::shared_ptr<EventExec> ptr; | |
| typedef dyn_detail::boost::shared_ptr<const EventExec> const_ptr; | | typedef boost::shared_ptr<const EventExec> const_ptr; | |
| EventExec(EventType::Time etime_, std::string path = std::string("")); | | EventExec(EventType::Time etime_, std::string path = std::string("")); | |
| virtual ~EventExec(); | | virtual ~EventExec(); | |
| | | | |
| std::string getExecPath() const; | | std::string getExecPath() const; | |
| void setExecPath(std::string path_); | | void setExecPath(std::string path_); | |
| }; | | }; | |
| | | | |
|
| class EventStop : public Event | | class PC_EXPORT EventStop : public Event | |
| { | | { | |
|
| friend void dyn_detail::boost::checked_delete<EventStop>(EventStop *); | | friend void boost::checked_delete<EventStop>(EventStop *); | |
| friend void dyn_detail::boost::checked_delete<const EventStop>(const Eve | | friend void boost::checked_delete<const EventStop>(const EventStop *); | |
| ntStop *); | | | |
| public: | | public: | |
|
| typedef dyn_detail::boost::shared_ptr<EventStop> ptr; | | typedef boost::shared_ptr<EventStop> ptr; | |
| typedef dyn_detail::boost::shared_ptr<const EventStop> const_ptr; | | typedef boost::shared_ptr<const EventStop> const_ptr; | |
| EventStop(); | | EventStop(); | |
| virtual ~EventStop(); | | virtual ~EventStop(); | |
| }; | | }; | |
| | | | |
|
| class EventNewThread : public Event | | class PC_EXPORT EventNewThread : public Event | |
| { | | { | |
|
| friend void dyn_detail::boost::checked_delete<EventNewThread>(EventNewTh | | friend void boost::checked_delete<EventNewThread>(EventNewThread *); | |
| read *); | | friend void boost::checked_delete<const EventNewThread>(const EventNewTh | |
| friend void dyn_detail::boost::checked_delete<const EventNewThread>(cons | | read *); | |
| t EventNewThread *); | | | |
| private: | | | |
| Dyninst::LWP lwp; | | | |
| public: | | public: | |
|
| typedef dyn_detail::boost::shared_ptr<EventNewThread> ptr; | | typedef boost::shared_ptr<EventNewThread> ptr; | |
| typedef dyn_detail::boost::shared_ptr<const EventNewThread> const_ptr; | | typedef boost::shared_ptr<const EventNewThread> const_ptr; | |
| EventNewThread(Dyninst::LWP lwp_); | | EventNewThread(EventType et); | |
| virtual ~EventNewThread(); | | virtual ~EventNewThread(); | |
|
| Dyninst::LWP getLWP() const; | | | |
| Thread::const_ptr getNewThread() const; | | virtual Dyninst::LWP getLWP() const = 0; | |
| | | virtual Thread::const_ptr getNewThread() const = 0; | |
| | | }; | |
| | | | |
| | | class int_eventNewUserThread; | |
| | | class PC_EXPORT EventNewUserThread : public EventNewThread | |
| | | { | |
| | | friend void boost::checked_delete<EventNewUserThread>(EventNewUserThread | |
| | | *); | |
| | | friend void boost::checked_delete<const EventNewUserThread>(const EventN | |
| | | ewUserThread *); | |
| | | private: | |
| | | int_eventNewUserThread *iev; | |
| | | public: | |
| | | typedef boost::shared_ptr<EventNewUserThread> ptr; | |
| | | typedef boost::shared_ptr<const EventNewUserThread> const_ptr; | |
| | | | |
| | | EventNewUserThread(); | |
| | | virtual ~EventNewUserThread(); | |
| | | int_eventNewUserThread *getInternalEvent() const; | |
| | | | |
| | | virtual Dyninst::LWP getLWP() const; | |
| | | virtual Thread::const_ptr getNewThread() const; | |
| | | }; | |
| | | | |
| | | class PC_EXPORT EventNewLWP : public EventNewThread | |
| | | { | |
| | | friend void boost::checked_delete<EventNewLWP>(EventNewLWP *); | |
| | | friend void boost::checked_delete<const EventNewLWP>(const EventNewLWP * | |
| | | ); | |
| | | private: | |
| | | Dyninst::LWP lwp; | |
| | | public: | |
| | | typedef boost::shared_ptr<EventNewLWP> ptr; | |
| | | typedef boost::shared_ptr<const EventNewLWP> const_ptr; | |
| | | EventNewLWP(Dyninst::LWP lwp_); | |
| | | virtual ~EventNewLWP(); | |
| | | | |
| | | virtual Dyninst::LWP getLWP() const; | |
| | | virtual Thread::const_ptr getNewThread() const; | |
| | | }; | |
| | | | |
| | | class PC_EXPORT EventThreadDestroy : public Event | |
| | | { | |
| | | friend void boost::checked_delete<EventThreadDestroy>(EventThreadDestroy | |
| | | *); | |
| | | friend void boost::checked_delete<const EventThreadDestroy>(const EventT | |
| | | hreadDestroy *); | |
| | | public: | |
| | | typedef boost::shared_ptr<EventThreadDestroy> ptr; | |
| | | typedef boost::shared_ptr<const EventThreadDestroy> const_ptr; | |
| | | EventThreadDestroy(EventType et); | |
| | | virtual ~EventThreadDestroy() = 0; | |
| }; | | }; | |
| | | | |
|
| class EventThreadDestroy : public Event | | class PC_EXPORT EventUserThreadDestroy : public EventThreadDestroy | |
| { | | { | |
|
| friend void dyn_detail::boost::checked_delete<EventThreadDestroy>(EventT | | friend void boost::checked_delete<EventUserThreadDestroy>(EventUserThrea | |
| hreadDestroy *); | | dDestroy *); | |
| friend void dyn_detail::boost::checked_delete<const EventThreadDestroy>( | | friend void boost::checked_delete<const EventUserThreadDestroy>(const Ev | |
| const EventThreadDestroy *); | | entUserThreadDestroy *); | |
| public: | | public: | |
|
| typedef dyn_detail::boost::shared_ptr<EventThreadDestroy> ptr; | | typedef boost::shared_ptr<EventUserThreadDestroy> ptr; | |
| typedef dyn_detail::boost::shared_ptr<const EventThreadDestroy> const_pt | | typedef boost::shared_ptr<const EventUserThreadDestroy> const_ptr; | |
| r; | | EventUserThreadDestroy(EventType::Time time_); | |
| EventThreadDestroy(EventType::Time time_); | | virtual ~EventUserThreadDestroy(); | |
| virtual ~EventThreadDestroy(); | | | |
| }; | | }; | |
| | | | |
|
| class EventFork : public Event | | class PC_EXPORT EventLWPDestroy : public EventThreadDestroy | |
| { | | { | |
|
| friend void dyn_detail::boost::checked_delete<EventFork>(EventFork *); | | friend void boost::checked_delete<EventLWPDestroy>(EventLWPDestroy *); | |
| friend void dyn_detail::boost::checked_delete<const EventFork>(const Eve | | friend void boost::checked_delete<const EventLWPDestroy>(const EventLWPD | |
| ntFork *); | | estroy *); | |
| | | public: | |
| | | typedef boost::shared_ptr<EventLWPDestroy> ptr; | |
| | | typedef boost::shared_ptr<const EventLWPDestroy> const_ptr; | |
| | | EventLWPDestroy(EventType::Time time_); | |
| | | virtual ~EventLWPDestroy(); | |
| | | }; | |
| | | | |
| | | class PC_EXPORT EventFork : public Event | |
| | | { | |
| | | friend void boost::checked_delete<EventFork>(EventFork *); | |
| | | friend void boost::checked_delete<const EventFork>(const EventFork *); | |
| private: | | private: | |
| Dyninst::PID pid; | | Dyninst::PID pid; | |
| public: | | public: | |
|
| typedef dyn_detail::boost::shared_ptr<EventFork> ptr; | | typedef boost::shared_ptr<EventFork> ptr; | |
| typedef dyn_detail::boost::shared_ptr<const EventFork> const_ptr; | | typedef boost::shared_ptr<const EventFork> const_ptr; | |
| EventFork(Dyninst::PID pid_); | | EventFork(EventType::Time time_, Dyninst::PID pid_); | |
| virtual ~EventFork(); | | virtual ~EventFork(); | |
| Dyninst::PID getPID() const; | | Dyninst::PID getPID() const; | |
| Process::const_ptr getChildProcess() const; | | Process::const_ptr getChildProcess() const; | |
| }; | | }; | |
| | | | |
|
| class EventSignal : public Event | | class PC_EXPORT EventSignal : public Event | |
| { | | { | |
|
| friend void dyn_detail::boost::checked_delete<EventSignal>(EventSignal * | | friend void boost::checked_delete<EventSignal>(EventSignal *); | |
| ); | | friend void boost::checked_delete<const EventSignal>(const EventSignal * | |
| friend void dyn_detail::boost::checked_delete<const EventSignal>(const E | | ); | |
| ventSignal *); | | | |
| private: | | private: | |
| int sig; | | int sig; | |
| public: | | public: | |
|
| typedef dyn_detail::boost::shared_ptr<EventSignal> ptr; | | typedef boost::shared_ptr<EventSignal> ptr; | |
| typedef dyn_detail::boost::shared_ptr<const EventSignal> const_ptr; | | typedef boost::shared_ptr<const EventSignal> const_ptr; | |
| EventSignal(int sig); | | EventSignal(int sig); | |
| virtual ~EventSignal(); | | virtual ~EventSignal(); | |
| | | | |
| int getSignal() const; | | int getSignal() const; | |
|
| | | void setThreadSignal(int newSignal) const; | |
| | | void clearThreadSignal() const; | |
| }; | | }; | |
| | | | |
|
| class EventBootstrap : public Event | | class PC_EXPORT EventBootstrap : public Event | |
| { | | { | |
|
| friend void dyn_detail::boost::checked_delete<EventBootstrap>(EventBoots | | friend void boost::checked_delete<EventBootstrap>(EventBootstrap *); | |
| trap *); | | friend void boost::checked_delete<const EventBootstrap>(const EventBoots | |
| friend void dyn_detail::boost::checked_delete<const EventBootstrap>(cons | | trap *); | |
| t EventBootstrap *); | | | |
| public: | | public: | |
|
| typedef dyn_detail::boost::shared_ptr<EventBootstrap> ptr; | | typedef boost::shared_ptr<EventBootstrap> ptr; | |
| typedef dyn_detail::boost::shared_ptr<const EventBootstrap> const_ptr; | | typedef boost::shared_ptr<const EventBootstrap> const_ptr; | |
| EventBootstrap(); | | EventBootstrap(); | |
| virtual ~EventBootstrap(); | | virtual ~EventBootstrap(); | |
| }; | | }; | |
| | | | |
|
| | | class PC_EXPORT EventPreBootstrap : public Event | |
| | | { | |
| | | friend void boost::checked_delete<EventPreBootstrap>(EventPreBootstrap * | |
| | | ); | |
| | | friend void boost::checked_delete<const EventPreBootstrap>(const EventPr | |
| | | eBootstrap *); | |
| | | public: | |
| | | typedef boost::shared_ptr<EventPreBootstrap> ptr; | |
| | | typedef boost::shared_ptr<const EventPreBootstrap> const_ptr; | |
| | | EventPreBootstrap(); | |
| | | virtual ~EventPreBootstrap(); | |
| | | }; | |
| | | | |
| class int_eventRPC; | | class int_eventRPC; | |
|
| class EventRPC : public Event | | class PC_EXPORT EventRPC : public Event | |
| { | | { | |
|
| friend void dyn_detail::boost::checked_delete<EventRPC>(EventRPC *); | | friend void boost::checked_delete<EventRPC>(EventRPC *); | |
| friend void dyn_detail::boost::checked_delete<const EventRPC>(const Even | | friend void boost::checked_delete<const EventRPC>(const EventRPC *); | |
| tRPC *); | | | |
| private: | | private: | |
| int_eventRPC *int_rpc; | | int_eventRPC *int_rpc; | |
| rpc_wrapper *wrapper; | | rpc_wrapper *wrapper; | |
| public: | | public: | |
| virtual bool suppressCB() const; | | virtual bool suppressCB() const; | |
| rpc_wrapper *getllRPC(); | | rpc_wrapper *getllRPC(); | |
|
| typedef dyn_detail::boost::shared_ptr<EventRPC> ptr; | | typedef boost::shared_ptr<EventRPC> ptr; | |
| typedef dyn_detail::boost::shared_ptr<const EventRPC> const_ptr; | | typedef boost::shared_ptr<const EventRPC> const_ptr; | |
| EventRPC(rpc_wrapper *wrapper_); | | EventRPC(rpc_wrapper *wrapper_); | |
| virtual ~EventRPC(); | | virtual ~EventRPC(); | |
| | | | |
| IRPC::const_ptr getIRPC() const; | | IRPC::const_ptr getIRPC() const; | |
| int_eventRPC *getInternal() const; | | int_eventRPC *getInternal() const; | |
| }; | | }; | |
| | | | |
|
| class EventRPCInternal : public Event | | class PC_EXPORT EventRPCLaunch : public Event | |
| { | | { | |
|
| friend void dyn_detail::boost::checked_delete<EventRPCInternal>(EventRPC | | friend void boost::checked_delete<EventRPCLaunch>(EventRPCLaunch *); | |
| Internal *); | | friend void boost::checked_delete<const EventRPCLaunch>(const EventRPCLa | |
| friend void dyn_detail::boost::checked_delete<const EventRPCInternal>(co | | unch *); | |
| nst EventRPCInternal *); | | | |
| public: | | public: | |
|
| typedef dyn_detail::boost::shared_ptr<EventRPCInternal> ptr; | | typedef boost::shared_ptr<EventRPCLaunch> ptr; | |
| typedef dyn_detail::boost::shared_ptr<const EventRPCInternal> const_ptr; | | typedef boost::shared_ptr<const EventRPCLaunch> const_ptr; | |
| virtual bool suppressCB() const; | | virtual bool procStopper() const; | |
| EventRPCInternal(); | | EventRPCLaunch(); | |
| virtual ~EventRPCInternal(); | | virtual ~EventRPCLaunch(); | |
| }; | | }; | |
| | | | |
|
| class EventSingleStep : public Event | | class PC_EXPORT EventSingleStep : public Event | |
| { | | { | |
|
| friend void dyn_detail::boost::checked_delete<EventSingleStep>(EventSing | | friend void boost::checked_delete<EventSingleStep>(EventSingleStep *); | |
| leStep *); | | friend void boost::checked_delete<const EventSingleStep>(const EventSing | |
| friend void dyn_detail::boost::checked_delete<const EventSingleStep>(con | | leStep *); | |
| st EventSingleStep *); | | | |
| public: | | public: | |
|
| typedef dyn_detail::boost::shared_ptr<EventSingleStep> ptr; | | typedef boost::shared_ptr<EventSingleStep> ptr; | |
| typedef dyn_detail::boost::shared_ptr<const EventSingleStep> const_ptr; | | typedef boost::shared_ptr<const EventSingleStep> const_ptr; | |
| EventSingleStep(); | | EventSingleStep(); | |
| virtual ~EventSingleStep(); | | virtual ~EventSingleStep(); | |
| }; | | }; | |
| | | | |
| class int_eventBreakpoint; | | class int_eventBreakpoint; | |
|
| class EventBreakpoint : public Event | | class PC_EXPORT EventBreakpoint : public Event | |
| { | | { | |
|
| friend void dyn_detail::boost::checked_delete<EventBreakpoint>(EventBrea | | friend void boost::checked_delete<EventBreakpoint>(EventBreakpoint *); | |
| kpoint *); | | friend void boost::checked_delete<const EventBreakpoint>(const EventBrea | |
| friend void dyn_detail::boost::checked_delete<const EventBreakpoint>(con | | kpoint *); | |
| st EventBreakpoint *); | | | |
| private: | | private: | |
|
| installed_breakpoint *ibp; | | | |
| int_eventBreakpoint *int_bp; | | int_eventBreakpoint *int_bp; | |
|
| Dyninst::Address addr; | | | |
| public: | | public: | |
|
| typedef dyn_detail::boost::shared_ptr<EventBreakpoint> ptr; | | typedef boost::shared_ptr<EventBreakpoint> ptr; | |
| typedef dyn_detail::boost::shared_ptr<const EventBreakpoint> const_ptr; | | typedef boost::shared_ptr<const EventBreakpoint> const_ptr; | |
| installed_breakpoint *installedbp() const; | | | |
| int_eventBreakpoint *getInternal() const; | | int_eventBreakpoint *getInternal() const; | |
| | | | |
|
| EventBreakpoint(Dyninst::Address addr, installed_breakpoint *ibp_); | | EventBreakpoint(int_eventBreakpoint *ibp); | |
| virtual ~EventBreakpoint(); | | virtual ~EventBreakpoint(); | |
| | | | |
| Dyninst::Address getAddress() const; | | Dyninst::Address getAddress() const; | |
| void getBreakpoints(std::vector<Breakpoint::const_ptr> &bps) const; | | void getBreakpoints(std::vector<Breakpoint::const_ptr> &bps) const; | |
|
| | | void getBreakpoints(std::vector<Breakpoint::ptr> &bps); | |
| virtual bool suppressCB() const; | | virtual bool suppressCB() const; | |
| virtual bool procStopper() const; | | virtual bool procStopper() const; | |
| }; | | }; | |
| | | | |
| class int_eventBreakpointClear; | | class int_eventBreakpointClear; | |
|
| class EventBreakpointClear : public Event | | class PC_EXPORT EventBreakpointClear : public Event | |
| { | | { | |
|
| friend void dyn_detail::boost::checked_delete<EventBreakpointClear>(Even | | friend void boost::checked_delete<EventBreakpointClear>(EventBreakpointC | |
| tBreakpointClear *); | | lear *); | |
| friend void dyn_detail::boost::checked_delete<const EventBreakpointClear | | friend void boost::checked_delete<const EventBreakpointClear>(const Even | |
| >(const EventBreakpointClear *); | | tBreakpointClear *); | |
| private: | | private: | |
|
| installed_breakpoint *bp_; | | | |
| int_eventBreakpointClear *int_bpc; | | int_eventBreakpointClear *int_bpc; | |
| public: | | public: | |
|
| typedef dyn_detail::boost::shared_ptr<EventBreakpointClear> ptr; | | typedef boost::shared_ptr<EventBreakpointClear> ptr; | |
| typedef dyn_detail::boost::shared_ptr<const EventBreakpointClear> const_ | | typedef boost::shared_ptr<const EventBreakpointClear> const_ptr; | |
| ptr; | | EventBreakpointClear(); | |
| EventBreakpointClear(installed_breakpoint *bp); | | | |
| virtual ~EventBreakpointClear(); | | virtual ~EventBreakpointClear(); | |
| | | | |
|
| installed_breakpoint *bp() const; | | | |
| int_eventBreakpointClear *getInternal() const; | | int_eventBreakpointClear *getInternal() const; | |
|
| | | virtual bool procStopper() const; | |
| }; | | }; | |
| | | | |
|
| class EventLibrary : public Event | | class int_eventBreakpointRestore; | |
| | | class EventBreakpointRestore : public Event | |
| { | | { | |
|
| friend void dyn_detail::boost::checked_delete<EventLibrary>(EventLibrary | | friend void boost::checked_delete<EventBreakpointRestore>(EventBreakpoin | |
| *); | | tRestore *); | |
| friend void dyn_detail::boost::checked_delete<const EventLibrary>(const | | friend void boost::checked_delete<const EventBreakpointRestore>(const Ev | |
| EventLibrary *); | | entBreakpointRestore *); | |
| | | private: | |
| | | int_eventBreakpointRestore *int_bpr; | |
| | | public: | |
| | | typedef boost::shared_ptr<EventBreakpointRestore> ptr; | |
| | | typedef boost::shared_ptr<const EventBreakpointRestore> const_ptr; | |
| | | | |
| | | EventBreakpointRestore(int_eventBreakpointRestore *iebpr); | |
| | | virtual ~EventBreakpointRestore(); | |
| | | | |
| | | int_eventBreakpointRestore *getInternal() const; | |
| | | }; | |
| | | | |
| | | class PC_EXPORT EventLibrary : public Event | |
| | | { | |
| | | friend void boost::checked_delete<EventLibrary>(EventLibrary *); | |
| | | friend void boost::checked_delete<const EventLibrary>(const EventLibrary | |
| | | *); | |
| private: | | private: | |
| std::set<Library::ptr> added_libs; | | std::set<Library::ptr> added_libs; | |
| std::set<Library::ptr> rmd_libs; | | std::set<Library::ptr> rmd_libs; | |
| public: | | public: | |
|
| typedef dyn_detail::boost::shared_ptr<EventLibrary> ptr; | | typedef boost::shared_ptr<EventLibrary> ptr; | |
| typedef dyn_detail::boost::shared_ptr<const EventLibrary> const_ptr; | | typedef boost::shared_ptr<const EventLibrary> const_ptr; | |
| EventLibrary(); | | EventLibrary(); | |
| EventLibrary(const std::set<Library::ptr> &added_libs_, | | EventLibrary(const std::set<Library::ptr> &added_libs_, | |
| const std::set<Library::ptr> &rmd_libs_); | | const std::set<Library::ptr> &rmd_libs_); | |
| virtual ~EventLibrary(); | | virtual ~EventLibrary(); | |
| | | | |
| void setLibs(const std::set<Library::ptr> &added_libs_, | | void setLibs(const std::set<Library::ptr> &added_libs_, | |
| const std::set<Library::ptr> &rmd_libs_); | | const std::set<Library::ptr> &rmd_libs_); | |
| const std::set<Library::ptr> &libsAdded() const; | | const std::set<Library::ptr> &libsAdded() const; | |
| const std::set<Library::ptr> &libsRemoved() const; | | const std::set<Library::ptr> &libsRemoved() const; | |
| }; | | }; | |
| | | | |
| class int_eventAsync; | | class int_eventAsync; | |
|
| class EventAsync : public Event | | class PC_EXPORT EventAsync : public Event | |
| { | | { | |
|
| friend void dyn_detail::boost::checked_delete<EventAsync>(EventAsync *); | | friend void boost::checked_delete<EventAsync>(EventAsync *); | |
| friend void dyn_detail::boost::checked_delete<const EventAsync>(const Ev | | friend void boost::checked_delete<const EventAsync>(const EventAsync *); | |
| entAsync *); | | | |
| | | | |
| private: | | private: | |
| int_eventAsync *internal; | | int_eventAsync *internal; | |
| public: | | public: | |
|
| typedef dyn_detail::boost::shared_ptr<EventAsync> ptr; | | typedef boost::shared_ptr<EventAsync> ptr; | |
| typedef dyn_detail::boost::shared_ptr<const EventAsync> const_ptr; | | typedef boost::shared_ptr<const EventAsync> const_ptr; | |
| | | | |
| EventAsync(int_eventAsync *ievent); | | EventAsync(int_eventAsync *ievent); | |
| virtual ~EventAsync(); | | virtual ~EventAsync(); | |
|
| | | | |
| int_eventAsync *getInternal() const; | | int_eventAsync *getInternal() const; | |
| }; | | }; | |
| | | | |
|
| class EventChangePCStop : public Event | | class PC_EXPORT EventChangePCStop : public Event | |
| { | | { | |
|
| friend void dyn_detail::boost::checked_delete<EventChangePCStop>(EventCh | | friend void boost::checked_delete<EventChangePCStop>(EventChangePCStop * | |
| angePCStop *); | | ); | |
| friend void dyn_detail::boost::checked_delete<const EventChangePCStop>(c | | friend void boost::checked_delete<const EventChangePCStop>(const EventCh | |
| onst EventChangePCStop *); | | angePCStop *); | |
| public: | | public: | |
|
| typedef dyn_detail::boost::shared_ptr<EventChangePCStop> ptr; | | typedef boost::shared_ptr<EventChangePCStop> ptr; | |
| typedef dyn_detail::boost::shared_ptr<const EventChangePCStop> const_ptr | | typedef boost::shared_ptr<const EventChangePCStop> const_ptr; | |
| ; | | | |
| EventChangePCStop(); | | EventChangePCStop(); | |
|
| ~EventChangePCStop(); | | virtual ~EventChangePCStop(); | |
| | | }; | |
| | | | |
| | | class int_eventDetach; | |
| | | class PC_EXPORT EventDetach : public Event | |
| | | { | |
| | | friend void boost::checked_delete<EventDetach>(EventDetach *); | |
| | | friend void boost::checked_delete<const EventDetach>(const EventDetach * | |
| | | ); | |
| | | int_eventDetach *int_detach; | |
| | | public: | |
| | | typedef boost::shared_ptr<EventDetach> ptr; | |
| | | typedef boost::shared_ptr<const EventDetach> const_ptr; | |
| | | | |
| | | EventDetach(); | |
| | | virtual ~EventDetach(); | |
| | | int_eventDetach *getInternal() const; | |
| | | virtual bool procStopper() const; | |
| | | }; | |
| | | | |
| | | class PC_EXPORT EventIntBootstrap : public Event | |
| | | { | |
| | | friend void boost::checked_delete<EventIntBootstrap>(EventIntBootstrap * | |
| | | ); | |
| | | friend void boost::checked_delete<const EventIntBootstrap>(const EventIn | |
| | | tBootstrap *); | |
| | | | |
| | | void *data; | |
| | | public: | |
| | | typedef boost::shared_ptr<EventIntBootstrap> ptr; | |
| | | typedef boost::shared_ptr<const EventIntBootstrap> const_ptr; | |
| | | EventIntBootstrap(void *d = NULL); | |
| | | virtual ~EventIntBootstrap(); | |
| | | | |
| | | void *getData() const; | |
| | | void setData(void *v); | |
| | | }; | |
| | | | |
| | | class PC_EXPORT EventNop : public Event | |
| | | { | |
| | | friend void boost::checked_delete<EventNop>(EventNop *); | |
| | | friend void boost::checked_delete<const EventNop>(const EventNop *); | |
| | | public: | |
| | | typedef boost::shared_ptr<EventNop> ptr; | |
| | | typedef boost::shared_ptr<const EventNop> const_ptr; | |
| | | EventNop(); | |
| | | virtual ~EventNop(); | |
| | | }; | |
| | | | |
| | | class int_eventThreadDB; | |
| | | class PC_EXPORT EventThreadDB : public Event | |
| | | { | |
| | | friend void boost::checked_delete<EventThreadDB>(EventThreadDB *); | |
| | | friend void boost::checked_delete<const EventThreadDB>(const EventThread | |
| | | DB *); | |
| | | int_eventThreadDB *int_etdb; | |
| | | public: | |
| | | typedef boost::shared_ptr<EventThreadDB> ptr; | |
| | | typedef boost::shared_ptr<const EventThreadDB> const_ptr; | |
| | | int_eventThreadDB *getInternal() const; | |
| | | | |
| | | EventThreadDB(); | |
| | | virtual ~EventThreadDB(); | |
| | | | |
| | | virtual bool triggersCB() const; | |
| | | }; | |
| | | | |
| | | class PC_EXPORT EventWinStopThreadDestroy : public EventThreadDestroy | |
| | | { | |
| | | friend void boost::checked_delete<EventWinStopThreadDestroy>(EventWinSto | |
| | | pThreadDestroy *); | |
| | | friend void boost::checked_delete<const EventWinStopThreadDestroy>(const | |
| | | EventWinStopThreadDestroy *); | |
| | | public: | |
| | | typedef boost::shared_ptr<EventWinStopThreadDestroy> ptr; | |
| | | typedef boost::shared_ptr<const EventWinStopThreadDestroy> const_ptr; | |
| | | EventWinStopThreadDestroy(EventType::Time time_); | |
| | | virtual ~EventWinStopThreadDestroy(); | |
| }; | | }; | |
| | | | |
| } | | } | |
| } | | } | |
| #endif | | #endif | |
| | | | |
End of changes. 106 change blocks. |
| 213 lines changed or deleted | | 455 lines changed or added | |
|
| InstructionAdapter.h | | InstructionAdapter.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 34 | |
| * 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(INSTRUCTION_ADAPTER_H) | | #if !defined(INSTRUCTION_ADAPTER_H) | |
| #define INSTRUCTION_ADAPTER_H | | #define INSTRUCTION_ADAPTER_H | |
| | | | |
|
| #include "dynutil/h/dyntypes.h" | | #include "dyntypes.h" | |
| | | | |
|
| #include "parseAPI/h/CodeObject.h" | | #include "CodeObject.h" | |
| #include "parseAPI/h/CFG.h" | | #include "CFG.h" | |
| | | | |
| | | #include "Instruction.h" | |
| | | | |
| #if !defined(ESSENTIAL_PARSING_ENUMS) | | #if !defined(ESSENTIAL_PARSING_ENUMS) | |
| #define ESSENTIAL_PARSING_ENUMS | | #define ESSENTIAL_PARSING_ENUMS | |
| // There are three levels of function-level "instrumentability": | | // There are three levels of function-level "instrumentability": | |
| // 1) The function can be instrumented normally with no problems (normal ca
se) | | // 1) The function can be instrumented normally with no problems (normal ca
se) | |
| // 2) The function contains unresolved indirect branches; we have to assume | | // 2) The function contains unresolved indirect branches; we have to assume | |
| // these can go anywhere in the function to be safe, so we must instrume
nt | | // these can go anywhere in the function to be safe, so we must instrume
nt | |
| // safely (e.g., with traps) | | // safely (e.g., with traps) | |
| // 3) The function is flatly uninstrumentable and must not be touched. | | // 3) The function is flatly uninstrumentable and must not be touched. | |
| enum InstrumentableLevel { | | enum InstrumentableLevel { | |
| | | | |
| skipping to change at line 70 | | skipping to change at line 71 | |
| public: | | public: | |
| InstructionAdapter(Address start, ParseAPI::CodeObject *o , | | InstructionAdapter(Address start, ParseAPI::CodeObject *o , | |
| ParseAPI::CodeRegion* r, InstructionSource * isrc, ParseAPI::B
lock *); | | ParseAPI::CodeRegion* r, InstructionSource * isrc, ParseAPI::B
lock *); | |
| virtual ~InstructionAdapter(); | | virtual ~InstructionAdapter(); | |
| | | | |
| // 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 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 isAbortOrInvalidInsn() const = 0; | |
|
| | | 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; | |
| virtual bool isAbsoluteCall() const = 0; | | virtual bool isAbsoluteCall() const = 0; | |
| virtual InstrumentableLevel getInstLevel(ParseAPI::Function* context, u
nsigned int num_insns) const; | | virtual InstrumentableLevel getInstLevel(ParseAPI::Function* context, u
nsigned int num_insns) const; | |
| virtual ParseAPI::FuncReturnStatus getReturnStatus(ParseAPI::Function*
context, unsigned int num_insns) const ; | | virtual ParseAPI::FuncReturnStatus getReturnStatus(ParseAPI::Function*
context, unsigned int num_insns) const ; | |
| virtual bool hasUnresolvedControlFlow(ParseAPI::Function* context, unsi
gned int num_insns) | | virtual bool hasUnresolvedControlFlow(ParseAPI::Function* context, unsi
gned int num_insns) | |
| const; | | const; | |
|
| virtual ParseAPI::StackTamper tampersStack(ParseAPI::Function *, Addres | | virtual bool isNopJump() const { return false; } | |
| s &) const | | | |
| { return ParseAPI::TAMPER_NONE; } | | | |
| virtual bool simulateJump() const= 0; | | virtual bool simulateJump() const= 0; | |
| virtual void advance() = 0; | | virtual void advance() = 0; | |
|
| virtual void retreat() = 0; | | virtual bool retreat() = 0; | |
| virtual bool isNop() const = 0; | | virtual bool isNop() const = 0; | |
| virtual bool isLeave() const = 0; | | virtual bool isLeave() const = 0; | |
| virtual bool isDelaySlot() const = 0; | | virtual bool isDelaySlot() const = 0; | |
| virtual bool isRelocatable(InstrumentableLevel lvl) const = 0; | | virtual bool isRelocatable(InstrumentableLevel lvl) const = 0; | |
| virtual Address getAddr() const; | | virtual Address getAddr() const; | |
| virtual Address getPrevAddr() const; | | virtual Address getPrevAddr() const; | |
| virtual Address getNextAddr() const; | | virtual Address getNextAddr() const; | |
|
| virtual 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 *,unsigned int num_insns) co
nst = 0; | |
| protected: | | protected: | |
| | | | |
End of changes. 9 change blocks. |
| 15 lines changed or deleted | | 16 lines changed or added | |
|
| PCErrors.h | | PCErrors.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 34 | |
| * 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(PCERRORS_H_) | | #if !defined(PCERRORS_H_) | |
| #define PCERRORS_H_ | | #define PCERRORS_H_ | |
| | | | |
|
| | | // Only works on posix-compliant systems. IE not windows. | |
| | | //#define PROCCTRL_PRINT_TIMINGS 1 | |
| | | | |
| #include <stdio.h> | | #include <stdio.h> | |
|
| | | #include "util.h" | |
| | | | |
| #define pclean_printf(format, ...) \ | | #define pclean_printf(format, ...) \ | |
| do { \ | | do { \ | |
| if (dyninst_debug_proccontrol) \ | | if (dyninst_debug_proccontrol) \ | |
| fprintf(pctrl_err_out, format, ## __VA_ARGS__); \ | | fprintf(pctrl_err_out, format, ## __VA_ARGS__); \ | |
| } while (0) | | } while (0) | |
| | | | |
|
| | | #if defined(PROCCTRL_PRINT_TIMINGS) | |
| | | | |
| #define pthrd_printf(format, ...) \ | | #define pthrd_printf(format, ...) \ | |
| do { \ | | do { \ | |
|
| | | if (dyninst_debug_proccontrol) { \ | |
| | | fprintf(pctrl_err_out, "[%s:%u-%s@%lu] - " format, __FILE__, __LINE_ | |
| | | _, thrdName(), gettod(), ## __VA_ARGS__); \ | |
| | | } \ | |
| | | } while (0) | |
| | | | |
| | | #define perr_printf(format, ...) \ | |
| | | do { \ | |
| if (dyninst_debug_proccontrol) \ | | if (dyninst_debug_proccontrol) \ | |
|
| fprintf(pctrl_err_out, "[%s:%u-%s] - " format, __FILE__, __LINE__, th | | fprintf(pctrl_err_out, "[%s:%u-%s@%lu] - Error: " format, __FILE__, | |
| rdName(), ## __VA_ARGS__); \ | | __LINE__, thrdName(), gettod(), ## __VA_ARGS__); \ | |
| | | } while (0) | |
| | | | |
| | | #else | |
| | | | |
| | | #define pthrd_printf(format, ...) \ | |
| | | do { \ | |
| | | if (dyninst_debug_proccontrol) { \ | |
| | | fprintf(pctrl_err_out, "[%s:%u-%s] - " format, __FILE__, __LINE__, t | |
| | | hrdName(), ## __VA_ARGS__); \ | |
| | | } \ | |
| } while (0) | | } while (0) | |
| | | | |
| #define perr_printf(format, ...) \ | | #define perr_printf(format, ...) \ | |
| do { \ | | do { \ | |
| if (dyninst_debug_proccontrol) \ | | if (dyninst_debug_proccontrol) \ | |
|
| fprintf(pctrl_err_out, "[%s:%u-%s] - " format, __FILE__, __LINE__, th
rdName(), ## __VA_ARGS__); \ | | fprintf(pctrl_err_out, "[%s:%u-%s] - Error: " format, __FILE__, __LI
NE__, thrdName(), ## __VA_ARGS__); \ | |
| } while (0) | | } while (0) | |
| | | | |
|
| | | #endif | |
| | | | |
| extern bool dyninst_debug_proccontrol; | | extern bool dyninst_debug_proccontrol; | |
| extern const char *thrdName(); | | extern const char *thrdName(); | |
| extern FILE* pctrl_err_out; | | extern FILE* pctrl_err_out; | |
| | | | |
|
| | | extern unsigned long gettod(); | |
| | | | |
| namespace Dyninst { | | namespace Dyninst { | |
| namespace ProcControlAPI { | | namespace ProcControlAPI { | |
| | | | |
| typedef unsigned err_t; | | typedef unsigned err_t; | |
| | | | |
|
| | | const err_t err_none = 0x0; | |
| const err_t err_badparam = 0x10000; | | const err_t err_badparam = 0x10000; | |
| const err_t err_procread = 0x10001; | | const err_t err_procread = 0x10001; | |
| const err_t err_internal = 0x10002; | | const err_t err_internal = 0x10002; | |
| const err_t err_prem = 0x10003; | | const err_t err_prem = 0x10003; | |
| const err_t err_noproc = 0x10004; | | const err_t err_noproc = 0x10004; | |
| const err_t err_interrupt = 0x10005; | | const err_t err_interrupt = 0x10005; | |
| const err_t err_exited = 0x10006; | | const err_t err_exited = 0x10006; | |
| const err_t err_nofile = 0x10007; | | const err_t err_nofile = 0x10007; | |
| const err_t err_unsupported = 0x10008; | | const err_t err_unsupported = 0x10008; | |
| const err_t err_symtab = 0x10009; | | const err_t err_symtab = 0x10009; | |
|
| const err_t err_nothrd = 0x10010; | | const err_t err_nothrd = 0x1000a; | |
| const err_t err_notstopped = 0x10011; | | const err_t err_notstopped = 0x1000b; | |
| const err_t err_notrunning = 0x10012; | | const err_t err_notrunning = 0x1000c; | |
| const err_t err_noevents = 0x10013; | | const err_t err_noevents = 0x1000d; | |
| const err_t err_incallback = 0x10014; | | const err_t err_incallback = 0x1000e; | |
| | | const err_t err_nouserthrd = 0x1000f; | |
| err_t getLastError(); | | const err_t err_detached = 0x10010; | |
| void clearLastError(); | | const err_t err_attached = 0x10011; | |
| const char *getLastErrorMsg(); | | const err_t err_pendingirpcs = 0x10012; | |
| void setLastError(err_t err, const char *msg = NULL); | | const err_t err_bpfull = 0x10013; | |
| void setDebugChannel(FILE *f); | | const err_t err_notfound = 0x10014; | |
| void setDebug(bool enable); | | | |
| | | PC_EXPORT err_t getLastError(); | |
| FILE *getDebugChannel(); | | PC_EXPORT void clearLastError(); | |
| | | PC_EXPORT const char* getLastErrorMsg(); | |
| | | PC_EXPORT void globalSetLastError(err_t err, const char *msg = NULL); | |
| | | PC_EXPORT void setDebugChannel(FILE *f); | |
| | | PC_EXPORT void setDebug(bool enable); | |
| | | PC_EXPORT const char *getGenericErrorMsg(err_t e); | |
| | | PC_EXPORT FILE *getDebugChannel(); | |
| | | | |
| } | | } | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 12 change blocks. |
| 24 lines changed or deleted | | 58 lines changed or added | |
|
| ParseCallback.h | | ParseCallback.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 49 | | skipping to change at line 48 | |
| during parsing. | | during parsing. | |
| **/ | | **/ | |
| | | | |
| #include "InstructionAdapter.h" | | #include "InstructionAdapter.h" | |
| #include "dyntypes.h" | | #include "dyntypes.h" | |
| | | | |
| namespace Dyninst { | | namespace Dyninst { | |
| namespace ParseAPI { | | namespace ParseAPI { | |
| | | | |
| class Function; | | class Function; | |
|
| | | class Block; | |
| | | class Edge; | |
| | | class ParseCallbackManager; | |
| | | | |
| class ParseCallback { | | class ParseCallback { | |
|
| | | friend class ParseCallbackManager; | |
| public: | | public: | |
| ParseCallback() { } | | ParseCallback() { } | |
| virtual ~ParseCallback() { } | | virtual ~ParseCallback() { } | |
| | | | |
| /* | | /* | |
| * Notify when control transfers have run `off the rails' | | * Notify when control transfers have run `off the rails' | |
| */ | | */ | |
| struct default_details { | | struct default_details { | |
| default_details(unsigned char*b,size_t s, bool ib) : ibuf(b), isize(s),
isbranch(ib) { } | | default_details(unsigned char*b,size_t s, bool ib) : ibuf(b), isize(s),
isbranch(ib) { } | |
| unsigned char * ibuf; | | unsigned char * ibuf; | |
| size_t isize; | | size_t isize; | |
| bool isbranch; | | bool isbranch; | |
| }; | | }; | |
|
| virtual void unresolved_cf(Function *,Address,default_details*) { } | | | |
| virtual void abruptEnd_cf(Address,default_details*) { } | | | |
| | | | |
| /* | | /* | |
| * Notify for interprocedural control transfers | | * Notify for interprocedural control transfers | |
| */ | | */ | |
| struct interproc_details { | | struct interproc_details { | |
| typedef enum { | | typedef enum { | |
| ret, | | ret, | |
| call, | | call, | |
| branch_interproc, // tail calls, branches to plts | | branch_interproc, // tail calls, branches to plts | |
|
| syscall | | syscall, | |
| | | unresolved | |
| } type_t; | | } type_t; | |
| unsigned char * ibuf; | | unsigned char * ibuf; | |
| size_t isize; | | size_t isize; | |
| type_t type; | | type_t type; | |
| union { | | union { | |
| struct { | | struct { | |
| Address target; | | Address target; | |
| bool absolute_address; | | bool absolute_address; | |
| bool dynamic_call; | | bool dynamic_call; | |
| } call; | | } call; | |
|
| | | struct { | |
| | | Address target; | |
| | | bool absolute_address; | |
| | | bool dynamic; | |
| | | } unres; | |
| } data; | | } data; | |
| }; | | }; | |
|
| virtual void interproc_cf(Function*,Address,interproc_details*) { } | | | |
| | | | |
|
| /* | | | |
| * Allow examination of every instruction processed during parsing. | | | |
| */ | | | |
| struct insn_details { | | struct insn_details { | |
| InsnAdapter::InstructionAdapter * insn; | | InsnAdapter::InstructionAdapter * insn; | |
| }; | | }; | |
|
| virtual void instruction_cb(Function*,Address,insn_details*) { } | | | |
| | | typedef enum { | |
| | | source, | |
| | | target } edge_type_t; | |
| | | | |
| | | // Callbacks | |
| | | protected: | |
| | | virtual void interproc_cf(Function*,Block *,Address,interproc_details*) { | |
| | | } | |
| | | | |
| | | /* | |
| | | * Allow examination of every instruction processed during parsing. | |
| | | */ | |
| | | virtual void instruction_cb(Function*,Block *,Address,insn_details*) { } | |
| | | | |
| /* | | /* | |
| * Notify about inconsistent parse data (overlapping blocks). | | * Notify about inconsistent parse data (overlapping blocks). | |
| * The blocks are *not* guaranteed to be finished parsing at | | * The blocks are *not* guaranteed to be finished parsing at | |
| * the time the callback is fired. | | * the time the callback is fired. | |
| */ | | */ | |
| virtual void overlapping_blocks(Block*,Block*) { } | | virtual void overlapping_blocks(Block*,Block*) { } | |
| | | | |
| /* | | /* | |
| * Defensive-mode notifications: | | * Defensive-mode notifications: | |
| * - Notify when a function's parse is finalized so Dyninst can | | * - Notify when a function's parse is finalized so Dyninst can | |
| save its initial return status | | save its initial return status | |
| * - Notify every time a block is split, after the initial parse | | * - Notify every time a block is split, after the initial parse | |
| * of the function | | * of the function | |
| * - Notify of the x86 obfuscation that performs a short jmp -1 (eb ff) | | * - Notify of the x86 obfuscation that performs a short jmp -1 (eb ff) | |
| * so that dyninst can patch the opcode with a nop (0x90), which will | | * so that dyninst can patch the opcode with a nop (0x90), which will | |
| * keep code generation from doing bad things | | * keep code generation from doing bad things | |
| */ | | */ | |
| virtual void newfunction_retstatus(Function*) { } | | virtual void newfunction_retstatus(Function*) { } | |
|
| virtual void block_split(Block *, Block *) { } | | virtual void patch_nop_jump(Address) { } | |
| virtual void patch_jump_neg1(Address) { } | | virtual bool updateCodeBytes(Address) { return false; } | |
| | | virtual void abruptEnd_cf(Address, Block *,default_details*) { } | |
| | | | |
| | | // returns the load address of the code object containing an absolute add | |
| | | ress | |
| | | virtual bool absAddr(Address /*absolute*/, | |
| | | Address & /*loadAddr*/, | |
| | | CodeObject *& /*containerObject*/) | |
| | | { return false; } | |
| | | virtual bool hasWeirdInsns(const Function*) const { return false; }; | |
| | | virtual void foundWeirdInsns(Function*) {}; | |
| | | | |
| | | // User override time | |
| | | // (orig, new split block) | |
| | | virtual void split_block_cb(Block *, Block *) {}; | |
| | | | |
| | | virtual void destroy_cb(Block *) {}; | |
| | | virtual void destroy_cb(Edge *) {}; | |
| | | virtual void destroy_cb(Function *) {}; | |
| | | | |
| | | virtual void remove_edge_cb(Block *, Edge *, edge_type_t) {}; | |
| | | virtual void add_edge_cb(Block *, Edge *, edge_type_t) {}; | |
| | | | |
| | | virtual void remove_block_cb(Function *, Block *) {}; | |
| | | virtual void add_block_cb(Function *, Block *) {}; | |
| | | | |
| | | virtual void modify_edge_cb(Edge *, Block *, ParseCallback::edge_type_t) | |
| | | {}; | |
| | | | |
| | | private: | |
| | | }; | |
| | | | |
| | | // And the wrapper class used by CodeObject. | |
| | | | |
| | | class ParseCallbackManager { | |
| | | public: | |
| | | ParseCallbackManager(ParseCallback *b) : inBatch_(false) { if (b) registe | |
| | | rCallback(b); } | |
| | | virtual ~ParseCallbackManager(); | |
| | | | |
| | | typedef std::list<ParseCallback *> Callbacks; | |
| | | typedef Callbacks::iterator iterator; | |
| | | typedef Callbacks::const_iterator const_iterator; | |
| | | | |
| | | void registerCallback(ParseCallback *a); | |
| | | void unregisterCallback(ParseCallback *a); | |
| | | const_iterator begin() const { return cbs_.begin(); } | |
| | | const_iterator end() const { return cbs_.end(); } | |
| | | iterator begin() { return cbs_.begin(); } | |
| | | iterator end() { return cbs_.end(); } | |
| | | | |
| | | void batch_begin(); | |
| | | void batch_end(CFGFactory *fact); // fact provided so we can safely delet | |
| | | e | |
| | | | |
| | | // Batch-compatible methods | |
| | | void destroy(Block *, CFGFactory *fact); | |
| | | void destroy(Edge *, CFGFactory *fact); | |
| | | void destroy(Function *, CFGFactory *fact); | |
| | | void removeEdge(Block *, Edge *, ParseCallback::edge_type_t); | |
| | | void addEdge(Block *, Edge *, ParseCallback::edge_type_t); | |
| | | void removeBlock(Function *, Block *); | |
| | | void addBlock(Function *, Block *); | |
| | | void splitBlock(Block *, Block *); | |
| | | void modifyEdge(Edge *, Block *, ParseCallback::edge_type_t); | |
| | | | |
| | | void interproc_cf(Function*,Block *,Address,ParseCallback::interproc_deta | |
| | | ils*); | |
| | | void instruction_cb(Function*,Block *,Address,ParseCallback::insn_details | |
| | | *); | |
| | | void overlapping_blocks(Block*,Block*); | |
| | | void newfunction_retstatus(Function*); | |
| | | void patch_nop_jump(Address); | |
| | | bool updateCodeBytes(Address); | |
| | | void abruptEnd_cf(Address, Block *,ParseCallback::default_details*); | |
| | | bool absAddr(Address /*absolute*/, | |
| | | Address & /*loadAddr*/, | |
| | | CodeObject *& /*containerObject*/); | |
| | | bool hasWeirdInsns(const Function*); | |
| | | void foundWeirdInsns(Function*); | |
| | | void split_block_cb(Block *, Block *); | |
| | | | |
| | | private: | |
| | | // Named the same as ParseCallback to make the code | |
| | | // more readable. | |
| | | void destroy_cb(Block *); | |
| | | void destroy_cb(Edge *); | |
| | | void destroy_cb(Function *); | |
| | | void remove_edge_cb(Block *, Edge *, ParseCallback::edge_type_t); | |
| | | void add_edge_cb(Block *, Edge *, ParseCallback::edge_type_t); | |
| | | void remove_block_cb(Function *, Block *); | |
| | | void add_block_cb(Function *, Block *); | |
| | | void modify_edge_cb(Edge *, Block *, ParseCallback::edge_type_t); | |
| | | | |
| | | private: | |
| | | Callbacks cbs_; | |
| | | | |
| | | bool inBatch_; | |
| | | | |
| | | typedef enum { removed, added } mod_t; | |
| | | | |
| | | struct BlockMod { | |
| | | Block *block; | |
| | | Edge *edge; | |
| | | ParseCallback::edge_type_t type; | |
| | | mod_t action; | |
| | | BlockMod(Block *b, Edge *e, ParseCallback::edge_type_t t, mod_t m) : bloc | |
| | | k(b), edge(e), type(t), action(m) {}; | |
| | | }; | |
| | | | |
| | | struct EdgeMod { | |
| | | Edge *edge; | |
| | | Block *block; | |
| | | ParseCallback::edge_type_t action; | |
| | | | |
| | | EdgeMod(Edge *e, Block *b, ParseCallback::edge_type_t t) : | |
| | | edge(e), block(b), action(t) {}; | |
| | | }; | |
| | | | |
| | | struct FuncMod { | |
| | | Function *func; | |
| | | Block *block; | |
| | | mod_t action; | |
| | | FuncMod(Function *f, Block *b, mod_t m) : func(f), block(b), action(m) {} | |
| | | ; | |
| | | }; | |
| | | | |
| | | typedef std::pair<Block *, Block *> BlockSplit; | |
| | | | |
| | | std::vector<Edge *> destroyedEdges_; | |
| | | std::vector<Block *> destroyedBlocks_; | |
| | | std::vector<Function *> destroyedFunctions_; | |
| | | std::vector<BlockMod> blockMods_; | |
| | | std::vector<EdgeMod> edgeMods_; | |
| | | std::vector<FuncMod> funcMods_; | |
| | | std::vector<BlockSplit> blockSplits_; | |
| | | | |
| }; | | }; | |
| | | | |
| } | | } | |
| } | | } | |
| #endif | | #endif | |
| | | | |
End of changes. 11 change blocks. |
| 17 lines changed or deleted | | 169 lines changed or added | |
|
| Region.h | | Region.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 34 | | skipping to change at line 33 | |
| * 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 | |
| */ | | */ | |
| | | | |
| #ifndef __REGION__H__ | | #ifndef __REGION__H__ | |
| #define __REGION__H__ | | #define __REGION__H__ | |
|
| #include "symutil.h" | | | |
| #include "Serialization.h" | | #include "Serialization.h" | |
|
| | | #include "symutil.h" | |
| #include "Annotatable.h" | | #include "Annotatable.h" | |
| | | | |
| namespace Dyninst{ | | namespace Dyninst{ | |
| namespace SymtabAPI{ | | namespace SymtabAPI{ | |
| | | | |
| class Symbol; | | class Symbol; | |
| class relocationEntry; | | class relocationEntry; | |
| | | | |
|
| class Region : public Serializable, public AnnotatableSparse { | | class Region : public AnnotatableSparse { | |
| friend class Object; | | friend class Object; | |
| friend class Symtab; | | friend class Symtab; | |
| friend class SymtabTranslatorBase; | | friend class SymtabTranslatorBase; | |
| friend class SymtabTranslatorBin; | | friend class SymtabTranslatorBin; | |
| | | | |
| public: | | public: | |
| | | | |
| enum perm_t | | enum perm_t | |
| { | | { | |
| RP_R, | | RP_R, | |
| | | | |
| skipping to change at line 104 | | skipping to change at line 103 | |
| SYMTAB_EXPORT bool operator== (const Region ®); | | SYMTAB_EXPORT bool operator== (const Region ®); | |
| | | | |
| SYMTAB_EXPORT ~Region(); | | SYMTAB_EXPORT ~Region(); | |
| | | | |
| SYMTAB_EXPORT unsigned getRegionNumber() const; | | SYMTAB_EXPORT unsigned getRegionNumber() const; | |
| SYMTAB_EXPORT bool setRegionNumber(unsigned regnumber); | | SYMTAB_EXPORT bool setRegionNumber(unsigned regnumber); | |
| SYMTAB_EXPORT std::string getRegionName() const; | | SYMTAB_EXPORT std::string getRegionName() const; | |
| | | | |
| // getRegionAddr returns diskOffset on unixes, memory offset on windows | | // getRegionAddr returns diskOffset on unixes, memory offset on windows | |
| SYMTAB_EXPORT Offset getRegionAddr() const; | | SYMTAB_EXPORT Offset getRegionAddr() const; | |
|
| SYMTAB_EXPORT unsigned long getRegionSize() const; | | | |
| | | | |
| SYMTAB_EXPORT Offset getDiskOffset() const; | | SYMTAB_EXPORT Offset getDiskOffset() const; | |
| SYMTAB_EXPORT unsigned long getDiskSize() const; | | SYMTAB_EXPORT unsigned long getDiskSize() const; | |
|
| | | SYMTAB_EXPORT unsigned long getFileOffset(); | |
| | | | |
| SYMTAB_EXPORT Offset getMemOffset() const; | | SYMTAB_EXPORT Offset getMemOffset() const; | |
| SYMTAB_EXPORT unsigned long getMemSize() const; | | SYMTAB_EXPORT unsigned long getMemSize() const; | |
| SYMTAB_EXPORT unsigned long getMemAlignment() const; | | SYMTAB_EXPORT unsigned long getMemAlignment() const; | |
| SYMTAB_EXPORT void setMemOffset(Offset); | | SYMTAB_EXPORT void setMemOffset(Offset); | |
|
| SYMTAB_EXPORT void setMemSize(long); | | SYMTAB_EXPORT void setMemSize(unsigned long); | |
| | | SYMTAB_EXPORT void setDiskSize(unsigned long); | |
| | | SYMTAB_EXPORT void setFileOffset(Offset); | |
| | | | |
| SYMTAB_EXPORT void *getPtrToRawData() const; | | SYMTAB_EXPORT void *getPtrToRawData() const; | |
|
| SYMTAB_EXPORT bool setPtrToRawData(void *, unsigned long); | | SYMTAB_EXPORT bool setPtrToRawData(void *, unsigned long);//also sets di
skSize | |
| | | | |
| SYMTAB_EXPORT bool isBSS() const; | | SYMTAB_EXPORT bool isBSS() const; | |
| SYMTAB_EXPORT bool isText() const; | | SYMTAB_EXPORT bool isText() const; | |
| SYMTAB_EXPORT bool isData() const; | | SYMTAB_EXPORT bool isData() const; | |
| SYMTAB_EXPORT bool isTLS() const; | | SYMTAB_EXPORT bool isTLS() const; | |
| SYMTAB_EXPORT bool isOffsetInRegion(const Offset &offset) const; | | SYMTAB_EXPORT bool isOffsetInRegion(const Offset &offset) const; | |
| SYMTAB_EXPORT bool isLoadable() const; | | SYMTAB_EXPORT bool isLoadable() const; | |
| SYMTAB_EXPORT bool setLoadable(bool isLoadable); | | SYMTAB_EXPORT bool setLoadable(bool isLoadable); | |
| SYMTAB_EXPORT bool isDirty() const; | | SYMTAB_EXPORT bool isDirty() const; | |
| SYMTAB_EXPORT std::vector<relocationEntry> &getRelocations(); | | SYMTAB_EXPORT std::vector<relocationEntry> &getRelocations(); | |
| SYMTAB_EXPORT bool patchData(Offset off, void *buf, unsigned size); | | SYMTAB_EXPORT bool patchData(Offset off, void *buf, unsigned size); | |
| SYMTAB_EXPORT bool isStandardCode(); | | SYMTAB_EXPORT bool isStandardCode(); | |
| | | | |
| SYMTAB_EXPORT perm_t getRegionPermissions() const; | | SYMTAB_EXPORT perm_t getRegionPermissions() const; | |
| SYMTAB_EXPORT bool setRegionPermissions(perm_t newPerms); | | SYMTAB_EXPORT bool setRegionPermissions(perm_t newPerms); | |
| SYMTAB_EXPORT RegionType getRegionType() const; | | SYMTAB_EXPORT RegionType getRegionType() const; | |
| | | | |
| SYMTAB_EXPORT bool addRelocationEntry(Offset relocationAddr, Symbol *dyn
ref, unsigned long relType, Region::RegionType rtype = Region::RT_REL); | | SYMTAB_EXPORT bool addRelocationEntry(Offset relocationAddr, Symbol *dyn
ref, unsigned long relType, Region::RegionType rtype = Region::RT_REL); | |
| SYMTAB_EXPORT bool addRelocationEntry(const relocationEntry& rel); | | SYMTAB_EXPORT bool addRelocationEntry(const relocationEntry& rel); | |
| | | | |
|
| | | SYMTAB_EXPORT bool updateRelocations(Address start, Address end, Symbol | |
| | | *oldsym, Symbol *newsym); | |
| | | | |
| SYMTAB_EXPORT Serializable * serialize_impl(SerializerBase *sb, | | SYMTAB_EXPORT Serializable * serialize_impl(SerializerBase *sb, | |
| const char *tag = "Region") THROW_SPEC (SerializerError); | | const char *tag = "Region") THROW_SPEC (SerializerError); | |
| | | | |
| protected: | | protected: | |
| SYMTAB_EXPORT Region(unsigned regnum, std::string name, Offset diskOff, | | SYMTAB_EXPORT Region(unsigned regnum, std::string name, Offset diskOff, | |
| unsigned long diskSize, Offset memOff, unsigned long memSize, | | unsigned long diskSize, Offset memOff, unsigned long memSize, | |
| char *rawDataPtr, perm_t perms, RegionType regType, bool isLoadabl
e = false, | | char *rawDataPtr, perm_t perms, RegionType regType, bool isLoadabl
e = false, | |
| bool isTLS = false, unsigned long memAlign = sizeof(unsigned)); | | bool isTLS = false, unsigned long memAlign = sizeof(unsigned)); | |
| private: | | private: | |
| unsigned regNum_; | | unsigned regNum_; | |
| std::string name_; | | std::string name_; | |
| Offset diskOff_; | | Offset diskOff_; | |
| unsigned long diskSize_; | | unsigned long diskSize_; | |
| Offset memOff_; | | Offset memOff_; | |
| unsigned long memSize_; | | unsigned long memSize_; | |
|
| | | Offset fileOff_; | |
| void *rawDataPtr_; | | void *rawDataPtr_; | |
| perm_t permissions_; | | perm_t permissions_; | |
| RegionType rType_; | | RegionType rType_; | |
| bool isDirty_; | | bool isDirty_; | |
| std::vector<relocationEntry> rels_; | | std::vector<relocationEntry> rels_; | |
| char *buffer_; //To hold dirty data | | char *buffer_; //To hold dirty data | |
| bool isLoadable_; | | bool isLoadable_; | |
| bool isTLS_; | | bool isTLS_; | |
| unsigned long memAlign_; | | unsigned long memAlign_; | |
| }; | | }; | |
| | | | |
End of changes. 11 change blocks. |
| 12 lines changed or deleted | | 17 lines changed or added | |
|
| Symtab.h | | Symtab.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 46 | | skipping to change at line 45 | |
| | | | |
| #include "Symbol.h" | | #include "Symbol.h" | |
| #include "Module.h" | | #include "Module.h" | |
| #include "Region.h" | | #include "Region.h" | |
| | | | |
| #include "Annotatable.h" | | #include "Annotatable.h" | |
| #include "Serialization.h" | | #include "Serialization.h" | |
| | | | |
| #include "ProcReader.h" | | #include "ProcReader.h" | |
| | | | |
|
| | | #include "boost/shared_ptr.hpp" | |
| | | | |
| class MappedFile; | | class MappedFile; | |
| | | | |
| #define SYM_MAJOR 6 | | #define SYM_MAJOR 6 | |
| #define SYM_MINOR 2 | | #define SYM_MINOR 2 | |
| #define SYM_BETA 1 | | #define SYM_BETA 1 | |
| | | | |
| namespace Dyninst { | | namespace Dyninst { | |
| namespace SymtabAPI { | | namespace SymtabAPI { | |
| | | | |
| class Archive; | | class Archive; | |
| | | | |
| skipping to change at line 94 | | skipping to change at line 95 | |
| public: | | public: | |
| | | | |
| /***** Public Member Functions *****/ | | /***** Public Member Functions *****/ | |
| public: | | public: | |
| SYMTAB_EXPORT static void version(int& major, int& minor, int& maintenan
ce); | | SYMTAB_EXPORT static void version(int& major, int& minor, int& maintenan
ce); | |
| SYMTAB_EXPORT Symtab(MappedFile *); | | SYMTAB_EXPORT Symtab(MappedFile *); | |
| | | | |
| SYMTAB_EXPORT Symtab(); | | SYMTAB_EXPORT Symtab(); | |
| | | | |
| SYMTAB_EXPORT Symtab(const Symtab& obj); | | SYMTAB_EXPORT Symtab(const Symtab& obj); | |
|
| SYMTAB_EXPORT Symtab(char *mem_image, size_t image_size, bool &err); | | SYMTAB_EXPORT Symtab(unsigned char *mem_image, size_t image_size, | |
| | | const std::string &name, bool defensive_binary, boo | |
| | | l &err); | |
| | | | |
|
| SYMTAB_EXPORT static bool openFile(Symtab *&obj, std::string filename); | | typedef enum { | |
| SYMTAB_EXPORT static bool openFile(Symtab *&obj,char *mem_image, size_t | | NotDefensive, | |
| size); | | Defensive} def_t; | |
| | | | |
| | | SYMTAB_EXPORT static bool openFile(Symtab *&obj, std::string filename, | |
| | | def_t defensive_binary = NotDefensive | |
| | | ); | |
| | | SYMTAB_EXPORT static bool openFile(Symtab *&obj, void *mem_image, size_t | |
| | | size, | |
| | | std::string name, def_t defensive_bin | |
| | | ary = NotDefensive); | |
| SYMTAB_EXPORT static Symtab *findOpenSymtab(std::string filename); | | SYMTAB_EXPORT static Symtab *findOpenSymtab(std::string filename); | |
| SYMTAB_EXPORT static bool closeSymtab(Symtab *); | | SYMTAB_EXPORT static bool closeSymtab(Symtab *); | |
| | | | |
| SYMTAB_EXPORT Serializable * serialize_impl(SerializerBase *sb, | | SYMTAB_EXPORT Serializable * serialize_impl(SerializerBase *sb, | |
| const char *tag = "Symtab") THROW_SPEC (SerializerError); | | const char *tag = "Symtab") THROW_SPEC (SerializerError); | |
| void rebuild_symbol_hashes(SerializerBase *); | | void rebuild_symbol_hashes(SerializerBase *); | |
| void rebuild_funcvar_hashes(SerializerBase *); | | void rebuild_funcvar_hashes(SerializerBase *); | |
| void rebuild_module_hashes(SerializerBase *); | | void rebuild_module_hashes(SerializerBase *); | |
| void rebuild_region_indexes(SerializerBase *) THROW_SPEC(SerializerError
); | | void rebuild_region_indexes(SerializerBase *) THROW_SPEC(SerializerError
); | |
| static bool setup_module_up_ptrs(SerializerBase *,Symtab *st); | | static bool setup_module_up_ptrs(SerializerBase *,Symtab *st); | |
| | | | |
| skipping to change at line 126 | | skipping to change at line 134 | |
| MemRegReader *reader); | | MemRegReader *reader); | |
| SYMTAB_EXPORT bool hasStackwalkDebugInfo(); | | SYMTAB_EXPORT bool hasStackwalkDebugInfo(); | |
| | | | |
| /************************************** | | /************************************** | |
| *** LOOKUP FUNCTIONS ***************** | | *** LOOKUP FUNCTIONS ***************** | |
| **************************************/ | | **************************************/ | |
| | | | |
| // Symbol | | // Symbol | |
| | | | |
| SYMTAB_EXPORT virtual bool findSymbol(std::vector<Symbol *> &ret, | | SYMTAB_EXPORT virtual bool findSymbol(std::vector<Symbol *> &ret, | |
|
| const std::string name, | | const std::string& name, | |
| Symbol::SymbolType sType = Symbol:
:ST_UNKNOWN, | | Symbol::SymbolType sType = Symbol:
:ST_UNKNOWN, | |
| NameType nameType = anyName, | | NameType nameType = anyName, | |
| bool isRegex = false, | | bool isRegex = false, | |
|
| bool checkCase = false); | | bool checkCase = false, | |
| | | bool includeUndefined = false); | |
| | | | |
| SYMTAB_EXPORT virtual bool getAllSymbols(std::vector<Symbol *> &ret); | | SYMTAB_EXPORT virtual bool getAllSymbols(std::vector<Symbol *> &ret); | |
| SYMTAB_EXPORT virtual bool getAllSymbolsByType(std::vector<Symbol *> &re
t, | | SYMTAB_EXPORT virtual bool getAllSymbolsByType(std::vector<Symbol *> &re
t, | |
| Symbol::SymbolType sType); | | Symbol::SymbolType sType); | |
| | | | |
| std::vector<Symbol *> *findSymbolByOffset(Offset); | | std::vector<Symbol *> *findSymbolByOffset(Offset); | |
| | | | |
| // Return all undefined symbols in the binary. Currently used for findin
g | | // Return all undefined symbols in the binary. Currently used for findin
g | |
| // the .o's in a static archive that have definitions of these symbols | | // the .o's in a static archive that have definitions of these symbols | |
| SYMTAB_EXPORT bool getAllUndefinedSymbols(std::vector<Symbol *> &ret); | | SYMTAB_EXPORT bool getAllUndefinedSymbols(std::vector<Symbol *> &ret); | |
| | | | |
| | | | |
| skipping to change at line 237 | | skipping to change at line 247 | |
| SYMTAB_EXPORT void setTruncateLinePaths(bool value); | | SYMTAB_EXPORT void setTruncateLinePaths(bool value); | |
| SYMTAB_EXPORT bool getTruncateLinePaths(); | | SYMTAB_EXPORT bool getTruncateLinePaths(); | |
| | | | |
| /***** Type Information *****/ | | /***** Type Information *****/ | |
| SYMTAB_EXPORT virtual bool findType(Type *&type, std::string name); | | SYMTAB_EXPORT virtual bool findType(Type *&type, std::string name); | |
| SYMTAB_EXPORT virtual Type *findType(unsigned type_id); | | SYMTAB_EXPORT virtual Type *findType(unsigned type_id); | |
| SYMTAB_EXPORT virtual bool findVariableType(Type *&type, std::string nam
e); | | SYMTAB_EXPORT virtual bool findVariableType(Type *&type, std::string nam
e); | |
| | | | |
| SYMTAB_EXPORT bool addType(Type *typ); | | SYMTAB_EXPORT bool addType(Type *typ); | |
| | | | |
|
| | | static boost::shared_ptr<builtInTypeCollection> builtInTypes(); | |
| | | static boost::shared_ptr<typeCollection> stdTypes(); | |
| | | | |
| SYMTAB_EXPORT static std::vector<Type *> *getAllstdTypes(); | | SYMTAB_EXPORT static std::vector<Type *> *getAllstdTypes(); | |
| SYMTAB_EXPORT static std::vector<Type *> *getAllbuiltInTypes(); | | SYMTAB_EXPORT static std::vector<Type *> *getAllbuiltInTypes(); | |
| | | | |
| SYMTAB_EXPORT void parseTypesNow(); | | SYMTAB_EXPORT void parseTypesNow(); | |
| | | | |
| /***** Local Variable Information *****/ | | /***** Local Variable Information *****/ | |
| SYMTAB_EXPORT bool findLocalVariable(std::vector<localVar *>&vars, std::
string name); | | SYMTAB_EXPORT bool findLocalVariable(std::vector<localVar *>&vars, std::
string name); | |
| | | | |
| /***** Relocation Sections *****/ | | /***** Relocation Sections *****/ | |
| SYMTAB_EXPORT bool hasRel() const; | | SYMTAB_EXPORT bool hasRel() const; | |
| | | | |
| skipping to change at line 286 | | skipping to change at line 299 | |
| SYMTAB_EXPORT bool updateData(void *buffer, unsigned size); | | SYMTAB_EXPORT bool updateData(void *buffer, unsigned size); | |
| SYMTAB_EXPORT Offset getFreeOffset(unsigned size); | | SYMTAB_EXPORT Offset getFreeOffset(unsigned size); | |
| | | | |
| SYMTAB_EXPORT bool addLibraryPrereq(std::string libname); | | SYMTAB_EXPORT bool addLibraryPrereq(std::string libname); | |
| SYMTAB_EXPORT bool addSysVDynamic(long name, long value); | | SYMTAB_EXPORT bool addSysVDynamic(long name, long value); | |
| | | | |
| SYMTAB_EXPORT bool addLinkingResource(Archive *library); | | SYMTAB_EXPORT bool addLinkingResource(Archive *library); | |
| SYMTAB_EXPORT bool getLinkingResources(std::vector<Archive *> &libs); | | SYMTAB_EXPORT bool getLinkingResources(std::vector<Archive *> &libs); | |
| | | | |
| SYMTAB_EXPORT bool addExternalSymbolReference(Symbol *externalSym, Regio
n *localRegion, relocationEntry localRel); | | SYMTAB_EXPORT bool addExternalSymbolReference(Symbol *externalSym, Regio
n *localRegion, relocationEntry localRel); | |
|
| | | SYMTAB_EXPORT bool addTrapHeader_win(Address ptr); | |
| | | | |
| | | SYMTAB_EXPORT bool updateRelocations(Address start, Address end, Symbol | |
| | | *oldsym, Symbol *newsym); | |
| | | | |
| /***** Data Member Access *****/ | | /***** Data Member Access *****/ | |
| SYMTAB_EXPORT std::string file() const; | | SYMTAB_EXPORT std::string file() const; | |
| SYMTAB_EXPORT std::string name() const; | | SYMTAB_EXPORT std::string name() const; | |
| SYMTAB_EXPORT std::string memberName() const; | | SYMTAB_EXPORT std::string memberName() const; | |
| | | | |
| SYMTAB_EXPORT char *mem_image() const; | | SYMTAB_EXPORT char *mem_image() const; | |
| | | | |
| SYMTAB_EXPORT Offset imageOffset() const; | | SYMTAB_EXPORT Offset imageOffset() const; | |
| SYMTAB_EXPORT Offset dataOffset() const; | | SYMTAB_EXPORT Offset dataOffset() const; | |
| | | | |
| skipping to change at line 311 | | skipping to change at line 327 | |
| SYMTAB_EXPORT Offset getFiniOffset(); | | SYMTAB_EXPORT Offset getFiniOffset(); | |
| | | | |
| SYMTAB_EXPORT const char* getInterpreterName() const; | | SYMTAB_EXPORT const char* getInterpreterName() const; | |
| | | | |
| SYMTAB_EXPORT unsigned getAddressWidth() const; | | SYMTAB_EXPORT unsigned getAddressWidth() const; | |
| SYMTAB_EXPORT Offset getLoadOffset() const; | | SYMTAB_EXPORT Offset getLoadOffset() const; | |
| SYMTAB_EXPORT Offset getEntryOffset() const; | | SYMTAB_EXPORT Offset getEntryOffset() const; | |
| SYMTAB_EXPORT Offset getBaseOffset() const; | | SYMTAB_EXPORT Offset getBaseOffset() const; | |
| SYMTAB_EXPORT Offset getTOCoffset() const; | | SYMTAB_EXPORT Offset getTOCoffset() const; | |
| SYMTAB_EXPORT Address getLoadAddress(); | | SYMTAB_EXPORT Address getLoadAddress(); | |
|
| | | SYMTAB_EXPORT bool isDefensiveBinary() const; | |
| | | SYMTAB_EXPORT Offset fileToDiskOffset(Dyninst::Offset) const; | |
| | | SYMTAB_EXPORT Offset fileToMemOffset(Dyninst::Offset) const; | |
| | | | |
| SYMTAB_EXPORT std::string getDefaultNamespacePrefix() const; | | SYMTAB_EXPORT std::string getDefaultNamespacePrefix() const; | |
| | | | |
| SYMTAB_EXPORT unsigned getNumberofRegions() const; | | SYMTAB_EXPORT unsigned getNumberofRegions() const; | |
| SYMTAB_EXPORT unsigned getNumberofSymbols() const; | | SYMTAB_EXPORT unsigned getNumberofSymbols() const; | |
| | | | |
| SYMTAB_EXPORT std::vector<std::string> &getDependencies(); | | SYMTAB_EXPORT std::vector<std::string> &getDependencies(); | |
|
| | | SYMTAB_EXPORT bool removeLibraryDependency(std::string lib); | |
| | | | |
| SYMTAB_EXPORT Archive *getParentArchive() const; | | SYMTAB_EXPORT Archive *getParentArchive() const; | |
| | | | |
| /***** Error Handling *****/ | | /***** Error Handling *****/ | |
| SYMTAB_EXPORT static SymtabError getLastSymtabError(); | | SYMTAB_EXPORT static SymtabError getLastSymtabError(); | |
| SYMTAB_EXPORT static std::string printError(SymtabError serr); | | SYMTAB_EXPORT static std::string printError(SymtabError serr); | |
| | | | |
| SYMTAB_EXPORT ~Symtab(); | | SYMTAB_EXPORT ~Symtab(); | |
| | | | |
| bool delSymbol(Symbol *sym) { return deleteSymbol(sym); } | | bool delSymbol(Symbol *sym) { return deleteSymbol(sym); } | |
| bool deleteSymbol(Symbol *sym); | | bool deleteSymbol(Symbol *sym); | |
| | | | |
|
| static builtInTypeCollection *builtInTypes; | | | |
| static typeCollection *stdTypes; | | | |
| | | | |
| Symbol *getSymbolByIndex(unsigned); | | Symbol *getSymbolByIndex(unsigned); | |
| protected: | | protected: | |
| Symtab(std::string filename, std::string member_name, Offset offset, boo
l &err, void *base = NULL); | | Symtab(std::string filename, std::string member_name, Offset offset, boo
l &err, void *base = NULL); | |
| Symtab(char *img, size_t size, std::string member_name, Offset offset, b
ool &err, void *base = NULL); | | Symtab(char *img, size_t size, std::string member_name, Offset offset, b
ool &err, void *base = NULL); | |
| | | | |
| /***** Private Member Functions *****/ | | /***** Private Member Functions *****/ | |
| private: | | private: | |
|
| SYMTAB_EXPORT Symtab(std::string filename, bool &err); | | | |
| | | SYMTAB_EXPORT Symtab(std::string filename, bool defensive_bin, bool &err | |
| | | ); | |
| | | | |
| SYMTAB_EXPORT bool extractInfo(Object *linkedFile); | | SYMTAB_EXPORT bool extractInfo(Object *linkedFile); | |
| | | | |
| // Parsing code | | // Parsing code | |
| | | | |
| bool extractSymbolsFromFile(Object *linkedFile, std::vector<Symbol *> &r
aw_syms); | | bool extractSymbolsFromFile(Object *linkedFile, std::vector<Symbol *> &r
aw_syms); | |
| bool fixSymModules(std::vector<Symbol *> &raw_syms); | | bool fixSymModules(std::vector<Symbol *> &raw_syms); | |
| bool demangleSymbols(std::vector<Symbol *> &rawsyms); | | bool demangleSymbols(std::vector<Symbol *> &rawsyms); | |
|
| bool createIndices(std::vector<Symbol *> &raw_syms); | | bool createIndices(std::vector<Symbol *> &raw_syms, bool undefined); | |
| bool createAggregates(); | | bool createAggregates(); | |
| | | | |
| bool fixSymModule(Symbol *&sym); | | bool fixSymModule(Symbol *&sym); | |
| bool demangleSymbol(Symbol *&sym); | | bool demangleSymbol(Symbol *&sym); | |
|
| bool addSymbolToIndices(Symbol *&sym); | | bool addSymbolToIndices(Symbol *&sym, bool undefined); | |
| bool addSymbolToAggregates(Symbol *&sym); | | bool addSymbolToAggregates(Symbol *&sym); | |
| bool doNotAggregate(Symbol *&sym); | | bool doNotAggregate(Symbol *&sym); | |
| bool updateIndices(Symbol *sym, std::string newName, NameType nameType); | | bool updateIndices(Symbol *sym, std::string newName, NameType nameType); | |
| | | | |
| void setModuleLanguages(dyn_hash_map<std::string, supportedLanguages> *m
od_langs); | | void setModuleLanguages(dyn_hash_map<std::string, supportedLanguages> *m
od_langs); | |
| | | | |
|
| void setupTypes(); | | | |
| static void setupStdTypes(); | | | |
| | | | |
| bool buildDemangledName( const std::string &mangled, | | bool buildDemangledName( const std::string &mangled, | |
| std::string &pretty, | | std::string &pretty, | |
| std::string &typed, | | std::string &typed, | |
| bool nativeCompiler, | | bool nativeCompiler, | |
| supportedLanguages lang ); | | supportedLanguages lang ); | |
| | | | |
| // Change the type of a symbol after the fact | | // Change the type of a symbol after the fact | |
| bool changeType(Symbol *sym, Symbol::SymbolType oldType); | | bool changeType(Symbol *sym, Symbol::SymbolType oldType); | |
| | | | |
| bool changeSymbolOffset(Symbol *sym, Offset newOffset); | | bool changeSymbolOffset(Symbol *sym, Offset newOffset); | |
| | | | |
| skipping to change at line 410 | | skipping to change at line 425 | |
| | | | |
| void parseLineInformation(); | | void parseLineInformation(); | |
| void parseTypes(); | | void parseTypes(); | |
| bool setDefaultNamespacePrefix(std::string &str); | | bool setDefaultNamespacePrefix(std::string &str); | |
| | | | |
| bool addUserRegion(Region *newreg); | | bool addUserRegion(Region *newreg); | |
| bool addUserType(Type *newtypeg); | | bool addUserType(Type *newtypeg); | |
| | | | |
| /***** Private Data Members *****/ | | /***** Private Data Members *****/ | |
| private: | | private: | |
|
| | | | |
| | | static boost::shared_ptr<typeCollection> setupStdTypes(); | |
| | | static boost::shared_ptr<builtInTypeCollection> setupBuiltinTypes(); | |
| | | | |
| std::string member_name_; | | std::string member_name_; | |
| Offset member_offset_; | | Offset member_offset_; | |
| Archive * parentArchive_; | | Archive * parentArchive_; | |
| MappedFile *mf; | | MappedFile *mf; | |
| MappedFile *mfForDebugInfo; | | MappedFile *mfForDebugInfo; | |
| | | | |
| Offset imageOffset_; | | Offset imageOffset_; | |
| unsigned imageLen_; | | unsigned imageLen_; | |
| Offset dataOffset_; | | Offset dataOffset_; | |
| unsigned dataLen_; | | unsigned dataLen_; | |
| | | | |
| skipping to change at line 460 | | skipping to change at line 479 | |
| | | | |
| //Point where new loadable sections will be inserted | | //Point where new loadable sections will be inserted | |
| unsigned newSectionInsertPoint; | | unsigned newSectionInsertPoint; | |
| | | | |
| //symbols | | //symbols | |
| unsigned no_of_symbols; | | unsigned no_of_symbols; | |
| | | | |
| // Indices | | // Indices | |
| | | | |
| std::vector<Symbol *> everyDefinedSymbol; | | std::vector<Symbol *> everyDefinedSymbol; | |
|
| // Subset of the above | | | |
| std::vector<Symbol *> userAddedSymbols; | | | |
| // hashtable for looking up undefined symbols in the dynamic symbol | | // hashtable for looking up undefined symbols in the dynamic symbol | |
| // tale. Entries are referred by the relocation table entries | | // tale. Entries are referred by the relocation table entries | |
| // NOT a subset of everyDefinedSymbol | | // NOT a subset of everyDefinedSymbol | |
|
| std::map <std::string, std::vector<Symbol *> > undefDynSyms; | | std::vector<Symbol *> undefDynSyms; | |
| | | std::map <std::string, std::vector<Symbol *> > undefDynSymsByMangledName | |
| | | ; | |
| | | std::map <std::string, std::vector<Symbol *> > undefDynSymsByPrettyName; | |
| | | std::map <std::string, std::vector<Symbol *> > undefDynSymsByTypedName; | |
| | | | |
| // Symbols by offsets in the symbol table | | // Symbols by offsets in the symbol table | |
| dyn_hash_map <Offset, std::vector<Symbol *> > symsByOffset; | | dyn_hash_map <Offset, std::vector<Symbol *> > symsByOffset; | |
| | | | |
| // The raw name from the symbol table | | // The raw name from the symbol table | |
| dyn_hash_map <std::string, std::vector<Symbol *> > symsByMangledName; | | dyn_hash_map <std::string, std::vector<Symbol *> > symsByMangledName; | |
| | | | |
| // The name after we've run it through the demangler | | // The name after we've run it through the demangler | |
| dyn_hash_map <std::string, std::vector<Symbol *> > symsByPrettyName; | | dyn_hash_map <std::string, std::vector<Symbol *> > symsByPrettyName; | |
| | | | |
| | | | |
| skipping to change at line 561 | | skipping to change at line 581 | |
| | | | |
| //Relocation sections | | //Relocation sections | |
| bool hasRel_; | | bool hasRel_; | |
| bool hasRela_; | | bool hasRela_; | |
| bool hasReldyn_; | | bool hasReldyn_; | |
| bool hasReladyn_; | | bool hasReladyn_; | |
| bool hasRelplt_; | | bool hasRelplt_; | |
| bool hasRelaplt_; | | bool hasRelaplt_; | |
| | | | |
| bool isStaticBinary_; | | bool isStaticBinary_; | |
|
| | | bool isDefensiveBinary_; | |
| | | | |
| //Don't use obj_private, use getObject() instead. | | //Don't use obj_private, use getObject() instead. | |
| public: | | public: | |
| Object *getObject(); | | Object *getObject(); | |
| private: | | private: | |
| Object *obj_private; | | Object *obj_private; | |
| | | | |
| // dynamic library name substitutions | | // dynamic library name substitutions | |
| std::map <std::string, std::string> dynLibSubs; | | std::map <std::string, std::string> dynLibSubs; | |
| | | | |
| public: | | public: | |
|
| static Type *type_Error; | | static boost::shared_ptr<Type> type_Error(); | |
| static Type *type_Untyped; | | static boost::shared_ptr<Type> type_Untyped(); | |
| | | | |
| private: | | private: | |
| unsigned _ref_cnt; | | unsigned _ref_cnt; | |
| | | | |
| public: | | public: | |
| /********************************************************************/ | | /********************************************************************/ | |
| /**** DEPRECATED ****************************************************/ | | /**** DEPRECATED ****************************************************/ | |
| /********************************************************************/ | | /********************************************************************/ | |
| dyn_hash_map <std::string, Module *> &getModsByFileName() | | dyn_hash_map <std::string, Module *> &getModsByFileName() | |
| { | | { | |
| return modsByFileName; | | return modsByFileName; | |
| } | | } | |
| dyn_hash_map <std::string, Module *> &getModsByFullName() | | dyn_hash_map <std::string, Module *> &getModsByFullName() | |
| { | | { | |
| return modsByFullName; | | return modsByFullName; | |
| } | | } | |
| | | | |
| SYMTAB_EXPORT bool findFuncByEntryOffset(std::vector<Symbol *>&ret, cons
t Offset offset); | | SYMTAB_EXPORT bool findFuncByEntryOffset(std::vector<Symbol *>&ret, cons
t Offset offset); | |
| SYMTAB_EXPORT virtual bool findSymbolByType(std::vector<Symbol *> &ret, | | SYMTAB_EXPORT virtual bool findSymbolByType(std::vector<Symbol *> &ret, | |
|
| const std::string name, | | const std::string& name, | |
| Symbol::SymbolType sType, | | Symbol::SymbolType sType, | |
| bool isMangled = false, | | bool isMangled = false, | |
| bool isRegex = false, | | bool isRegex = false, | |
| bool checkCase = false); | | bool checkCase = false); | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Used to represent something like a C++ try/catch block. | | * Used to represent something like a C++ try/catch block. | |
| * Currently only used on Linux/x86 | | * Currently only used on Linux/x86 | |
| **/ | | **/ | |
| | | | |
End of changes. 22 change blocks. |
| 28 lines changed or deleted | | 55 lines changed or added | |
|
| dyn_regs.h | | dyn_regs.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 36 | | 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 | |
| */ | | */ | |
| | | | |
| #if !defined(DYN_REGS_H_) | | #if !defined(DYN_REGS_H_) | |
| #define DYN_REGS_H_ | | #define DYN_REGS_H_ | |
| | | | |
| #include "util.h" | | #include "util.h" | |
|
| | | #include "boost/shared_ptr.hpp" | |
| | | | |
| #include <assert.h> | | #include <assert.h> | |
| #include <map> | | #include <map> | |
|
| | | #include <string> | |
| | | | |
| namespace Dyninst | | namespace Dyninst | |
| { | | { | |
| 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; | |
| | | | |
|
| unsigned getArchAddressWidth(Dyninst::Architecture arch); | | COMMON_EXPORT bool isSegmentRegister(int regClass); | |
| | | COMMON_EXPORT unsigned getArchAddressWidth(Dyninst::Architecture arch); | |
| class COMMON_EXPORT MachRegister { | | class COMMON_EXPORT MachRegister { | |
| private: | | private: | |
| signed int reg; | | signed int reg; | |
|
| static std::map<signed int, const char *> *names; | | | |
| | | typedef std::map<signed int, std::string> NameMap; | |
| | | static boost::shared_ptr<MachRegister::NameMap> 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); | |
| | | explicit MachRegister(signed int r, std::string n); | |
| | | | |
| MachRegister getBaseRegister() const; | | MachRegister getBaseRegister() const; | |
| Architecture getArchitecture() const; | | Architecture getArchitecture() const; | |
| bool isValid() const; | | bool isValid() const; | |
|
| MachRegisterVal getSubRegValue(const MachRegister subreg, MachRegiste
rVal &orig) const; | | MachRegisterVal getSubRegValue(const MachRegister& subreg, MachRegist
erVal &orig) const; | |
| | | | |
|
| const char *name() const; | | std::string name() const; | |
| unsigned int size() const; | | unsigned int size() const; | |
| bool operator<(const MachRegister &a) const; | | bool operator<(const MachRegister &a) const; | |
| bool operator==(const MachRegister &a) const; | | bool operator==(const MachRegister &a) const; | |
| operator signed int() const; | | operator signed int() const; | |
| signed int val() const; | | signed int val() const; | |
| unsigned int regClass() const; | | unsigned int regClass() const; | |
| | | | |
| static MachRegister getPC(Dyninst::Architecture arch); | | static MachRegister getPC(Dyninst::Architecture arch); | |
| static MachRegister getFramePointer(Dyninst::Architecture arch); | | static MachRegister getFramePointer(Dyninst::Architecture arch); | |
| static MachRegister getStackPointer(Dyninst::Architecture arch); | | static MachRegister getStackPointer(Dyninst::Architecture arch); | |
| | | | |
| skipping to change at line 111 | | skipping to change at line 117 | |
| //DYN_DEFINE_REGS Should only be defined in libcommon. | | //DYN_DEFINE_REGS Should only be defined in libcommon. | |
| //We want one definition, which will be in libcommon, and declarations | | //We want one definition, which will be in libcommon, and declarations | |
| //for everyone else. | | //for everyone else. | |
| // | | // | |
| //I wanted these to be const MachRegister objects, but that changes the | | //I wanted these to be const MachRegister objects, but that changes the | |
| //linker scope. Instead they're non-const. Every accessor function is | | //linker scope. Instead they're non-const. Every accessor function is | |
| //const anyways, so we'll just close our eyes and pretend they're declar
ed | | //const anyways, so we'll just close our eyes and pretend they're declar
ed | |
| //const. | | //const. | |
| #define DEF_REGISTER(name, value, Arch) \ | | #define DEF_REGISTER(name, value, Arch) \ | |
| const signed int i##name = (value); \ | | const signed int i##name = (value); \ | |
|
| COMMON_EXPORT MachRegister name(i##name, Arch "::" #name); | | COMMON_EXPORT MachRegister name(i##name, Arch "::" #name) | |
| #else | | #else | |
| #define DEF_REGISTER(name, value, Arch) \ | | #define DEF_REGISTER(name, value, Arch) \ | |
| const signed int i##name = (value); \ | | const signed int i##name = (value); \ | |
|
| COMMON_EXPORT extern MachRegister name; | | COMMON_EXPORT extern MachRegister name | |
| | | | |
| #endif | | #endif | |
| | | | |
| /** | | /** | |
| * For interpreting constants: | | * For interpreting constants: | |
| * Lowest 16 bits (0x000000ff) is base register ID | | * Lowest 16 bits (0x000000ff) is base register ID | |
| * Next 16 bits (0x0000ff00) is the aliasing and subrange ID- | | * Next 16 bits (0x0000ff00) is the aliasing and subrange ID- | |
| * used on x86/x86_64 to distinguish between things like EAX and AH | | * used on x86/x86_64 to distinguish between things like EAX and AH | |
| * Next 16 bits (0x00ff0000) are the register category, GPR/FPR/MMX/... | | * Next 16 bits (0x00ff0000) are the register category, GPR/FPR/MMX/... | |
| * Top 16 bits (0xff000000) are the architecture. | | * Top 16 bits (0xff000000) are the architecture. | |
| | | | |
| skipping to change at line 167 | | skipping to change at line 173 | |
| const signed int BASEC = 0x1; | | const signed int BASEC = 0x1; | |
| const signed int BASED = 0x2; | | const signed int BASED = 0x2; | |
| const signed int BASEB = 0x3; | | const signed int BASEB = 0x3; | |
| const signed int BASESP = 0x4; | | const signed int BASESP = 0x4; | |
| const signed int BASEBP = 0x5; | | const signed int BASEBP = 0x5; | |
| const signed int BASESI = 0x6; | | const signed int BASESI = 0x6; | |
| const signed int BASEDI = 0x7; | | const signed int BASEDI = 0x7; | |
| const signed int FLAGS = 0x0; | | const signed int FLAGS = 0x0; | |
| | | | |
| const signed int CF = 0x0; | | const signed int CF = 0x0; | |
|
| | | const signed int FLAG1 = 0x1; | |
| const signed int PF = 0x2; | | const signed int PF = 0x2; | |
|
| | | const signed int FLAG3 = 0x3; | |
| const signed int AF = 0x4; | | const signed int AF = 0x4; | |
|
| | | const signed int FLAG5 = 0x5; | |
| const signed int ZF = 0x6; | | const signed int ZF = 0x6; | |
| const signed int SF = 0x7; | | const signed int SF = 0x7; | |
| const signed int TF = 0x8; | | const signed int TF = 0x8; | |
| const signed int IF = 0x9; | | const signed int IF = 0x9; | |
| const signed int DF = 0xa; | | const signed int DF = 0xa; | |
| const signed int OF = 0xb; | | const signed int OF = 0xb; | |
|
| | | const signed int FLAGC = 0xc; | |
| | | const signed int FLAGD = 0xd; | |
| const signed int NT = 0xe; | | const signed int NT = 0xe; | |
|
| | | const signed int FLAGF = 0xf; | |
| const signed int RF = 0x10; | | const signed int RF = 0x10; | |
| | | | |
| DEF_REGISTER(eax, BASEA | FULL | GPR | Arch_x86, "x86"); | | DEF_REGISTER(eax, BASEA | FULL | GPR | Arch_x86, "x86"); | |
| DEF_REGISTER(ecx, BASEC | FULL | GPR | Arch_x86, "x86"); | | DEF_REGISTER(ecx, BASEC | FULL | GPR | Arch_x86, "x86"); | |
| DEF_REGISTER(edx, BASED | FULL | GPR | Arch_x86, "x86"); | | DEF_REGISTER(edx, BASED | FULL | GPR | Arch_x86, "x86"); | |
| DEF_REGISTER(ebx, BASEB | FULL | GPR | Arch_x86, "x86"); | | DEF_REGISTER(ebx, BASEB | FULL | GPR | Arch_x86, "x86"); | |
| DEF_REGISTER(esp, BASESP | FULL | GPR | Arch_x86, "x86"); | | DEF_REGISTER(esp, BASESP | FULL | GPR | Arch_x86, "x86"); | |
| DEF_REGISTER(ebp, BASEBP | FULL | GPR | Arch_x86, "x86"); | | DEF_REGISTER(ebp, BASEBP | FULL | GPR | Arch_x86, "x86"); | |
| DEF_REGISTER(esi, BASESI | FULL | GPR | Arch_x86, "x86"); | | DEF_REGISTER(esi, BASESI | FULL | GPR | Arch_x86, "x86"); | |
| DEF_REGISTER(edi, BASEDI | FULL | GPR | Arch_x86, "x86"); | | DEF_REGISTER(edi, BASEDI | FULL | GPR | Arch_x86, "x86"); | |
| | | | |
| skipping to change at line 205 | | skipping to change at line 217 | |
| DEF_REGISTER(bh, BASEB | H_REG | GPR | Arch_x86, "x86"); | | DEF_REGISTER(bh, BASEB | H_REG | GPR | Arch_x86, "x86"); | |
| DEF_REGISTER(bl, BASEB | L_REG | GPR | Arch_x86, "x86"); | | DEF_REGISTER(bl, BASEB | L_REG | GPR | Arch_x86, "x86"); | |
| DEF_REGISTER(bx, BASEB | W_REG | GPR | Arch_x86, "x86"); | | DEF_REGISTER(bx, BASEB | W_REG | GPR | Arch_x86, "x86"); | |
| DEF_REGISTER(sp, BASESP | W_REG | GPR | Arch_x86, "x86"); | | DEF_REGISTER(sp, BASESP | W_REG | GPR | Arch_x86, "x86"); | |
| DEF_REGISTER(bp, BASEBP | W_REG | GPR | Arch_x86, "x86"); | | DEF_REGISTER(bp, BASEBP | W_REG | GPR | Arch_x86, "x86"); | |
| DEF_REGISTER(si, BASESI | W_REG | GPR | Arch_x86, "x86"); | | DEF_REGISTER(si, BASESI | W_REG | GPR | Arch_x86, "x86"); | |
| DEF_REGISTER(di, BASEDI | W_REG | GPR | Arch_x86, "x86"); | | DEF_REGISTER(di, BASEDI | W_REG | GPR | Arch_x86, "x86"); | |
| DEF_REGISTER(eip, 0x10 | FULL | Arch_x86, "x86"); | | DEF_REGISTER(eip, 0x10 | FULL | Arch_x86, "x86"); | |
| DEF_REGISTER(flags, FLAGS | FULL | FLAG | Arch_x86, "x86"); | | DEF_REGISTER(flags, FLAGS | FULL | FLAG | Arch_x86, "x86"); | |
| DEF_REGISTER(cf, CF | BIT | FLAG | Arch_x86, "x86"); | | DEF_REGISTER(cf, CF | BIT | FLAG | Arch_x86, "x86"); | |
|
| | | DEF_REGISTER(flag1, FLAG1 | BIT | FLAG | Arch_x86, "x86"); | |
| DEF_REGISTER(pf, PF | BIT | FLAG | Arch_x86, "x86"); | | DEF_REGISTER(pf, PF | BIT | FLAG | Arch_x86, "x86"); | |
|
| | | DEF_REGISTER(flag3, FLAG3 | BIT | FLAG | Arch_x86, "x86"); | |
| DEF_REGISTER(af, AF | BIT | FLAG | Arch_x86, "x86"); | | DEF_REGISTER(af, AF | BIT | FLAG | Arch_x86, "x86"); | |
|
| | | DEF_REGISTER(flag5, FLAG5 | BIT | FLAG | Arch_x86, "x86"); | |
| DEF_REGISTER(zf, ZF | BIT | FLAG | Arch_x86, "x86"); | | DEF_REGISTER(zf, ZF | BIT | FLAG | Arch_x86, "x86"); | |
| DEF_REGISTER(sf, SF | BIT | FLAG | Arch_x86, "x86"); | | DEF_REGISTER(sf, SF | BIT | FLAG | Arch_x86, "x86"); | |
| DEF_REGISTER(tf, TF | BIT | FLAG | Arch_x86, "x86"); | | DEF_REGISTER(tf, TF | BIT | FLAG | Arch_x86, "x86"); | |
| DEF_REGISTER(if_, IF | BIT | FLAG | Arch_x86, "x86"); | | DEF_REGISTER(if_, IF | BIT | FLAG | Arch_x86, "x86"); | |
| DEF_REGISTER(df, DF | BIT | FLAG | Arch_x86, "x86"); | | DEF_REGISTER(df, DF | BIT | FLAG | Arch_x86, "x86"); | |
| DEF_REGISTER(of, OF | BIT | FLAG | Arch_x86, "x86"); | | DEF_REGISTER(of, OF | BIT | FLAG | Arch_x86, "x86"); | |
|
| | | DEF_REGISTER(flagc, FLAGC | BIT | FLAG | Arch_x86, "x86"); | |
| | | DEF_REGISTER(flagd, FLAGD | BIT | FLAG | Arch_x86, "x86"); | |
| DEF_REGISTER(nt_, NT | BIT | FLAG | Arch_x86, "x86"); | | DEF_REGISTER(nt_, NT | BIT | FLAG | Arch_x86, "x86"); | |
|
| | | DEF_REGISTER(flagf, FLAGF | BIT | FLAG | Arch_x86, "x86"); | |
| DEF_REGISTER(rf, RF | BIT | FLAG | Arch_x86, "x86"); | | DEF_REGISTER(rf, RF | BIT | FLAG | Arch_x86, "x86"); | |
|
| DEF_REGISTER(ds, 0x0 | FULL | SEG | Arch_x86, "x86"); | | DEF_REGISTER(ds, 0x0 | W_REG | SEG | Arch_x86, "x86"); | |
| DEF_REGISTER(es, 0x1 | FULL | SEG | Arch_x86, "x86"); | | DEF_REGISTER(es, 0x1 | W_REG | SEG | Arch_x86, "x86"); | |
| DEF_REGISTER(fs, 0x2 | FULL | SEG | Arch_x86, "x86"); | | DEF_REGISTER(fs, 0x2 | W_REG | SEG | Arch_x86, "x86"); | |
| DEF_REGISTER(gs, 0x3 | FULL | SEG | Arch_x86, "x86"); | | DEF_REGISTER(gs, 0x3 | W_REG | SEG | Arch_x86, "x86"); | |
| DEF_REGISTER(cs, 0x4 | FULL | SEG | Arch_x86, "x86"); | | DEF_REGISTER(cs, 0x4 | W_REG | SEG | Arch_x86, "x86"); | |
| DEF_REGISTER(ss, 0x5 | FULL | SEG | Arch_x86, "x86"); | | DEF_REGISTER(ss, 0x5 | W_REG | SEG | Arch_x86, "x86"); | |
| DEF_REGISTER(oeax, 0x0 | FULL | MISC | Arch_x86, "x86"); | | DEF_REGISTER(oeax, 0x0 | FULL | MISC | Arch_x86, "x86"); | |
| DEF_REGISTER(fsbase, 0x1 | FULL | MISC | Arch_x86, "x86"); | | DEF_REGISTER(fsbase, 0x1 | FULL | MISC | Arch_x86, "x86"); | |
| DEF_REGISTER(gsbase, 0x2 | FULL | MISC | Arch_x86, "x86"); | | DEF_REGISTER(gsbase, 0x2 | FULL | MISC | Arch_x86, "x86"); | |
| DEF_REGISTER(xmm0, 0x0 | OCT | XMM | Arch_x86, "x86"); | | DEF_REGISTER(xmm0, 0x0 | OCT | XMM | Arch_x86, "x86"); | |
| DEF_REGISTER(xmm1, 0x1 | OCT | XMM | Arch_x86, "x86"); | | DEF_REGISTER(xmm1, 0x1 | OCT | XMM | Arch_x86, "x86"); | |
| DEF_REGISTER(xmm2, 0x2 | OCT | XMM | Arch_x86, "x86"); | | DEF_REGISTER(xmm2, 0x2 | OCT | XMM | Arch_x86, "x86"); | |
| DEF_REGISTER(xmm3, 0x3 | OCT | XMM | Arch_x86, "x86"); | | DEF_REGISTER(xmm3, 0x3 | OCT | XMM | Arch_x86, "x86"); | |
| DEF_REGISTER(xmm4, 0x4 | OCT | XMM | Arch_x86, "x86"); | | DEF_REGISTER(xmm4, 0x4 | OCT | XMM | Arch_x86, "x86"); | |
| DEF_REGISTER(xmm5, 0x5 | OCT | XMM | Arch_x86, "x86"); | | DEF_REGISTER(xmm5, 0x5 | OCT | XMM | Arch_x86, "x86"); | |
| DEF_REGISTER(xmm6, 0x6 | OCT | XMM | Arch_x86, "x86"); | | DEF_REGISTER(xmm6, 0x6 | OCT | XMM | Arch_x86, "x86"); | |
| | | | |
| skipping to change at line 586 | | skipping to change at line 604 | |
| DEF_REGISTER(dsisr, 18 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(dsisr, 18 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(dar, 19 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(dar, 19 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(dec, 22 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(dec, 22 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(sdr1, 25 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(sdr1, 25 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(srr0, 26 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(srr0, 26 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(srr1, 27 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(srr1, 27 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(sprg0, 272 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(sprg0, 272 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(sprg1, 273 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(sprg1, 273 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(sprg2, 274 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(sprg2, 274 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(sprg3, 275 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(sprg3, 275 | SPR | Arch_ppc32, "ppc32"); | |
|
| | | DEF_REGISTER(sprg4, 276 | SPR | Arch_ppc32, "ppc32"); | |
| | | DEF_REGISTER(sprg5, 277 | SPR | Arch_ppc32, "ppc32"); | |
| | | DEF_REGISTER(sprg6, 278 | SPR | Arch_ppc32, "ppc32"); | |
| | | DEF_REGISTER(sprg7, 279 | SPR | Arch_ppc32, "ppc32"); | |
| | | | |
| | | DEF_REGISTER(sprg3_ro, 259 | SPR | Arch_ppc32, "ppc32"); | |
| | | DEF_REGISTER(sprg4_ro, 260 | SPR | Arch_ppc32, "ppc32"); | |
| | | DEF_REGISTER(sprg5_ro, 261 | SPR | Arch_ppc32, "ppc32"); | |
| | | DEF_REGISTER(sprg6_ro, 262 | SPR | Arch_ppc32, "ppc32"); | |
| | | DEF_REGISTER(sprg7_ro, 263 | SPR | Arch_ppc32, "ppc32"); | |
| | | | |
| DEF_REGISTER(ear, 282 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(ear, 282 | SPR | Arch_ppc32, "ppc32"); | |
|
| DEF_REGISTER(tbl, 284 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(tbl_wo, 284 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(tbu, 285 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(tbl_ro, 268 | SPR | Arch_ppc32, "ppc32"); | |
| | | DEF_REGISTER(tbu_wo, 285 | SPR | Arch_ppc32, "ppc32"); | |
| | | DEF_REGISTER(tbu_ro, 269 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(pvr, 287 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(pvr, 287 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(ibat0u, 528 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(ibat0u, 528 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(ibat0l, 529 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(ibat0l, 529 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(ibat1u, 530 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(ibat1u, 530 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(ibat1l, 531 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(ibat1l, 531 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(ibat2u, 532 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(ibat2u, 532 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(ibat2l, 533 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(ibat2l, 533 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(ibat3u, 534 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(ibat3u, 534 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(ibat3l, 535 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(ibat3l, 535 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(dbat0u, 536 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(dbat0u, 536 | SPR | Arch_ppc32, "ppc32"); | |
| | | | |
| skipping to change at line 636 | | skipping to change at line 667 | |
| DEF_REGISTER(seg7, 620 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(seg7, 620 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(cr0, 621 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(cr0, 621 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(cr1, 622 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(cr1, 622 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(cr2, 623 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(cr2, 623 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(cr3, 624 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(cr3, 624 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(cr4, 625 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(cr4, 625 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(cr5, 626 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(cr5, 626 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(cr6, 627 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(cr6, 627 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(cr7, 628 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(cr7, 628 | SPR | Arch_ppc32, "ppc32"); | |
| DEF_REGISTER(cr, 629 | SPR | Arch_ppc32, "ppc32"); | | DEF_REGISTER(cr, 629 | SPR | Arch_ppc32, "ppc32"); | |
|
| | | DEF_REGISTER(or3, 630 | SPR | Arch_ppc32, "ppc32"); | |
| | | DEF_REGISTER(trap, 631 | SPR | Arch_ppc32, "ppc32"); | |
| } | | } | |
| namespace ppc64 { | | namespace ppc64 { | |
| const signed int GPR = 0x00010000; | | const signed int GPR = 0x00010000; | |
| const signed int FPR = 0x00020000; | | const signed int FPR = 0x00020000; | |
| const signed int FSR = 0x00040000; | | const signed int FSR = 0x00040000; | |
| const signed int SPR = 0x00080000; | | const signed int SPR = 0x00080000; | |
| | | | |
| DEF_REGISTER(r0, 0 | GPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(r0, 0 | GPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(r1, 1 | GPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(r1, 1 | GPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(r2, 2 | GPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(r2, 2 | GPR | Arch_ppc64, "ppc64"); | |
| | | | |
| skipping to change at line 753 | | skipping to change at line 786 | |
| DEF_REGISTER(dsisr, 18 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(dsisr, 18 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(dar, 19 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(dar, 19 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(dec, 22 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(dec, 22 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(sdr1, 25 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(sdr1, 25 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(srr0, 26 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(srr0, 26 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(srr1, 27 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(srr1, 27 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(sprg0, 272 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(sprg0, 272 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(sprg1, 273 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(sprg1, 273 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(sprg2, 274 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(sprg2, 274 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(sprg3, 275 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(sprg3, 275 | SPR | Arch_ppc64, "ppc64"); | |
|
| | | DEF_REGISTER(sprg4, 276 | SPR | Arch_ppc64, "ppc64"); | |
| | | DEF_REGISTER(sprg5, 277 | SPR | Arch_ppc64, "ppc64"); | |
| | | DEF_REGISTER(sprg6, 278 | SPR | Arch_ppc64, "ppc64"); | |
| | | DEF_REGISTER(sprg7, 279 | SPR | Arch_ppc64, "ppc64"); | |
| | | | |
| | | DEF_REGISTER(sprg3_ro, 259 | SPR | Arch_ppc64, "ppc64"); | |
| | | DEF_REGISTER(sprg4_ro, 260 | SPR | Arch_ppc64, "ppc64"); | |
| | | DEF_REGISTER(sprg5_ro, 261 | SPR | Arch_ppc64, "ppc64"); | |
| | | DEF_REGISTER(sprg6_ro, 262 | SPR | Arch_ppc64, "ppc64"); | |
| | | DEF_REGISTER(sprg7_ro, 263 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(ear, 282 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(ear, 282 | SPR | Arch_ppc64, "ppc64"); | |
|
| DEF_REGISTER(tbl, 284 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(tbl_wo, 284 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(tbu, 285 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(tbl_ro, 268 | SPR | Arch_ppc64, "ppc64"); | |
| | | DEF_REGISTER(tbu_wo, 285 | SPR | Arch_ppc64, "ppc64"); | |
| | | DEF_REGISTER(tbu_ro, 269 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(pvr, 287 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(pvr, 287 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(ibat0u, 528 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(ibat0u, 528 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(ibat0l, 529 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(ibat0l, 529 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(ibat1u, 530 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(ibat1u, 530 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(ibat1l, 531 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(ibat1l, 531 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(ibat2u, 532 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(ibat2u, 532 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(ibat2l, 533 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(ibat2l, 533 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(ibat3u, 534 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(ibat3u, 534 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(ibat3l, 535 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(ibat3l, 535 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(dbat0u, 536 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(dbat0u, 536 | SPR | Arch_ppc64, "ppc64"); | |
| | | | |
| skipping to change at line 803 | | skipping to change at line 848 | |
| DEF_REGISTER(seg7, 620 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(seg7, 620 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(cr0, 621 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(cr0, 621 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(cr1, 622 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(cr1, 622 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(cr2, 623 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(cr2, 623 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(cr3, 624 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(cr3, 624 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(cr4, 625 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(cr4, 625 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(cr5, 626 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(cr5, 626 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(cr6, 627 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(cr6, 627 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(cr7, 628 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(cr7, 628 | SPR | Arch_ppc64, "ppc64"); | |
| DEF_REGISTER(cr, 629 | SPR | Arch_ppc64, "ppc64"); | | DEF_REGISTER(cr, 629 | SPR | Arch_ppc64, "ppc64"); | |
|
| | | DEF_REGISTER(or3, 630 | SPR | Arch_ppc64, "ppc64"); | |
| | | DEF_REGISTER(trap, 631 | SPR | Arch_ppc64, "ppc64"); | |
| } | | } | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 28 change blocks. |
| 25 lines changed or deleted | | 72 lines changed or added | |
|
| slicing.h | | slicing.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 37 | | 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 | |
| */ | | */ | |
| // A simple forward slice using a search of the control flow graph. | | // A simple forward slice using a search of the control flow graph. | |
| // Templated on a function that says when to stop slicing. | | // Templated on a function that says when to stop slicing. | |
| | | | |
| #if !defined(_SLICING_H_) | | #if !defined(_SLICING_H_) | |
| #define _SLICING_H_ | | #define _SLICING_H_ | |
| | | | |
|
| #include "dyn_detail/boost/shared_ptr.hpp" | | | |
| #include <vector> | | #include <vector> | |
| #include "dyntypes.h" | | #include "dyntypes.h" | |
| #include <queue> | | #include <queue> | |
| #include <set> | | #include <set> | |
| #include <map> | | #include <map> | |
| #include <list> | | #include <list> | |
| #include <stack> | | #include <stack> | |
| | | | |
| #include "util.h" | | #include "util.h" | |
| #include "Node.h" | | #include "Node.h" | |
| | | | |
| skipping to change at line 62 | | skipping to change at line 60 | |
| namespace Dyninst { | | namespace Dyninst { | |
| | | | |
| namespace ParseAPI { | | namespace ParseAPI { | |
| class Block; | | class Block; | |
| class Edge; | | class Edge; | |
| class Function; | | class Function; | |
| }; | | }; | |
| | | | |
| class Assignment; | | class Assignment; | |
| class AbsRegion; | | class AbsRegion; | |
|
| typedef dyn_detail::boost::shared_ptr<Assignment> AssignmentPtr; | | typedef boost::shared_ptr<Assignment> AssignmentPtr; | |
| | | | |
| class Graph; | | class Graph; | |
|
| typedef dyn_detail::boost::shared_ptr<Graph> GraphPtr; | | typedef boost::shared_ptr<Graph> GraphPtr; | |
| | | | |
|
| class InstructionAPI::Instruction; | | namespace InstructionAPI { | |
| typedef dyn_detail::boost::shared_ptr<InstructionAPI::Instruction> Instruct | | class Instruction; | |
| ionPtr; | | } | |
| | | typedef boost::shared_ptr<InstructionAPI::Instruction> InstructionPtr; | |
| | | | |
| // Used in temp slicer; should probably | | // Used in temp slicer; should probably | |
| // replace OperationNodes when we fix up | | // replace OperationNodes when we fix up | |
| // the DDG code. | | // the DDG code. | |
| class SliceNode : public Node { | | class SliceNode : public Node { | |
| public: | | public: | |
|
| typedef dyn_detail::boost::shared_ptr<SliceNode> Ptr; | | typedef boost::shared_ptr<SliceNode> Ptr; | |
| | | | |
| DATAFLOW_EXPORT static SliceNode::Ptr create(AssignmentPtr ptr, | | DATAFLOW_EXPORT static SliceNode::Ptr create(AssignmentPtr ptr, | |
| ParseAPI::Block *block, | | ParseAPI::Block *block, | |
| ParseAPI::Function *func) { | | ParseAPI::Function *func) { | |
| return Ptr(new SliceNode(ptr, block, func)); | | return Ptr(new SliceNode(ptr, block, func)); | |
| } | | } | |
| | | | |
| DATAFLOW_EXPORT ParseAPI::Block *block() const { return b_; }; | | DATAFLOW_EXPORT ParseAPI::Block *block() const { return b_; }; | |
| DATAFLOW_EXPORT ParseAPI::Function *func() const { return f_; }; | | DATAFLOW_EXPORT ParseAPI::Function *func() const { return f_; }; | |
| DATAFLOW_EXPORT Address addr() const; | | DATAFLOW_EXPORT Address addr() const; | |
| | | | |
| skipping to change at line 109 | | skipping to change at line 109 | |
| ParseAPI::Function *func) : | | ParseAPI::Function *func) : | |
| a_(ptr), b_(block), f_(func) {}; | | a_(ptr), b_(block), f_(func) {}; | |
| | | | |
| AssignmentPtr a_; | | AssignmentPtr a_; | |
| ParseAPI::Block *b_; | | ParseAPI::Block *b_; | |
| ParseAPI::Function *f_; | | ParseAPI::Function *f_; | |
| }; | | }; | |
| | | | |
| class SliceEdge : public Edge { | | class SliceEdge : public Edge { | |
| public: | | public: | |
|
| typedef dyn_detail::boost::shared_ptr<SliceEdge> Ptr; | | typedef boost::shared_ptr<SliceEdge> Ptr; | |
| | | | |
| DATAFLOW_EXPORT static SliceEdge::Ptr create(SliceNode::Ptr source, | | DATAFLOW_EXPORT static SliceEdge::Ptr create(SliceNode::Ptr source, | |
| SliceNode::Ptr target, | | SliceNode::Ptr target, | |
| AbsRegion const&data) { | | AbsRegion const&data) { | |
| return Ptr(new SliceEdge(source, target, data)); | | return Ptr(new SliceEdge(source, target, data)); | |
| } | | } | |
| | | | |
| const AbsRegion &data() const { return data_; }; | | const AbsRegion &data() const { return data_; }; | |
| | | | |
| private: | | private: | |
| | | | |
| skipping to change at line 143 | | skipping to change at line 143 | |
| ParseAPI::Block *block, | | ParseAPI::Block *block, | |
| ParseAPI::Function *func); | | ParseAPI::Function *func); | |
| | | | |
| DATAFLOW_EXPORT static bool isWidenNode(Node::Ptr n); | | DATAFLOW_EXPORT static bool isWidenNode(Node::Ptr n); | |
| | | | |
| class Predicates { | | class Predicates { | |
| public: | | public: | |
| typedef std::pair<ParseAPI::Function *, int> StackDepth_t; | | typedef std::pair<ParseAPI::Function *, int> StackDepth_t; | |
| typedef std::stack<StackDepth_t> CallStack_t; | | typedef std::stack<StackDepth_t> CallStack_t; | |
| | | | |
|
| | | DATAFLOW_EXPORT virtual bool allowImprecision() { return false; } | |
| DATAFLOW_EXPORT virtual bool widenAtPoint(AssignmentPtr) { return false
; } | | DATAFLOW_EXPORT virtual bool widenAtPoint(AssignmentPtr) { return false
; } | |
| DATAFLOW_EXPORT virtual bool endAtPoint(AssignmentPtr) { return false;
} | | DATAFLOW_EXPORT virtual bool endAtPoint(AssignmentPtr) { return false;
} | |
| DATAFLOW_EXPORT virtual bool followCall(ParseAPI::Function * /*callee*/
, | | DATAFLOW_EXPORT virtual bool followCall(ParseAPI::Function * /*callee*/
, | |
| CallStack_t & /*cs*/, | | CallStack_t & /*cs*/, | |
| AbsRegion /*argument*/) { | | AbsRegion /*argument*/) { | |
| return false; | | return false; | |
| } | | } | |
| DATAFLOW_EXPORT virtual std::vector<ParseAPI::Function *> | | DATAFLOW_EXPORT virtual std::vector<ParseAPI::Function *> | |
|
| followCallBackward(ParseAPI::Block * /*callerBlock*/, | | followCallBackward(ParseAPI::Block * /*callerB*/, | |
| CallStack_t & /*cs*/, | | CallStack_t & /*cs*/, | |
| AbsRegion /* argument */) { | | AbsRegion /*argument*/) { | |
| std::vector<ParseAPI::Function *> vec; | | std::vector<ParseAPI::Function *> vec; | |
| return vec; | | return vec; | |
| } | | } | |
| DATAFLOW_EXPORT virtual bool addPredecessor(AbsRegion /*reg*/) { | | DATAFLOW_EXPORT virtual bool addPredecessor(AbsRegion /*reg*/) { | |
| return true; | | return true; | |
| } | | } | |
| DATAFLOW_EXPORT virtual bool widenAtAssignment(const AbsRegion & /*in*/
, | | DATAFLOW_EXPORT virtual bool widenAtAssignment(const AbsRegion & /*in*/
, | |
| const AbsRegion & /*out*/
) { | | const AbsRegion & /*out*/
) { | |
| return false; | | return false; | |
| } | | } | |
| | | | |
| skipping to change at line 213 | | skipping to change at line 214 | |
| | | | |
| 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; | |
| | | | |
|
| bool getStackDepth(ParseAPI::Function *func, Address callAddr, long &heig
ht); | | bool getStackDepth(ParseAPI::Function *func, ParseAPI::Block *block, Addr
ess callAddr, long &height); | |
| | | | |
| // Add the newly called function to the given Context. | | // Add the newly called function to the given Context. | |
| void pushContext(Context &context, | | void pushContext(Context &context, | |
| ParseAPI::Function *callee, | | ParseAPI::Function *callee, | |
| ParseAPI::Block *callBlock, | | ParseAPI::Block *callBlock, | |
| long stackDepth); | | long stackDepth); | |
| | | | |
| // And remove it as appropriate | | // And remove it as appropriate | |
| void popContext(Context &context); | | void popContext(Context &context); | |
| | | | |
| | | | |
| skipping to change at line 239 | | skipping to change at line 240 | |
| | | | |
| // Where we are in the block | | // Where we are in the block | |
| InsnVec::iterator current; | | InsnVec::iterator current; | |
| InsnVec::iterator end; | | InsnVec::iterator end; | |
| | | | |
| bool fwd; | | bool fwd; | |
| | | | |
| InsnVec::reverse_iterator rcurrent; | | InsnVec::reverse_iterator rcurrent; | |
| InsnVec::reverse_iterator rend; | | InsnVec::reverse_iterator rend; | |
| | | | |
|
| Address addr() const { if(fwd) return current->second; else return rcur
rent->second;} | | Address addr() const { if(fwd) return (*current).second; else return (*
rcurrent).second;} | |
| | | | |
| Location(ParseAPI::Function *f, | | Location(ParseAPI::Function *f, | |
| ParseAPI::Block *b) : func(f), block(b), fwd(true){}; | | ParseAPI::Block *b) : func(f), block(b), fwd(true){}; | |
| Location() : func(NULL), block(NULL), fwd(true) {}; | | Location() : func(NULL), block(NULL), fwd(true) {}; | |
| }; | | }; | |
| | | | |
| typedef std::queue<Location> LocList; | | typedef std::queue<Location> LocList; | |
| | | | |
| // Describes an abstract region, a minimal context | | // Describes an abstract region, a minimal context | |
| // (block and function), and the assignment that | | // (block and function), and the assignment that | |
| | | | |
| skipping to change at line 575 | | skipping to change at line 576 | |
| | | | |
| void insertPair(GraphPtr graph, | | void insertPair(GraphPtr graph, | |
| Direction dir, | | Direction dir, | |
| Element const&source, | | Element const&source, | |
| Element const&target, | | Element const&target, | |
| AbsRegion const& data); | | AbsRegion const& data); | |
| | | | |
| void convertInstruction(InstructionPtr, | | void convertInstruction(InstructionPtr, | |
| Address, | | Address, | |
| ParseAPI::Function *, | | ParseAPI::Function *, | |
|
| | | ParseAPI::Block *, | |
| std::vector<AssignmentPtr> &); | | std::vector<AssignmentPtr> &); | |
| | | | |
| void fastForward(Location &loc, Address addr); | | void fastForward(Location &loc, Address addr); | |
| | | | |
| void fastBackward(Location &loc, Address addr); | | void fastBackward(Location &loc, Address addr); | |
| | | | |
| SliceNode::Ptr widenNode(); | | SliceNode::Ptr widenNode(); | |
| | | | |
| void markAsEndNode(GraphPtr ret, Direction dir, Element ¤t); | | void markAsEndNode(GraphPtr ret, Direction dir, Element ¤t); | |
| | | | |
| | | | |
End of changes. 13 change blocks. |
| 20 lines changed or deleted | | 21 lines changed or added | |
|
| stackanalysis.h | | stackanalysis.h | |
| /* | | /* | |
|
| * Copyright (c) 1996-2011 Barton P. Miller | | * See the dyninst/COPYRIGHT file for copyright information. | |
| * | | * | |
|
| * We provide the Paradyn Parallel Performance Tools (below | | * We provide the Paradyn Tools (below described as "Paradyn") | |
| * described as "Paradyn") on an AS IS basis, and do not warrant its | | * on an AS IS basis, and do not warrant its validity or performance. | |
| * validity or performance. We reserve the right to update, modify, | | * We reserve the right to update, modify, or discontinue this | |
| * or discontinue this software at any time. We shall have no | | * software at any time. We shall have no obligation to supply such | |
| * obligation to supply such updates or modifications or any other | | * updates or modifications or any other form of support to you. | |
| * form of support to you. | | | |
| * | | * | |
| * By your use of Paradyn, you understand and agree that we (or any | | * By your use of Paradyn, you understand and agree that we (or any | |
| * other person or entity with proprietary rights in Paradyn) are | | * other person or entity with proprietary rights in Paradyn) are | |
| * under no obligation to provide either maintenance services, | | * under no obligation to provide either maintenance services, | |
| * update services, notices of latent defects, or correction of | | * update services, notices of latent defects, or correction of | |
| * defects for Paradyn. | | * defects for Paradyn. | |
| * | | * | |
| * This library is free software; you can redistribute it and/or | | * This library is free software; you can redistribute it and/or | |
| * modify it under the terms of the GNU Lesser General Public | | * modify it under the terms of the GNU Lesser General Public | |
| * License as published by the Free Software Foundation; either | | * License as published by the Free Software Foundation; either | |
| | | | |
| skipping to change at line 41 | | skipping to change at line 40 | |
| | | | |
| #if !defined(STACK_ANALYSIS_H) | | #if !defined(STACK_ANALYSIS_H) | |
| #define STACK_ANALYSIS_H | | #define STACK_ANALYSIS_H | |
| | | | |
| #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 <string> | | #include <string> | |
|
| | | #include <list> | |
| #include "util.h" | | #include "util.h" | |
|
| | | #include "dynutil/h/dyn_regs.h" | |
| | | | |
| #include "common/h/IntervalTree.h" | | #include "common/h/IntervalTree.h" | |
| | | | |
| // for blockSet... | | // for blockSet... | |
| //#include "dyninstAPI/src/image-func.h" | | //#include "dyninstAPI/src/image-func.h" | |
| | | | |
|
| #include "dyn_detail/boost/shared_ptr.hpp" | | | |
| | | | |
| // To define StackAST | | // To define StackAST | |
|
| #include "AST.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 | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
| | | | |
| skipping to change at line 84 | | skipping to change at line 84 | |
| // These are _NOT_ in the Dyninst namespace... | | // These are _NOT_ in the Dyninst namespace... | |
| namespace Dyninst { | | namespace Dyninst { | |
| | | | |
| namespace ParseAPI { | | namespace ParseAPI { | |
| class Function; | | class Function; | |
| class Block; | | class Block; | |
| }; | | }; | |
| | | | |
| namespace InstructionAPI { | | namespace InstructionAPI { | |
| class Instruction; | | class Instruction; | |
|
| | | class Expression; | |
| }; | | }; | |
| | | | |
| class StackAnalysis { | | class StackAnalysis { | |
|
| typedef dyn_detail::boost::shared_ptr<InstructionAPI::Instruction> Instru | | typedef boost::shared_ptr<InstructionAPI::Instruction> InstructionPtr; | |
| ctionPtr; | | typedef boost::shared_ptr<InstructionAPI::Expression> ExpressionPtr; | |
| | | | |
| public: | | public: | |
| | | | |
|
| // The height of a stack is actually a value from a lattice: | | class DATAFLOW_EXPORT Height { | |
| // | | | |
| // <int>: height of the stack at this point | | | |
| // BOT/uninitialized: the height of the stack at this point is unknown | | | |
| (uninitialized) | | | |
| // TOP/notUnique: the height of the stack at this point is unknown (non | | | |
| -unique) | | | |
| | | | |
| template <class T> | | | |
| T join(std::set<T> &ins) { | | | |
| if (ins.empty()) | | | |
| return T::bottom; | | | |
| | | | |
| // If there is a single element in the set return it. | | | |
| if (ins.size() == 1) | | | |
| return *(ins.begin()); | | | |
| | | | |
| // JOIN (..., top) == top | | | |
| // Since ins is sorted, if top is in the set it must | | | |
| // be the end element... | | | |
| const T &last = *(ins.rbegin()); | | | |
| if (last == T::top) return T::top; | | | |
| | | | |
| // U (bot, N) == N | | | |
| const T &first = *(ins.begin()); | | | |
| if ((ins.size() == 2) && | | | |
| (first == T::bottom)) | | | |
| return *(ins.rbegin()); | | | |
| | | | |
| // There are 2 or more elements; the first one is not | | | |
| // bottom; therefore there is a conflict, and we return | | | |
| // top. | | | |
| return T::top; | | | |
| } | | | |
| | | | |
| template <class T> | | | |
| T meet (std::set<T> &ins) { | | | |
| // Another useful default. | | | |
| if (ins.empty()) { | | | |
| return T::top; | | | |
| } | | | |
| | | | |
| // If there is a single element in the set return it. | | | |
| if (ins.size() == 1) { | | | |
| return *(ins.begin()); | | | |
| } | | | |
| | | | |
| // MEET (bottom, ...) == bottom | | | |
| // Since ins is sorted, if bottom is in the set it must | | | |
| // be the start element... | | | |
| | | | |
| if ((*(ins.begin())) == T::bottom) { | | | |
| return T::bottom; | | | |
| } | | | |
| | | | |
| // MEET (N, top) == N | | | |
| if ((ins.size() == 2) && | | | |
| ((*(ins.rbegin())) == T::top)) { | | | |
| return *(ins.begin()); | | | |
| } | | | |
| | | | |
| // There are 2 or more elements; the last one is not | | | |
| // top; therefore there is a conflict, and we return | | | |
| // bottom. | | | |
| return T::bottom; | | | |
| } | | | |
| | | | |
| // A Range represents a single unknown | | | |
| // operation on the stack pointer. It | | | |
| // consists of an <int, int> pair that | | | |
| // represents the upper and lower bounds of | | | |
| // the operation on the stack pointer and | | | |
| // an Offset that represents the instruction | | | |
| // performing the operation. | | | |
| | | | |
| class Range { | | | |
| public: | | | |
| typedef std::pair<long, long> range_t; | | | |
| | | | |
| static const range_t infinite; | | | |
| | | | |
| Range(range_t range, | | | |
| long delta, | | | |
| Offset off) : | | | |
| range_(range), delta_(delta), off_(off) {}; | | | |
| | | | |
| Range(const Range &r, | | | |
| long delta) : | | | |
| range_(r.range_), | | | |
| delta_(delta), | | | |
| off_(r.off_) {}; | | | |
| | | | |
| Range() : | | | |
| delta_(0), off_(0) { | | | |
| | | | |
| range_.first = 0; | | | |
| range_.second = 0; | | | |
| } | | | |
| | | | |
| range_t &range() { return range_; } | | | |
| Offset &off() { return off_; } | | | |
| | | | |
| bool operator== (const Range &rhs) const { | | | |
| return ((range_ == rhs.range_) && | | | |
| (off_ == rhs.off_)); | | | |
| } | | | |
| | | | |
| bool operator< (const Range &rhs) const { | | | |
| return (off_ < rhs.off_); | | | |
| } | | | |
| | | | |
| bool operator> (const Range &rhs) const { | | | |
| return (off_ > rhs.off_); | | | |
| } | | | |
| | | | |
| bool operator!= (const Range &rhs) const { | | | |
| return !((*this) == rhs); | | | |
| } | | | |
| | | | |
| std::string format() const; | | | |
| private: | | | |
| range_t range_; | | | |
| long delta_; | | | |
| Offset off_; | | | |
| // Value of the stack when the range was applied | | | |
| }; | | | |
| | | | |
| typedef std::vector<Range> Ranges; | | | |
| static const Range defaultRange; | | | |
| | | | |
| class Region { | | | |
| public: | | | |
| typedef dyn_detail::boost::shared_ptr<Region> Ptr; | | | |
| | | | |
| Region(int n, | | | |
| Range &r, | | | |
| Region::Ptr p) : | | | |
| name_(n), | | | |
| range_(r), | | | |
| prev_(p) | | | |
| {}; | | | |
| | | | |
| Region(int n) : name_(n) {}; | | | |
| Region() : name_(0) {}; | | | |
| | | | |
| int &name() { return name_; }; | | | |
| Range &range() { return range_; }; | | | |
| Ptr prev() { return prev_; }; | | | |
| | | | |
| std::string format() const; | | | |
| | | | |
| bool operator< (const Region &rhs) const { | | | |
| return name_ < rhs.name_; | | | |
| } | | | |
| | | | |
| bool operator==(const Region &rhs) const { | | | |
| return name_ == rhs.name_; | | | |
| } | | | |
| | | | |
| bool operator!= (const Region &rhs) const { | | | |
| return !(*this == rhs); | | | |
| } | | | |
| | | | |
| private: | | | |
| int name_; | | | |
| Range range_; | | | |
| Ptr prev_; | | | |
| }; | | | |
| | | | |
| class Height { | | | |
| public: | | public: | |
| typedef signed long Height_t; | | typedef signed long Height_t; | |
| | | | |
| static const Height_t uninitialized = MAXLONG; | | static const Height_t uninitialized = MAXLONG; | |
| static const Height_t notUnique = MINLONG; | | static const Height_t notUnique = MINLONG; | |
| | | | |
| static const Height bottom; | | static const Height bottom; | |
| static const Height top; | | static const Height top; | |
| | | | |
|
| Height(const Height_t h, Region::Ptr r) : | | Height(const Height_t h) : height_(h) {}; | |
| height_(h), region_(r) {}; | | Height() : height_(uninitialized) {}; | |
| Height(const Height_t h) : height_(h) {}; | | | |
| Height() : height_(uninitialized) {}; | | | |
| | | | |
| Height_t height() const { return height_; } | | Height_t height() const { return height_; } | |
|
| Region::Ptr region() const { return region_; } | | | |
| | | | |
| // FIX THIS!!! if we stop using TOP == MAXINT and | | // FIX THIS!!! if we stop using TOP == MAXINT and | |
| // BOT == MININT... | | // BOT == MININT... | |
| bool operator<(const Height &rhs) const { | | bool operator<(const Height &rhs) const { | |
|
| if (height_ == rhs.height_) | | | |
| return region_ < rhs.region_; | | | |
| return (height_ < rhs.height_); | | return (height_ < rhs.height_); | |
| } | | } | |
| | | | |
| Height &operator+= (const Height &other) { | | Height &operator+= (const Height &other) { | |
| if (isBottom()) return *this; | | if (isBottom()) return *this; | |
| if (other.isBottom()) { | | if (other.isBottom()) { | |
| *this = bottom; | | *this = bottom; | |
| return *this; | | return *this; | |
| } | | } | |
| if (other.isTop()) { | | if (other.isTop()) { | |
| return *this; | | return *this; | |
| } | | } | |
|
| | | if (isTop()) { | |
| if (region_ != other.region_) { | | height_ = other.height_; | |
| *this = bottom; | | return *this; | |
| return *this; | | | |
| } | | } | |
| | | | |
| height_ += other.height_; | | height_ += other.height_; | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| const Height operator+(const Height &rhs) const { | | const Height operator+(const Height &rhs) const { | |
| if (isBottom()) return bottom; | | if (isBottom()) return bottom; | |
| if (rhs.isBottom()) return rhs; | | if (rhs.isBottom()) return rhs; | |
| if (isTop()) return rhs; | | if (isTop()) return rhs; | |
| if (rhs.isTop()) return *this; | | if (rhs.isTop()) return *this; | |
|
| if (region_ != rhs.region_) return bottom; | | | |
| | | | |
|
| return Height(height_ + rhs.height_, region_); | | return Height(height_ + rhs.height_); | |
| } | | } | |
| | | | |
| const Height operator+(const unsigned long &rhs) const { | | const Height operator+(const unsigned long &rhs) const { | |
| if (isBottom()) return bottom; | | if (isBottom()) return bottom; | |
| if (isTop()) { | | if (isTop()) { | |
| // WTF? | | // WTF? | |
|
| return Height(rhs, region_); | | return Height(rhs); | |
| } | | } | |
|
| return Height(height_ + rhs, region_); | | return Height(height_ + rhs); | |
| } | | } | |
| | | | |
| bool operator==(const Height &rhs) const { | | bool operator==(const Height &rhs) const { | |
|
| return ((height_ == rhs.height_) && | | return height_ == rhs.height_; | |
| (region_ == rhs.region_)); | | | |
| } | | } | |
| bool operator!=(const Height &rhs) const { | | bool operator!=(const Height &rhs) const { | |
| return !(*this == rhs); | | return !(*this == rhs); | |
| } | | } | |
| | | | |
| std::string format() const { | | std::string format() const { | |
| if (isTop()) return "TOP"; | | if (isTop()) return "TOP"; | |
| if (isBottom()) return "BOTTOM"; | | if (isBottom()) return "BOTTOM"; | |
| | | | |
| std::stringstream retVal; | | std::stringstream retVal; | |
|
| retVal << height_ << region_->format(); | | retVal << height_; | |
| return retVal.str(); | | return retVal.str(); | |
| } | | } | |
| | | | |
| bool isBottom() const { | | bool isBottom() const { | |
| return height_ == notUnique; | | return height_ == notUnique; | |
| } | | } | |
| | | | |
| bool isTop() const { | | bool isTop() const { | |
| return height_ == uninitialized; | | return height_ == uninitialized; | |
| } | | } | |
| | | | |
|
| | | static Height meet(const Height &lhs, const Height &rhs) { | |
| | | if (rhs == lhs) return rhs; | |
| | | if (rhs == top) return lhs; | |
| | | if (lhs == top) return rhs; | |
| | | return bottom; | |
| | | } | |
| | | | |
| | | static Height meet (std::set<Height> &ins) { | |
| | | if (ins.empty()) { | |
| | | return top; | |
| | | } | |
| | | | |
| | | // If there is a single element in the set return it. | |
| | | if (ins.size() == 1) { | |
| | | return *(ins.begin()); | |
| | | } | |
| | | | |
| | | // MEET (bottom, ...) == bottom | |
| | | // Since ins is sorted, if bottom is in the set it must | |
| | | // be the start element... | |
| | | | |
| | | if ((*(ins.begin())) == bottom) { | |
| | | return bottom; | |
| | | } | |
| | | | |
| | | // MEET (N, top) == N | |
| | | if ((ins.size() == 2) && | |
| | | ((*(ins.rbegin())) == top)) { | |
| | | return *(ins.begin()); | |
| | | } | |
| | | | |
| | | // There are 2 or more elements; the last one is not | |
| | | // top; therefore there is a conflict, and we return | |
| | | // bottom. | |
| | | return bottom; | |
| | | } | |
| | | | |
| private: | | private: | |
| Height_t height_; | | Height_t height_; | |
|
| | | | |
| Region::Ptr region_; | | | |
| }; | | }; | |
| | | | |
| // We need to represent the effects of instructions. We do this | | // We need to represent the effects of instructions. We do this | |
| // in terms of transfer functions. We recognize the following | | // in terms of transfer functions. We recognize the following | |
| // effects on the stack. | | // effects on the stack. | |
| // | | // | |
| // Offset by known amount: push/pop/etc. | | // Offset by known amount: push/pop/etc. | |
| // Set to known value: leave | | // Set to known value: leave | |
|
| | | // Assign the stack pointer to/from an alias | |
| | | // | |
| | | // There are also: | |
| // Offset by unknown amount expressible in a range [l, h] | | // Offset by unknown amount expressible in a range [l, h] | |
| // Set to unknown value expressible in a range [l, h] | | // Set to unknown value expressible in a range [l, h] | |
|
| | | // which we don't handle yet. | |
| // | | // | |
|
| // These map as follows: | | // This gives us the following transfer functions. A transfer function | |
| // Offset by known amount: delta transfer function | | // is a function T : (RegisterVector, RegisterID, RegisterID, value) -> | |
| // Set to known value: set transfer function | | (RegisterVector) | |
| // Offset by unknown amount: new_region transfer function | | | |
| // Set to unknown value: new_region transfer function | | | |
| | | | |
| // This gives us three transfer functions. A transfer | | | |
| // function is a function T : (height, region, value) -> (height, regio | | | |
| n) | | | |
| // described as follows: | | | |
| // Delta (h, r, v) : (h+v, r) | | | |
| // Set (h, r, v) : (v, r) | | | |
| // New (h, r, vl, vh) : (0, new region(vl, vh)) | | | |
| // | | // | |
|
| // where 'new region' represents a previously unallocated region, | | // Delta(RV, f, t, v) -> RV[f] += v; | |
| // and (vl,vh) represent the range [l, h] | | // Abs(RV, f, t, v) -> RV[f] = v; | |
| | | // Alias(RV, f, t, v) -> RV[t] = RV[f]; | |
| typedef std::pair<Ranges, Height> Status; | | // In the implementations below, we provide f, t, v at construction tim | |
| | | e (as they are | |
| class InsnTransferFunc; | | // fixed) and RV as a parameter. | |
| class BlockTransferFunc; | | | |
| | | typedef std::map<MachRegister, Height> RegisterState; | |
| class InsnTransferFunc { | | | |
| public: | | struct TransferFunc { | |
| static const InsnTransferFunc top; | | static const long uninitialized = MAXLONG; | |
| static const InsnTransferFunc bottom; | | static const long notUnique = MINLONG; | |
| | | | |
| static const long uninitialized = MAXLONG; | | static const TransferFunc top; | |
| static const long notUnique = MINLONG; | | static const TransferFunc bottom; | |
| | | | |
| InsnTransferFunc() : delta_(uninitialized), abs_(false), range_(def | | typedef enum { | |
| aultRange) {}; | | Bottom, | |
| InsnTransferFunc(long delta, bool reset) : | | Delta, | |
| delta_(delta), abs_(reset), range_(defaultRange) {}; | | Abs, | |
| InsnTransferFunc(Range &r) : | | Alias } Type; | |
| delta_(0), abs_(false), range_(r) {}; | | | |
| | | static TransferFunc deltaFunc(MachRegister r, Height d); | |
| void apply(const BlockTransferFunc &in, | | static TransferFunc absFunc(MachRegister r, Height a); | |
| BlockTransferFunc &out) const; | | static TransferFunc aliasFunc(MachRegister f, MachRegister t); | |
| | | static TransferFunc bottomFunc(MachRegister r); | |
| void apply(BlockTransferFunc &update) const; | | | |
| | | bool isBottom() const; | |
| std::string format() const; | | bool isTop() const; | |
| | | bool isAbs() const; | |
| bool operator==(const InsnTransferFunc &rhs) const { | | bool isAlias() const; | |
| return ((delta_ == rhs.delta_) && | | bool isDelta() const; | |
| (abs_ == rhs.abs_) && | | | |
| (range_ == rhs.range_)); | | TransferFunc() : | |
| } | | from(MachRegister()), target(MachRegister()), delta(uninitialized), | |
| | | abs(uninitialized) {}; | |
| bool operator!=(const InsnTransferFunc &rhs) const { | | TransferFunc(Height a, Height d, MachRegister f, MachRegister t) : | |
| return !(*this == rhs); | | from(f), target(t), delta(d), abs(a) {}; | |
| } | | | |
| | | Height apply(const RegisterState &inputs) const; | |
| long &delta() { return delta_; } | | void accumulate(std::map<MachRegister, TransferFunc> &inputs); | |
| bool &abs() { return abs_; } | | | |
| Range &range() { return range_; } | | std::string format() const; | |
| | | Type type() const; | |
| private: | | | |
| long delta_; | | MachRegister from; | |
| bool abs_; | | MachRegister target; | |
| Range range_; | | Height delta; | |
| | | Height abs; | |
| }; | | }; | |
| | | | |
|
| // This is a bit of an odd beast. It's a block-level | | typedef std::list<TransferFunc> TransferFuncs; | |
| // summary of what we've done to the stack, either | | typedef std::map<MachRegister, TransferFunc> TransferSet; | |
| // from the beginning of the block or the beginning | | | |
| // of the function. As such, it's a transfer function. | | | |
| // It also needs to satisfy the join/meet requirements | | | |
| // of operator <, operator ==, top, bottom. | | | |
| | | | |
|
| class BlockTransferFunc { | | // Summarize the effects of a series (list!) of transfer functions. | |
| public: | | // Intended to summarize a block. We may want to do a better job of | |
| static const BlockTransferFunc bottom; | | // summarizing, but this works... | |
| static const BlockTransferFunc top; | | struct SummaryFunc { | |
| | | static const long uninitialized = MAXLONG; | |
| | | static const long notUnique = MINLONG; | |
| | | | |
|
| static const long uninitialized = MAXLONG; | | SummaryFunc() {}; | |
| static const long notUnique = MINLONG; | | | |
| | | | |
|
| // From meet/join requirements: default constructor | | void apply(const RegisterState &in, RegisterState &out) const; | |
| // is TOP. Represented by uninitialized delta. | | std::string format() const; | |
| | | void validate() const; | |
| | | | |
|
| // Members: | | void add(TransferFuncs &f); | |
| // delta (int) : the height difference from the start | | | |
| // to the finish | | | |
| // reset (int) : if true, the stack is reset to 0 and | | | |
| // delta measures from there. | | | |
| // ranges (int, int) : represent unknown modifications | | | |
| // of the stack (e.g., rounding, adding | | | |
| // a variable, etc.) | | | |
| | | | |
| BlockTransferFunc() : | | | |
| delta_(uninitialized), | | | |
| reset_(false), | | | |
| abs_(false) | | | |
| {}; | | | |
| BlockTransferFunc(long d, | | | |
| bool r, | | | |
| bool a) : | | | |
| delta_(d), | | | |
| reset_(r), | | | |
| abs_(a) | | | |
| {}; | | | |
| | | | |
| bool operator <(const BlockTransferFunc &rhs) const { | | | |
| if ((*this) == rhs) return false; | | | |
| | | | |
| if (rhs == top) return true; | | | |
| else if (*this == bottom) return true; | | | |
| // Arbitrary unique ordering | | | |
| else if (delta_ < rhs.delta_) return true; | | | |
| else if (delta_ > rhs.delta_) return false; | | | |
| else if (reset_ < rhs.reset_) return true; | | | |
| else if (reset_ > rhs.reset_) return false; | | | |
| else if (abs_ < rhs.abs_) return true; | | | |
| else if (abs_ > rhs.abs_) return false; | | | |
| else if (ranges_.size() < rhs.ranges_.size()) return true; | | | |
| else if (ranges_.size() > rhs.ranges_.size()) return false; | | | |
| // Errr... | | | |
| for (unsigned i = 0; i < ranges_.size(); i++) { | | | |
| if (ranges_[i] < rhs.ranges_[i]) return true; | | | |
| else if (ranges_[i] > rhs.ranges_[i]) return false; | | | |
| } | | | |
| return false; | | | |
| } | | | |
| bool operator==(const BlockTransferFunc &rhs) const { | | | |
| if ((delta_ == uninitialized) && | | | |
| (rhs.delta_ == uninitialized)) return true; | | | |
| if ((delta_ == notUnique) && | | | |
| (rhs.delta_ == notUnique)) return true; | | | |
| | | | |
| if (delta_ != rhs.delta_) return false; | | | |
| if (reset_ != rhs.reset_) return false; | | | |
| if (abs_ != rhs.abs_) return false; | | | |
| if (ranges_.size() != rhs.ranges_.size()) return false; | | | |
| for (unsigned i = 0; i < ranges_.size(); i++) { | | | |
| if (ranges_[i] != rhs.ranges_[i]) return false; | | | |
| } | | | |
| return true; | | | |
| } | | | |
| bool operator!=(const BlockTransferFunc &rhs) const { | | | |
| return !(*this == rhs); | | | |
| } | | | |
| | | | |
| void apply(const BlockTransferFunc &in, BlockTransferFunc &out) con | | | |
| st; | | | |
| void apply(BlockTransferFunc &out) const; | | | |
| | | | |
| std::string format() const; | | | |
| | | | |
| long &delta() { return delta_; } | | | |
| bool &reset() { return reset_; } | | | |
| bool &abs() { return abs_; } | | | |
| Ranges &ranges() { return ranges_; } | | | |
| | | | |
| private: | | | |
| long delta_; | | | |
| bool reset_; | | | |
| bool abs_; | | | |
| Ranges ranges_; | | | |
| }; | | | |
| | | | |
| // We map sets of Ranges to Regions using a prefix tree. | | | |
| // Each node in the tree represents a particular Range. | | | |
| | | | |
| typedef enum { | | | |
| fp_noChange, | | | |
| fp_created, | | | |
| fp_destroyed } fp_State; | | | |
| | | | |
| class RangeTree { | | | |
| public: | | | |
| struct Node { | | | |
| Node() {}; | | | |
| Node(Region::Ptr re) : | | | |
| region(re) {}; | | | |
| ~Node() { | | | |
| for (std::map<Range, Node *>::iterator i = children.begin() | | | |
| ; | | | |
| i != children.end(); i++) { | | | |
| if (i->second) | | | |
| delete i->second; | | | |
| } | | | |
| } | | | |
| | | | |
| std::map<Range, Node *> children; | | | |
| Region::Ptr region; | | | |
| }; | | | |
| | | | |
| // May expand the tree | | | |
| Region::Ptr find(Ranges &str); | | | |
| | | | |
| RangeTree(Region::Ptr initial) : curRegion(0) { | | | |
| root = new Node(initial); | | | |
| }; | | | |
| ~RangeTree() { | | | |
| delete root; | | | |
| } | | | |
| | | | |
|
| int getNewRegionID() { return ++curRegion; } | | TransferSet accumFuncs; | |
| | | | |
| private: | | | |
| int curRegion; | | | |
| Node *root; | | | |
| }; | | }; | |
| | | | |
| // The results of the stack analysis is a series of | | // The results of the stack analysis is a series of | |
| // 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. | |
| | | | |
|
| typedef class IntervalTree<Offset, Height> HeightTree; | | typedef std::map<Offset, RegisterState> StateIntervals; | |
| | | //typedef class IntervalTree<Offset, RegisterState> StateIntervals; | |
| typedef std::map<Offset, InsnTransferFunc> InsnFuncs; | | typedef std::map<ParseAPI::Block *, StateIntervals> Intervals; | |
| typedef std::map<ParseAPI::Block *, InsnFuncs> BlockToInsnFuncs; | | | |
| | | | |
| typedef std::map<ParseAPI::Function *, Height> FuncCleanAmounts; | | typedef std::map<ParseAPI::Function *, Height> FuncCleanAmounts; | |
| | | | |
|
| typedef std::map<ParseAPI::Block *, BlockTransferFunc> BlockEffects; | | typedef std::map<ParseAPI::Block *, SummaryFunc> BlockEffects; | |
| | | typedef std::map<ParseAPI::Block *, RegisterState> BlockState; | |
| | | | |
|
| typedef std::pair<fp_State, Offset> FPChange; | | // To build intervals, we must replay the effect of each instruction | |
| typedef std::vector<FPChange> FPChangePoints; | | . | |
| typedef std::map<ParseAPI::Block *, FPChangePoints> BlockToFPChangePoin | | // To avoid sucking enormous time, we keep those transfer functions | |
| ts; | | around... | |
| typedef std::map<ParseAPI::Block *, Height> BlockHeights; | | typedef std::map<ParseAPI::Block *, std::map<Offset, TransferFuncs> | |
| | | > InstructionEffects; | |
| | | | |
| DATAFLOW_EXPORT StackAnalysis(); | | DATAFLOW_EXPORT StackAnalysis(); | |
| DATAFLOW_EXPORT StackAnalysis(ParseAPI::Function *f); | | DATAFLOW_EXPORT StackAnalysis(ParseAPI::Function *f); | |
| | | | |
|
| // Lookup functions; preferred over the above | | DATAFLOW_EXPORT Height find(ParseAPI::Block *, Address addr, MachRegist | |
| DATAFLOW_EXPORT Height findSP(Address addr); | | er reg); | |
| DATAFLOW_EXPORT Height findFP(Address addr); | | // And a commonly used shortcut | |
| | | DATAFLOW_EXPORT Height findSP(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 debug(); | | DATAFLOW_EXPORT void debug(); | |
| | | | |
| private: | | private: | |
| | | | |
|
| | | std::string format(const RegisterState &input) const; | |
| | | | |
| | | MachRegister sp(); | |
| | | MachRegister fp(); | |
| | | | |
| bool analyze(); | | bool analyze(); | |
| void summarizeBlocks(); | | void summarizeBlocks(); | |
|
| | | void summarize(); | |
| | | | |
| | | void fixpoint(); | |
| | | | |
|
| void sp_fixpoint(); | | void createIntervals(); | |
| void sp_createIntervals(); | | | |
| | | | |
|
| void fp_fixpoint(); | | void createEntryInput(RegisterState &input); | |
| void fp_createIntervals(); | | void meetInputs(ParseAPI::Block *b, RegisterState &input); | |
| | | void meet(const RegisterState &source, RegisterState &accum); | |
| | | | |
| void computeInsnEffects(ParseAPI::Block *block, | | void computeInsnEffects(ParseAPI::Block *block, | |
| const InstructionPtr &insn, | | const InstructionPtr &insn, | |
| const Offset off, | | const Offset off, | |
|
| InsnTransferFunc &spFunc, | | TransferFuncs &xferFunc); | |
| fp_State &fpCopied); | | | |
| | | | |
|
| Height getStackCleanAmount(ParseAPI::Function *func); | | bool isCall(InstructionPtr insn); | |
| | | bool handleNormalCall(InstructionPtr insn, ParseAPI::Block *block, Offs | |
| | | et off, TransferFuncs &xferFuncs); | |
| | | bool handleThunkCall(InstructionPtr insn, TransferFuncs &xferFuncs); | |
| | | void handlePushPop(InstructionPtr insn, int sign, TransferFuncs &xferFu | |
| | | ncs); | |
| | | void handleReturn(InstructionPtr insn, TransferFuncs &xferFuncs); | |
| | | void handleAddSub(InstructionPtr insn, int sign, TransferFuncs &xferFun | |
| | | cs); | |
| | | void handleLEA(InstructionPtr insn, TransferFuncs &xferFuncs); | |
| | | void handleLeave(TransferFuncs &xferFuncs); | |
| | | void handlePushPopFlags(int sign, TransferFuncs &xferFuncs); | |
| | | void handlePushPopRegs(int sign, TransferFuncs &xferFuncs); | |
| | | void handlePowerAddSub(InstructionPtr insn, int sign, TransferFuncs &xf | |
| | | erFuncs); | |
| | | void handlePowerStoreUpdate(InstructionPtr insn, TransferFuncs &xferFun | |
| | | cs); | |
| | | void handleMov(InstructionPtr insn, TransferFuncs &xferFuncs); | |
| | | void handleDefault(InstructionPtr insn, TransferFuncs &xferFuncs); | |
| | | | |
|
| Region::Ptr getRegion(Ranges &ranges); | | Height getStackCleanAmount(ParseAPI::Function *func); | |
| | | | |
|
| //Block::blockSet blocks; | | | |
| ParseAPI::Function *func; | | ParseAPI::Function *func; | |
| | | | |
| // SP effect tracking | | // SP effect tracking | |
|
| BlockToInsnFuncs sp_blockToInsnFuncs; | | BlockEffects blockEffects; | |
| BlockEffects sp_blockEffects; | | InstructionEffects insnEffects; | |
| BlockEffects sp_inBlockEffects; | | | |
| BlockEffects sp_outBlockEffects; | | BlockState blockInputs; | |
| | | BlockState blockOutputs; | |
| // FP effect tracking. For now, we don't bother | | | |
| // integrating the two; instead, we mark where | | | |
| // the FP makes a copy of the SP and fill in the | | | |
| // values later | | | |
| BlockToFPChangePoints fp_changePoints; | | | |
| BlockHeights fp_inBlockHeights; | | | |
| BlockHeights fp_outBlockHeights; | | | |
| | | | |
|
| HeightTree *sp_intervals_; // Pointer so we can make it an annotation | | Intervals *intervals_; // Pointer so we can make it an annotation | |
| HeightTree *fp_intervals_; | | | |
| | | | |
| FuncCleanAmounts funcCleanAmounts; | | FuncCleanAmounts funcCleanAmounts; | |
|
| | | int word_size; | |
| | | ExpressionPtr theStackPtr; | |
| | | ExpressionPtr thePC; | |
| | | | |
|
| RangeTree rt; | | | |
| }; | | }; | |
| | | | |
| }; | | }; | |
| | | | |
| std::ostream &operator<<(std::ostream &os, const Dyninst::StackAnalysis::He
ight &h); | | std::ostream &operator<<(std::ostream &os, const Dyninst::StackAnalysis::He
ight &h); | |
| | | | |
| namespace Dyninst { | | namespace Dyninst { | |
| DEF_AST_LEAF_TYPE(StackAST, Dyninst::StackAnalysis::Height); | | DEF_AST_LEAF_TYPE(StackAST, Dyninst::StackAnalysis::Height); | |
| | | | |
| }; | | }; | |
| | | | |
End of changes. 49 change blocks. |
| 435 lines changed or deleted | | 192 lines changed or added | |
|