BPatch.h   BPatch.h 
skipping to change at line 62 skipping to change at line 62
//Keep old versions defined, that way someone can test if we're more //Keep old versions defined, that way someone can test if we're more
// at or more recent than version 5.1 with '#if defined(DYNINST_5_1)' // at or more recent than version 5.1 with '#if defined(DYNINST_5_1)'
//If they want to get the current version, they should use DYNINST_MAJOR, //If they want to get the current version, they should use DYNINST_MAJOR,
// DYNINST_MINOR, and DYNINST_SUBMINOR // DYNINST_MINOR, and DYNINST_SUBMINOR
#define DYNINST_5_1 #define DYNINST_5_1
#define DYNINST_5_2 #define DYNINST_5_2
#define DYNINST_6_0 #define DYNINST_6_0
#define DYNINST_6_1 #define DYNINST_6_1
#define DYNINST_7_0 #define DYNINST_7_0
#define DYNINST_8_0
#define DYNINST_MAJOR 7 #define DYNINST_MAJOR 8
#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 #ifdef _MSC_VER
#pragma warning(push) #pragma warning(push)
#pragma warning(disable:4251) #pragma warning(disable:4251)
 End of changes. 2 change blocks. 
1 lines changed or deleted 2 lines changed or added


 BPatch_Set.h   BPatch_Set.h 
skipping to change at line 44 skipping to change at line 44
#if defined(external_templates) #if defined(external_templates)
#pragma interface #pragma interface
#endif #endif
/*******************************************************/ /*******************************************************/
/* header files */ /* header files */
/*******************************************************/ /*******************************************************/
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <set>
#include "BPatch_dll.h" #include "BPatch_dll.h"
#include "BPatch_Vector.h" #include "BPatch_Vector.h"
#include <iostream> #include <iostream>
#include <algorithm>
#include <iterator>
#include <functional>
#if !defined(DO_INLINE_P) #if !defined(DO_INLINE_P)
#define DO_INLINE_P #define DO_INLINE_P
#endif #endif
#if !defined(DO_INLINE_F) #if !defined(DO_INLINE_F)
#define DO_INLINE_F #define DO_INLINE_F
#endif #endif
/** template struct that will be used for default compare /** template struct that will be used for default compare
* class for BPatch_Set operations. * class for BPatch_Set operations.
*/ */
// VG: shouldn't this be a dll export?
template<class T>
struct comparison {
/** default comparison operator
* returns -1 if the first arg < second arg
* returns 1 if the first arg > second arg
* returns 0 if the first arg == second arg
* @param x first argument to be compared
* @param y second argument to be compared
*/
int operator()(const T& x, const T& y) const {
if(x<y) return -1;
if(x>y) return 1;
return 0;
}
};
/** template class for BPatch_Set. The implementation is based on red black /** template class for BPatch_Set. The implementation is based on red black
* tree implementation for efficiency concerns and for getting sorted * tree implementation for efficiency concerns and for getting sorted
* elements easier. The template depends on two types. The first one is th e * elements easier. The template depends on two types. The first one is th e
* the type of the elements in the BPatch_Set and the second one is the te mplate * the type of the elements in the BPatch_Set and the second one is the te mplate
* structure that is used to compare the elements of the BPatch_Set. The t emplate * structure that is used to compare the elements of the BPatch_Set. The t emplate
* structure has to overload () for comparison of two elements as explaine d above * structure has to overload () for comparison of two elements as explaine d above
*/ */
typedef enum { RED, BLACK } bpatch_entry_color_type; typedef enum { RED, BLACK } bpatch_entry_color_type;
template<class T,class Compare = comparison<T> > template <class T>
class BPATCH_DLL_EXPORT BPatch_Set { struct comparison {
bool operator() (const T&l, const T&r) const { return l < r; }
};
private: template<class Key, class Compare = comparison<Key> >
class BPATCH_DLL_EXPORT BPatch_Set {
typedef std::set<Key, Compare> int_t;
int_t int_set;
/** tree implementation structure. Used to implement the RB tree */ public:
typedef struct entry { typedef typename int_t::iterator iterator;
T data; /* data element */ typedef typename int_t::const_iterator const_iterator;
bpatch_entry_color_type color; /* color of the node */
struct entry* left; /* left child */ typedef typename int_t::reverse_iterator reverse_iterator;
struct entry* right; /* right child */ typedef typename int_t::const_reverse_iterator const_reverse_iterator;
struct entry* parent; /* parent of the node */
iterator begin() { return int_set.begin(); }
/** constructor for structure */ const_iterator begin() const { return int_set.begin(); }
entry() iterator end() { return int_set.end(); }
: color(BLACK),left(NULL),right(NULL),parent(NULL) { const_iterator end() const { return int_set.end(); }
}
reverse_iterator rbegin() { return int_set.rbegin(); }
/** constructor used for non-nil elements const_reverse_iterator rbegin() const { return int_set.rbegin(); }
* @param e nil entry reverse_iterator rend() { return int_set.rend(); }
*/ const_reverse_iterator rend() const { return int_set.rend(); }
entry(entry* e) //constructor with nil entry
: color(RED),left(e),right(e),parent(NULL) {} DO_INLINE_F BPatch_Set() {};
/** constructor /** copy constructor.
* @param d data element * @param newBPatch_Set the BPatch_Set which will be copied
* @param e nill entry */
*/ DO_INLINE_F BPatch_Set(const BPatch_Set<Key,Compare>& rhs){
entry(const T& d,entry* e) int_set = rhs.int_set;
: data(d),color(RED),left(e),right(e),parent(NULL){} }
/** constrcutor /** returns the cardinality of the tree , number of elements */
* @param e the entry structure that will be copied DO_INLINE_F unsigned int size() const { return int_set.size(); }
*/
entry(const entry& e) : data(e.data),color(e.color), /** returns true if tree is empty */
left(NULL),right(NULL),parent(NULL) {} DO_INLINE_F bool empty() const { return int_set.empty(); }
} entry;
/** inserts the element in the tree
/** pointer to define the nil element of the tree NULL is not used * @param 1 element that will be inserted
* since some operations need sentinel nil which may have non-nil */
* parent. DO_INLINE_F void insert(const Key &k) { int_set.insert(k); }
*/
entry* nil; /** removes the element in the tree
* @param 1 element that will be removed
/** size of the BPatch_Set */ */
unsigned int setSize; DO_INLINE_F void remove(const Key &k) { int_set.erase(k); }
DO_INLINE_F void erase(const Key &k) { int_set.erase(k); }
/** pointer to the tree structure */
entry* setData; /** returns true if the argument is member of the BPatch_Set
* @param e the element that will be searched for
/** the structure that will be used for comparisons. Default is the */
* the comparsion structure explained above */ DO_INLINE_F bool contains(const Key &key) const { return int_set.find(ke
Compare compareFunc; y) != int_set.end(); }
// method that replicates the tree structure of this tree /** fill an buffer array with the sorted
DO_INLINE_P entry* replicateTree(entry*,entry*,entry*,entry*); * elements of the BPatch_Set in ascending order according to comparison
function
// method that implements left rotattion used by RB tree for balance * if the BPatch_Set is empty it retuns NULL, other wise it returns
d * the input argument.
// tree construction and keeps the RBtree properties. */
DO_INLINE_P void leftRotate(entry*); DO_INLINE_F Key* elements(Key *a) const {
std::copy(begin(), end(), a);
// method that implements right rotattion used by RB tree for balanc return a;
ed }
// tree construction and keeps the RBtree properties.
DO_INLINE_P void rightRotate(entry*); /** Like the above, but put things in a vector.
*/
// method that modifies the tree structure after deletion for keepin DO_INLINE_F void elements(BPatch_Vector<Key> &v) {
g std::copy(begin(), end(), std::back_inserter(v));
// the RBtree properties. }
DO_INLINE_P void deleteFixup(entry*);
/** returns the minimum valued member in the BPatch_Set according to the
// insertion to a binary search tree. It returns the new element poi * comparison function supplied. If the BPatch_Set is empty it retuns
nter * any number. Not safe to use for empty sets
// that is inserted. If element is already there it returns NULL */
DO_INLINE_P entry* treeInsert(const T&); DO_INLINE_F Key minimum() const {
if (empty()) return Key();
// finds the elemnts in the tree that will be replaced with the elem return *begin();
ent }
// being deleted in the deletion. That is the element with the larg
ets /** returns the maximum valued member in the BPatch_Set according to the
// smallest value than the element being deleted. * comparison function supplied. If the BPatch_Set is empty it retuns
DO_INLINE_P entry* treeSuccessor(entry* ) const; * any number. Not safe to use for empty sets
*/
// method that returns the entry pointer for the element that is sea DO_INLINE_F Key maximum() const {
rched if (empty()) return Key();
//for. If the entry is not found then it retuns NULL return *(--end());
DO_INLINE_P entry* find(const T&) const; }
// infix traverse of the RB tree. It traverses the tree in ascending /** assignment operator for BPatch_Set. It replicate sthe tree
order * structure into the new BPatch_Set.
DO_INLINE_P void traverse(T*,entry*,int&) const; * @param 1 BPatch_Set that will be used in assignment
*/
// And vectorized DO_INLINE_F BPatch_Set<Key,Compare>& operator= (const BPatch_Set<Key,Com
DO_INLINE_P void traverse(BPatch_Vector<T> &, entry *) const; pare>&rhs) {
int_set = rhs.int_set;
// deletes the tree structure for deconstructor. return *this;
DO_INLINE_P void destroy(entry*); }
public: /** equality comparison for the BPatch_Set
* @param 1 BPatch_Set that will be used equality check
class iterator */
{ DO_INLINE_F bool operator== (const BPatch_Set<Key,Compare>&rhs) const {
private: return int_set == rhs.int_set;
entry* ent; }
entry* nil;
public: /** inequality comparison for the BPatch_Set
iterator(): ent( NULL ), nil( NULL ){} * @param 1 BPatch_Set that will be used inequality check
iterator( entry* e, BPatch_Set<T, Compare >* bs ) */
: ent( e ), nil( bs->nil ){} DO_INLINE_F bool operator!= (const BPatch_Set<Key,Compare>&rhs) const {
~iterator(){} return int_set != rhs.int_set;
}
void operator++( int )
{ /** insertion in to the BPatch_Set
if( ent == nil || ent == NULL ) * @param 1 element that will be inserted
return; */
DO_INLINE_F BPatch_Set<Key,Compare>& operator+= (const Key &k) {
//current node has right child int_set.insert(k);
if( ent->right != nil ) return *this;
{ }
ent = ent->right;
while( ent->left != nil ) /** union operation with this BPatch_Set
ent = ent->left; * @param 1 BPatch_Set that will be used in union operation
} */
else DO_INLINE_F BPatch_Set<Key,Compare>& operator|= (const BPatch_Set<Key,Co
{ mpare> &rhs) {
while( ent->parent && ent->parent != nil && Compare comp;
ent->parent->right != nil && ent == ent->parent->rig std::set<Key, Compare> tmp;
ht ) std::set_union(begin(), end(), rhs.begin(), rhs.end(),
{ std::inserter(tmp, tmp.begin()), comp);
ent = ent->parent; int_set.swap(tmp);
} return *this;
}
if( ent->parent == nil || ent->parent == NULL )
{ /** intersection operation with this BPatch_Set
ent = nil; * @param 1 BPatch_Set that will be used in intersection operation
} */
else DO_INLINE_F BPatch_Set<Key,Compare>& operator&= (const BPatch_Set<Key,Co
{ mpare>&rhs) {
ent = ent->parent; Compare comp;
} std::set<Key, Compare> tmp;
} std::set_intersection(begin(), end(), rhs.begin(), rhs.end(),
} std::inserter(tmp, tmp.begin()), comp);
int_set.swap(tmp);
void operator--( int ) return *this;
{ }
if( ent == nil || ent == NULL )
return; /** difference operation with this BPatch_Set
* @param 1 BPatch_Set that will be used in difference operation
//current node has left child */
if( ent->left != nil ) DO_INLINE_F BPatch_Set<Key,Compare>& operator-= (const BPatch_Set<Key,Co
{ mpare>&rhs) {
ent = ent->left; Compare comp;
while( ent->right != nil ) std::set<Key, Compare> tmp;
ent = ent->right; std::set_difference(begin(), end(), rhs.begin(), rhs.end(),
} std::inserter(tmp, tmp.begin()), comp);
else int_set.swap(tmp);
{ return *this;
while( ent->parent && ent->parent != nil && }
ent->parent->left != nil && ent == ent->parent->left
) /** union operation
{ * @param 1 BPatch_Set that will be used in union operation
ent = ent->parent; */
} DO_INLINE_F BPatch_Set<Key,Compare> operator| (const BPatch_Set<Key,Comp
are>&rhs) const {
if( ent->parent == nil || ent->parent == NULL ) Compare comp;
{ BPatch_Set<Key, Compare> tmp;
ent = nil; std::set_union(begin(), end(), rhs.begin(), rhs.end(),
} std::inserter(tmp.int_set, tmp.int_set.begin()), comp)
else ;
{ return tmp;
ent = ent->parent; }
}
} /** intersection operation
} * @param 1 BPatch_Set that will be used in intersection operation
*/
void operator=( const iterator& right ) DO_INLINE_F BPatch_Set<Key,Compare> operator& (const BPatch_Set<Key,Comp
{ are>&rhs) const {
ent = right.ent; Compare comp;
nil = right.nil; BPatch_Set<Key, Compare> tmp;
} std::set_intersection(begin(), end(), rhs.begin(), rhs.end(),
std::inserter(tmp.int_set, tmp.int_set.begin())
bool operator==( const iterator& right ) , comp);
{ return tmp;
return ent == right.ent; }
}
bool operator!=( const iterator& right ) /** difference operation
{ * @param 1 BPatch_Set that will be used in difference operation
return ent != right.ent; */
} DO_INLINE_F BPatch_Set<Key,Compare> operator- (const BPatch_Set<Key,Comp
are>&rhs) const {
T& operator*() Compare comp;
{ BPatch_Set<Key, Compare> tmp;
return ent->data; std::set_difference(begin(), end(), rhs.begin(), rhs.end(),
} std::inserter(tmp.int_set, tmp.int_set.begin()),
}; comp);
return tmp;
friend class iterator; }
iterator begin() /** removes the element in the root of the tree
{ * if the BPatch_Set is empty it return false
entry* b = setData; * @param e refernce to the element that the value of removed
/* Check for an empty set */ * element will be copied.
if (b == nil) */
return iterator(nil, this); DO_INLINE_F bool extract(Key&k) {
if (empty()) return false;
while( b->left != nil ) iterator iter = begin();
b = b->left; std::advance(iter, size() / 2);
k = *iter;
return iterator( b, this ); int_set.erase(iter);
} return true;
}
iterator end()
{
return iterator( nil, this );
}
iterator rend()
{
return iterator( nil, this );
}
iterator rbegin()
{
entry* b = setData;
/* Check for an empty set */
if (b == nil)
return iterator(nil, this);
while( b->right != nil )
b = b->right;
return iterator( b, this );
}
/** constructor. The default comparison structure is used */
DO_INLINE_F BPatch_Set() : setSize(0), compareFunc()
{
nil = new entry;
setData = nil;
//compareFunc = Compare();
}
/** copy constructor.
* @param newBPatch_Set the BPatch_Set which will be copied
*/
DO_INLINE_F BPatch_Set(const BPatch_Set<T,Compare>& newBPatch_Set){
nil = new entry;
compareFunc = newBPatch_Set.compareFunc;
setSize = newBPatch_Set.setSize;
setData = replicateTree(newBPatch_Set.setData,NULL,newBPatch
_Set.nil,nil);
}
/** destructor which deletes all tree structure and allocated entrie
s */
DO_INLINE_F ~BPatch_Set()
{
destroy(setData);
delete nil;
}
/** returns the cardinality of the tree , number of elements */
DO_INLINE_F unsigned int size() const { return setSize; }
/** returns true if tree is empty */
DO_INLINE_F bool empty() const { return (setData == nil); }
/** inserts the element in the tree
* @param 1 element that will be inserted
*/
DO_INLINE_F void insert(const T&);
/** removes the element in the tree
* @param 1 element that will be removed
*/
DO_INLINE_F void remove(const T&);
/** returns true if the argument is member of the BPatch_Set
* @param e the element that will be searched for
*/
DO_INLINE_F bool contains(const T&) const;
/** fill an buffer array with the sorted
* elements of the BPatch_Set in ascending order according to compa
rison function
* if the BPatch_Set is empty it retuns NULL, other wise it returns
* the input argument.
*/
DO_INLINE_F T* elements(T*) const;
/** Like the above, but put things in a vector.
*/
DO_INLINE_F void elements(BPatch_Vector<T> &) const;
/** returns the minimum valued member in the BPatch_Set according to
the
* comparison function supplied. If the BPatch_Set is empty it retu
ns
* any number. Not safe to use for empty sets
*/
DO_INLINE_F T minimum() const;
/** returns the maximum valued member in the BPatch_Set according to
the
* comparison function supplied. If the BPatch_Set is empty it retu
ns
* any number. Not safe to use for empty sets
*/
DO_INLINE_F T maximum() const;
/** assignment operator for BPatch_Set. It replicate sthe tree
* structure into the new BPatch_Set.
* @param 1 BPatch_Set that will be used in assignment
*/
DO_INLINE_F BPatch_Set<T,Compare>& operator= (const BPatch_Set<T,Com
pare>&);
/** equality comparison for the BPatch_Set
* @param 1 BPatch_Set that will be used equality check
*/
DO_INLINE_F bool operator== (const BPatch_Set<T,Compare>&) const;
/** inequality comparison for the BPatch_Set
* @param 1 BPatch_Set that will be used inequality check
*/
DO_INLINE_F bool operator!= (const BPatch_Set<T,Compare>&) const;
/** insertion in to the BPatch_Set
* @param 1 element that will be inserted
*/
DO_INLINE_F BPatch_Set<T,Compare>& operator+= (const T&);
/** union operation with this BPatch_Set
* @param 1 BPatch_Set that will be used in union operation
*/
DO_INLINE_F BPatch_Set<T,Compare>& operator|= (const BPatch_Set<T,Co
mpare>&);
/** intersection operation with this BPatch_Set
* @param 1 BPatch_Set that will be used in intersection operation
*/
DO_INLINE_F BPatch_Set<T,Compare>& operator&= (const BPatch_Set<T,Co
mpare>&);
/** difference operation with this BPatch_Set
* @param 1 BPatch_Set that will be used in difference operation
*/
DO_INLINE_F BPatch_Set<T,Compare>& operator-= (const BPatch_Set<T,Co
mpare>&);
/** union operation
* @param 1 BPatch_Set that will be used in union operation
*/
DO_INLINE_F BPatch_Set<T,Compare> operator| (const BPatch_Set<T,Comp
are>&) const;
/** intersection operation
* @param 1 BPatch_Set that will be used in intersection operation
*/
DO_INLINE_F BPatch_Set<T,Compare> operator& (const BPatch_Set<T,Comp
are>&) const;
/** difference operation
* @param 1 BPatch_Set that will be used in difference operation
*/
DO_INLINE_F BPatch_Set<T,Compare> operator- (const BPatch_Set<T,Comp
are>&) const;
/** removes the element in the root of the tree
* if the BPatch_Set is empty it return false
* @param e refernce to the element that the value of removed
* element will be copied.
*/
DO_INLINE_F bool extract(T&);
}; };
// VG(06/15/02): VC.NET doesn't like definitions for dll imports
#ifndef BPATCH_DLL_IMPORT
template <class T,class Compare>
DO_INLINE_P
typename BPatch_Set<T,Compare>::entry*
BPatch_Set<T,Compare>::replicateTree(entry* node,entry* parent,
entry* oldNil,entry* newNil)
{
if(node == oldNil)
return newNil;
entry* newNode = new entry(*node);
newNode->parent = parent;
newNode->left = replicateTree(node->left,newNode,oldNil,newNil);
newNode->right = replicateTree(node->right,newNode,oldNil,newNil);
return newNode;
}
template <class T,class Compare>
DO_INLINE_P
void BPatch_Set<T,Compare>::destroy(entry* node){
if(!node || (node == nil))
return;
if(node->left != nil)
destroy(node->left);
if(node->right != nil)
destroy(node->right);
delete node;
}
template <class T,class Compare>
DO_INLINE_P
void BPatch_Set<T,Compare>::traverse(T* all,entry* node,int& n) const{
if(node == nil)
return;
if(node->left != nil)
traverse(all,node->left,n);
if(all)
all[n++] = node->data;
if(node->right != nil)
traverse(all,node->right,n);
}
template <class T,class Compare>
DO_INLINE_P
void BPatch_Set<T,Compare>::traverse(BPatch_Vector<T> &all,entry* node) con
st{
if(node == nil)
return;
if(node->left != nil)
traverse(all,node->left);
all.push_back(node->data);
if(node->right != nil)
traverse(all,node->right);
}
template <class T,class Compare>
DO_INLINE_F T BPatch_Set<T,Compare>::minimum() const{
if(setData == nil)
return nil->data;
entry* node = setData;
while(node->left != nil)
node = node->left;
return node->data;
}
template <class T,class Compare>
DO_INLINE_F T BPatch_Set<T,Compare>::maximum() const{
if(setData == nil)
return nil->data;
entry* node = setData;
while(node->right != nil)
node = node->right;
return node->data;
}
template <class T,class Compare>
DO_INLINE_F T* BPatch_Set<T,Compare>::elements(T* buffer) const{
if(setData == nil) return NULL;
if(!buffer) return NULL;
int tmp = 0;
traverse(buffer,setData,tmp);
return buffer;
}
template <class T,class Compare>
DO_INLINE_F void BPatch_Set<T,Compare>::elements(BPatch_Vector<T> &buffer)
const{
if(setData == nil) return;
traverse(buffer,setData);
return;
}
template <class T,class Compare>
DO_INLINE_F BPatch_Set<T,Compare>& BPatch_Set<T,Compare>::operator= (const
BPatch_Set<T,Compare>& newBPatch_Set){
if(this == &newBPatch_Set)
return *this;
destroy(setData);
compareFunc = newBPatch_Set.compareFunc;
setSize = newBPatch_Set.setSize;
nil->parent = NULL;
setData = replicateTree(newBPatch_Set.setData,NULL,newBPatch_Set.nil
,nil);
return *this;
}
template <class T,class Compare>
DO_INLINE_F bool BPatch_Set<T,Compare>::operator== (const BPatch_Set<T,Comp
are>& newBPatch_Set) const{
unsigned int i;
if(this == &newBPatch_Set)
return true;
T* all = new T[newBPatch_Set.size()];
newBPatch_Set.elements(all);
for(i=0;i<newBPatch_Set.size();i++)
if(!contains(all[i]))
return false;
delete[] all;
all = new T[setSize];
elements(all);
for(i=0;i<setSize;i++)
if(!newBPatch_Set.contains(all[i]))
return false;
delete[] all;
return true;
}
template <class T,class Compare>
DO_INLINE_F bool BPatch_Set<T,Compare>::operator!= (const BPatch_Set<T,Comp
are>& newBPatch_Set) const{
return !(*this == newBPatch_Set);
}
template <class T,class Compare>
DO_INLINE_F BPatch_Set<T,Compare>& BPatch_Set<T,Compare>::operator+= (const
T& element){
insert(element);
return *this;
}
template <class T,class Compare>
DO_INLINE_F BPatch_Set<T,Compare>& BPatch_Set<T,Compare>::operator|= (const
BPatch_Set<T,Compare>& newBPatch_Set){
if(this == &newBPatch_Set)
return *this;
T* all = new T[newBPatch_Set.size()];
newBPatch_Set.elements(all);
for(unsigned int i=0;i<newBPatch_Set.size();i++)
insert(all[i]);
delete[] all;
return *this;
}
template <class T,class Compare>
DO_INLINE_F BPatch_Set<T,Compare>& BPatch_Set<T,Compare>::operator&= (const
BPatch_Set<T,Compare>& newBPatch_Set){
if(this == &newBPatch_Set)
return *this;
T* all = new T[setSize];
elements(all);
unsigned int s = setSize;
for(unsigned int i=0;i<s;i++)
if(!newBPatch_Set.contains(all[i]))
remove(all[i]);
delete[] all;
return *this;
}
template <class T,class Compare>
DO_INLINE_F BPatch_Set<T,Compare>& BPatch_Set<T,Compare>::operator-= (const
BPatch_Set<T,Compare>& newBPatch_Set){
T* all = new T[setSize];
elements(all);
unsigned int s = setSize;
for(unsigned int i=0;i<s;i++)
if(newBPatch_Set.contains(all[i]))
remove(all[i]);
delete[] all;
return *this;
}
template <class T,class Compare>
DO_INLINE_F BPatch_Set<T,Compare> BPatch_Set<T,Compare>::operator| (const B
Patch_Set<T,Compare>& newBPatch_Set) const{
BPatch_Set<T,Compare> ret;
ret |= newBPatch_Set;
ret |= *this;
return ret;
}
template <class T,class Compare>
DO_INLINE_F BPatch_Set<T,Compare> BPatch_Set<T,Compare>::operator& (const B
Patch_Set<T,Compare>& newBPatch_Set) const{
BPatch_Set<T,Compare> ret;
ret |= newBPatch_Set;
ret &= *this;
return ret;
}
template <class T,class Compare>
DO_INLINE_F BPatch_Set<T,Compare> BPatch_Set<T,Compare>::operator- (const B
Patch_Set<T,Compare>& newBPatch_Set) const{
BPatch_Set<T,Compare> ret;
ret |= *this;
ret -= newBPatch_Set;
return ret;
}
template <class T,class Compare>
DO_INLINE_P
void BPatch_Set<T,Compare>::leftRotate(entry* pivot){
if(!pivot || (pivot == nil))
return;
entry* y = pivot->right;
if(y == nil)
return;
pivot->right = y->left;
if(y->left != nil)
y->left->parent = pivot;
y->parent = pivot->parent;
if(!pivot->parent)
setData = y;
else if(pivot == pivot->parent->left)
pivot->parent->left = y;
else
pivot->parent->right = y;
y->left = pivot;
pivot->parent = y;
}
template <class T,class Compare>
DO_INLINE_P
void BPatch_Set<T,Compare>::rightRotate(entry* pivot){
if(!pivot || (pivot == nil))
return;
entry* x = pivot->left;
if(x == nil)
return;
pivot->left = x->right;
if(x->right != nil)
x->right->parent = pivot;
x->parent = pivot->parent;
if(!pivot->parent)
setData = x;
else if(pivot == pivot->parent->left)
pivot->parent->left = x;
else
pivot->parent->right = x;
x->right = pivot;
pivot->parent = x;
}
template <class T,class Compare>
DO_INLINE_P
typename BPatch_Set<T,Compare>::entry*
BPatch_Set<T,Compare>::find(const T& element) const{
entry* x = setData;
while(x != nil){
int check = compareFunc(element,x->data);
if(check < 0)
x = x->left;
else if(check > 0)
x = x->right;
else
return x;
}
return NULL;
}
template <class T,class Compare>
DO_INLINE_F bool BPatch_Set<T,Compare>::contains(const T& element) const{
entry* x = setData;
while(x != nil){
int check = compareFunc(element,x->data);
if(check < 0)
x = x->left;
else if(check > 0)
x = x->right;
else
return true;
}
return false;
}
/** return pointer if the node is inserted, returns NULL if thevalue is
* already there
*/
template <class T,class Compare>
DO_INLINE_P
typename BPatch_Set<T,Compare>::entry*
BPatch_Set<T,Compare>::treeInsert(const T& element){
entry* y = NULL;
entry* x = setData;
while(x != nil){
y = x;
int check = compareFunc(element,x->data);
if(check < 0)
x = x->left;
else if(check > 0)
x = x->right;
else
return NULL;
}
entry* z = new entry(element,nil);
z->parent = y;
if(!y)
setData = z;
else {
int check = compareFunc(element,y->data);
if(check < 0)
y->left = z;
else if(check > 0)
y->right = z;
}
setSize++;
return z;
}
/** finds the minimum value node when x is being deleted */
template <class T,class Compare>
DO_INLINE_P
typename BPatch_Set<T,Compare>::entry*
BPatch_Set<T,Compare>::treeSuccessor(entry* x) const{
if(!x || (x == nil))
return NULL;
if(x->right != nil){
entry* z = x->right;
while(z->left != nil) z = z->left;
return z;
}
entry* y = x->parent;
while(y && (x == y->right)){
x = y;
y = y->parent;
}
return y;
}
template <class T,class Compare>
DO_INLINE_P
void BPatch_Set<T,Compare>::deleteFixup(entry* x){
while((x != setData) &&
(x->color == BLACK))
{
if(x == x->parent->left){
entry* w = x->parent->right;
if(w->color == RED){
w->color = BLACK;
x->parent->color = RED;
leftRotate(x->parent);
w = x->parent->right;
}
if((w->left->color == BLACK) &&
(w->right->color == BLACK)){
w->color = RED;
x = x->parent;
}
else{
if(w->right->color == BLACK){
w->left->color = BLACK;
w->color = RED;
rightRotate(w);
w = x->parent->right;
}
w->color = x->parent->color;
x->parent->color = BLACK;
w->right->color = BLACK;
leftRotate(x->parent);
x = setData;
}
}
else{
entry* w = x->parent->left;
if(w->color == RED){
w->color = BLACK;
x->parent->color = RED;
rightRotate(x->parent);
w = x->parent->left;
}
if((w->right->color == BLACK) &&
(w->left->color == BLACK)){
w->color = RED;
x = x->parent;
}
else{
if(w->left->color == BLACK){
w->right->color = BLACK;
w->color = RED;
leftRotate(w);
w = x->parent->left;
}
w->color = x->parent->color;
x->parent->color = BLACK;
w->left->color = BLACK;
rightRotate(x->parent);
x = setData;
}
}
}
x->color = BLACK;
}
template <class T,class Compare>
DO_INLINE_F void BPatch_Set<T,Compare>::insert(const T& element){
entry* x = treeInsert(element);
if(!x) return;
x->color = RED;
while((x != setData) && (x->parent->color == RED)){
if(x->parent == x->parent->parent->left){
entry* y = x->parent->parent->right;
if(y->color == RED){
x->parent->color = BLACK;
y->color = BLACK;
x->parent->parent->color = RED;
x = x->parent->parent;
}
else{
if(x == x->parent->right){
x = x->parent;
leftRotate(x);
}
x->parent->color = BLACK;
x->parent->parent->color = RED;
rightRotate(x->parent->parent);
}
}
else{
entry* y = x->parent->parent->left;
if(y->color == RED){
x->parent->color = BLACK;
y->color = BLACK;
x->parent->parent->color = RED;
x = x->parent->parent;
}
else{
if(x == x->parent->left){
x = x->parent;
rightRotate(x);
}
x->parent->color = BLACK;
x->parent->parent->color = RED;
leftRotate(x->parent->parent);
}
}
}
setData->color = BLACK;
}
template <class T,class Compare>
DO_INLINE_F void BPatch_Set<T,Compare>::remove(const T& element){
entry* z = find(element);
if(!z)
return;
entry* y=((z->left == nil)||(z->right == nil)) ? z : treeSuccessor(z
);
entry* x=(y->left != nil) ? y->left : y->right;
x->parent = y->parent;
if(!y->parent)
setData = x;
else if(y == y->parent->left)
y->parent->left = x;
else
y->parent->right = x;
if(y != z)
z->data = y->data;
if(y->color == BLACK)
deleteFixup(x);
setSize--;
delete y;
}
template <class T,class Compare>
DO_INLINE_F
bool BPatch_Set<T,Compare>::extract(T& element){
element = setData->data;
if(setData == nil)
return false;
remove(element);
return true;
}
#endif /* BPATCH_DLL_IMPORT */
#endif /* _BPatch_Set_h_ */ #endif /* _BPatch_Set_h_ */
 End of changes. 7 change blocks. 
858 lines changed or deleted 219 lines changed or added


 BPatch_addressSpace.h   BPatch_addressSpace.h 
skipping to change at line 421 skipping to change at line 421
// 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),
BPatch_module *, loadLibrary,(const char *libname, bool reload = false) ); BPatch_object *, 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. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 BPatch_basicBlock.h   BPatch_basicBlock.h 
skipping to change at line 329 skipping to change at line 329
/** 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::ParseAPI::Block *() const;
operator Dyninst::PatchAPI::PatchBlock *() const; operator Dyninst::PatchAPI::PatchBlock *() const;
int blockNo() const; int blockNo() const;
struct compare {
int operator()(CONST_EXPORT BPatch_basicBlock *b1,
CONST_EXPORT BPatch_basicBlock *b2) CONST_EXPORT
{
if (b1->getStartAddress() < b2->getStartAddress())
return -1;
if (b1->getStartAddress() > b2->getStartAddress())
return 1;
return 0;
//if (b1->blockNo() < b2->blockNo())
// return -1;
//if (b1->blockNo() > b2->blockNo())
// return 1;
//return 0;
}
};
}; };
template <> template <>
struct comparison <BPatch_basicBlock *> { struct comparison <BPatch_basicBlock *> {
int operator()(const BPatch_basicBlock * const &x, bool operator()(const BPatch_basicBlock * const &x,
const BPatch_basicBlock * const &y) const { const BPatch_basicBlock * const &y) const {
if (x->getStartAddress() < y->getStartAddress()) return -1; return (x->getStartAddress() < y->getStartAddress());
if (x->getStartAddress() > y->getStartAddress()) return 1;
return 0;
}; };
}; };
#endif /* _BPatch_basicBlock_h_ */ #endif /* _BPatch_basicBlock_h_ */
 End of changes. 3 change blocks. 
20 lines changed or deleted 2 lines changed or added


 BPatch_binaryEdit.h   BPatch_binaryEdit.h 
skipping to change at line 147 skipping to change at line 147
API_EXPORT(Int, (atomic, modified), API_EXPORT(Int, (atomic, modified),
bool, finalizeInsertionSet, (bool atomic, bool *modified = N ULL)); bool, finalizeInsertionSet, (bool atomic, bool *modified = N ULL));
// BPatch_binaryEdit::loadLibrary // BPatch_binaryEdit::loadLibrary
// //
// Load a shared library into the mutatee's address space // Load a shared library into the mutatee's address space
// Returns true if successful // Returns true if successful
API_EXPORT_VIRT(Int, (libname, reload), API_EXPORT_VIRT(Int, (libname, reload),
BPatch_module *, loadLibrary,(const char *libname, bool reload = false) ); BPatch_object *, loadLibrary,(const char *libname, bool reload = false));
}; };
#endif /* BPatch_binaryEdit_h_ */ #endif /* BPatch_binaryEdit_h_ */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 BPatch_flowGraph.h   BPatch_flowGraph.h 
skipping to change at line 190 skipping to change at line 190
BPatch_function *func_; BPatch_function *func_;
BPatch_addressSpace *addSpace; BPatch_addressSpace *addSpace;
// BPatch_process *bproc; // BPatch_process *bproc;
BPatch_module *mod; BPatch_module *mod;
/** set of loops contained in control flow graph */ /** set of loops contained in control flow graph */
BPatch_Set<BPatch_basicBlockLoop*> *loops; BPatch_Set<BPatch_basicBlockLoop*> *loops;
/** set of all basic blocks that control flow graph has */ /** set of all basic blocks that control flow graph has */
BPatch_Set<BPatch_basicBlock*, BPatch_basicBlock::compare> allBlocks; BPatch_Set<BPatch_basicBlock*> allBlocks;
/** root of the tree of loops */ /** root of the tree of loops */
BPatch_loopTreeNode *loopRoot; BPatch_loopTreeNode *loopRoot;
/** set of back edges */ /** set of back edges */
BPatch_Set<BPatch_edge*> backEdges; BPatch_Set<BPatch_edge*> backEdges;
/** flag that keeps whether dominator info is initialized*/ /** flag that keeps whether dominator info is initialized*/
bool isDominatorInfoReady; bool isDominatorInfoReady;
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 BPatch_function.h   BPatch_function.h 
skipping to change at line 182 skipping to change at line 182
// BPatch_storageClass _sc = BPatch_storageFrameOffset); // BPatch_storageClass _sc = BPatch_storageFrameOffset);
void fixupUnknown(BPatch_module *); void fixupUnknown(BPatch_module *);
// This isn't so much for internal use only, but it *should* // This isn't so much for internal use only, but it *should*
// remain undocumented for now. // remain undocumented for now.
bool containsSharedBlocks(); bool containsSharedBlocks();
// End of functions for internal use only // End of functions for internal use only
// For users of the library: // For users of the library:
API_EXPORT(Str, (), std::string, getName, ()); API_EXPORT(Str, (), std::string, getName, ());
API_EXPORT(Str, (), std::string, getDemangledName, ());
API_EXPORT(Str, (), std::string, getMangledName, ());
API_EXPORT(Str, (), std::string, getTypedName, ());
API_EXPORT(Str, (names), bool, getNames, (std::vector<std::string> &
names));
API_EXPORT(Str, (names), bool, getDemangledNames, (std::vector<std::
string> &names));
API_EXPORT(Str, (names), bool, getMangledNames, (std::vector<std::st
ring> &names));
API_EXPORT(Str, (names), bool, getTypedNames, (std::vector<std::stri
ng> &names));
// BPatch_function::getName // BPatch_function::getName
// Returns <demangled> name of function // Returns <demangled> name of function
API_EXPORT(Buffer, (s, len), API_EXPORT(Buffer, (s, len),
char *,getName,(char *s, int len)); char *,getName,(char *s, int len));
// String interface to mangled name // String interface to mangled name
API_EXPORT(Str, (), std::string, getMangledName, ());
// BPatch_function::getMangledName // BPatch_function::getMangledName
// Returns mangled name of function, same as getName for non-c++ mutat ees // Returns mangled name of function, same as getName for non-c++ mutat ees
API_EXPORT(Int, (s, len), API_EXPORT(Int, (s, len),
char *,getMangledName,(char *s, int len)); char *,getMangledName,(char *s, int len));
// BPatch_function::getTypedName // BPatch_function::getTypedName
// Returns demanged name of function (with type string), may be empty // Returns demanged name of function (with type string), may be empty
API_EXPORT(Int, (s, len), API_EXPORT(Int, (s, len),
 End of changes. 3 change blocks. 
2 lines changed or deleted 11 lines changed or added


 BPatch_module.h   BPatch_module.h 
skipping to change at line 64 skipping to change at line 64
class func_instance; 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; class BPatch_module;
class BPatch_object; class BPatch_object;
namespace Dyninst { namespace Dyninst {
namespace ParseAPI { namespace SymtabAPI {
class CodeObject; class Module;
CodeObject *convert(const BPatch_module *); SYMTAB_EXPORT Module *convert(const BPatch_module *);
} }
namespace PatchAPI { namespace PatchAPI {
class PatchObject; class PatchFunction;
PatchObject *convert(const BPatch_module *); class Point;
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
skipping to change at line 98 skipping to change at line 92
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 friend Dyninst::SymtabAPI::Module *Dyninst::SymtabAPI::convert(const BP
BPatch_module *); atch_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<Dyninst::PatchAPI::PatchFunction*, typedef std::map<Dyninst::PatchAPI::PatchFunction*,
BPatch_function*> BPatch_funcMap; 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<Dyninst::PatchAPI::Point *, typedef std::map<Dyninst::PatchAPI::Point *,
BPatch_point*> BPatch_instpMap; BPatch_point*> BPatch_instpMap;
BPatch_addressSpace *addSpace; BPatch_addressSpace *addSpace;
AddressSpace *lladdSpace; AddressSpace *lladdSpace;
mapped_module *mod; mapped_module *mod;
 End of changes. 3 change blocks. 
17 lines changed or deleted 7 lines changed or added


 BPatch_process.h   BPatch_process.h 
skipping to change at line 506 skipping to change at line 506
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),
BPatch_module *, loadLibrary,(const char *libname, bool reload = false) ); BPatch_object *, loadLibrary,(const char *libname, bool reload = false) );
}; };
#endif /* BPatch_process_h_ */ #endif /* BPatch_process_h_ */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 BPatch_type.h   BPatch_type.h 
skipping to change at line 42 skipping to change at line 42
#define _BPatch_type_h_ #define _BPatch_type_h_
#include "BPatch_dll.h" #include "BPatch_dll.h"
#include "BPatch_Vector.h" #include "BPatch_Vector.h"
#include "BPatch_eventLock.h" #include "BPatch_eventLock.h"
#include <string.h> #include <string.h>
#include "Type.h" #include "Type.h"
#include "Variable.h" #include "Variable.h"
class BPatch_type;
namespace Dyninst {
namespace SymtabAPI {
class Type;
Type *convert(const BPatch_type *);
}
}
typedef enum {BPatchSymLocalVar, BPatchSymGlobalVar, BPatchSymRegisterVar, typedef enum {BPatchSymLocalVar, BPatchSymGlobalVar, BPatchSymRegisterVar,
BPatchSymStaticLocalVar, BPatchSymStaticGlobal, BPatchSymStaticLocalVar, BPatchSymStaticGlobal,
BPatchSymLocalFunc, BPatchSymGlobalFunc, BPatchSymFuncParam, BPatchSymLocalFunc, BPatchSymGlobalFunc, BPatchSymFuncParam,
BPatchSymTypeName, BPatchSymAggType, BPatchSymTypeTag}symDescr _t; BPatchSymTypeName, BPatchSymAggType, BPatchSymTypeTag}symDescr _t;
/* /*
* Symbol Descriptors: * Symbol Descriptors:
* BPatchSymLocalVar - local variable- gnu sun-(empty) * BPatchSymLocalVar - local variable- gnu sun-(empty)
* BPatchSymGlobalVar - global variable- gnu sun-'G' * BPatchSymGlobalVar - global variable- gnu sun-'G'
* BPatchSymRegisterVar - register variable- gnu sun-'r' * BPatchSymRegisterVar - register variable- gnu sun-'r'
 End of changes. 1 change blocks. 
0 lines changed or deleted 8 lines changed or added


 PCErrors.h   PCErrors.h 
skipping to change at line 37 skipping to change at line 37
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#if !defined(PCERRORS_H_) #if !defined(PCERRORS_H_)
#define PCERRORS_H_ #define PCERRORS_H_
// Only works on posix-compliant systems. IE not windows. // Only works on posix-compliant systems. IE not windows.
//#define PROCCTRL_PRINT_TIMINGS 1 //#define PROCCTRL_PRINT_TIMINGS 1
// Will really change timings
//#define PROCCTRL_LOCK_PRINTS 1
#include <stdio.h> #include <stdio.h>
#include "util.h" #include "util.h"
#define pclean_printf(format, ...) \ extern void pc_print_lock();
do { \ extern void pc_print_unlock();
if (dyninst_debug_proccontrol) \ #if defined(PROCCTRL_LOCK_PRINTS)
fprintf(pctrl_err_out, format, ## __VA_ARGS__); \ #define PC_PRINT_LOCK pc_print_lock()
#define PC_PRINT_UNLOCK pc_print_unlock()
#else
#define PC_PRINT_LOCK
#define PC_PRINT_UNLOCK
#endif
#define pclean_printf(format, ...) \
do { \
if (dyninst_debug_proccontrol) { \
PC_PRINT_LOCK; \
fprintf(pctrl_err_out, format, ## __VA_ARGS__); \
PC_PRINT_UNLOCK; \
} \
} while (0) } while (0)
#if defined(PROCCTRL_PRINT_TIMINGS) #if defined(PROCCTRL_PRINT_TIMINGS)
#define pthrd_printf(format, ...) \ #define pthrd_printf(format, ...) \
do { \ do { \
if (dyninst_debug_proccontrol) { \ if (dyninst_debug_proccontrol) { \
fprintf(pctrl_err_out, "[%s:%u-%s@%lu] - " format, __FILE__, __LINE_ PC_PRINT_LOCK; \
_, thrdName(), gettod(), ## __VA_ARGS__); \ fprintf(pctrl_err_out, "[%s:%u-%s@%lu] - " format, __FILE__, __LIN
} \ E__, \
} while (0) thrdName(), gettod(), ## __VA_ARGS__); \
PC_PRINT_UNLOCK; \
#define perr_printf(format, ...) \ } \
do { \ } while (0)
if (dyninst_debug_proccontrol) \
fprintf(pctrl_err_out, "[%s:%u-%s@%lu] - Error: " format, __FILE__, #define perr_printf(format, ...) \
__LINE__, thrdName(), gettod(), ## __VA_ARGS__); \ do { \
} while (0) if (dyninst_debug_proccontrol) { \
PC_PRINT_LOCK; \
fprintf(pctrl_err_out, "[%s:%u-%s@%lu] - Error: " format, __FILE__
, __LINE__, thrdName(), gettod(), ## __VA_ARGS__); \
PC_PRINT_UNLOCK; \
} \
} while (0)
#else #else
#define pthrd_printf(format, ...) \ #define pthrd_printf(format, ...) \
do { \ do { \
if (dyninst_debug_proccontrol) { \ if (dyninst_debug_proccontrol) { \
fprintf(pctrl_err_out, "[%s:%u-%s] - " format, __FILE__, __LINE__, t PC_PRINT_LOCK; \
hrdName(), ## __VA_ARGS__); \ fprintf(pctrl_err_out, "[%s:%u-%s] - " format, __FILE__, __LINE__,
} \ thrdName(), ## __VA_ARGS__); \
} while (0) PC_PRINT_UNLOCK; \
} \
#define perr_printf(format, ...) \ } while (0)
do { \
if (dyninst_debug_proccontrol) \ #define perr_printf(format, ...) \
fprintf(pctrl_err_out, "[%s:%u-%s] - Error: " format, __FILE__, __LI do { \
NE__, thrdName(), ## __VA_ARGS__); \ if (dyninst_debug_proccontrol) { \
} while (0) PC_PRINT_LOCK; \
fprintf(pctrl_err_out, "[%s:%u-%s] - Error: " format, __FILE__, __
LINE__, thrdName(), ## __VA_ARGS__); \
PC_PRINT_UNLOCK; \
} \
} while (0)
#endif #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(); extern unsigned long gettod();
namespace Dyninst { namespace Dyninst {
 End of changes. 4 change blocks. 
32 lines changed or deleted 59 lines changed or added


 PatchCFG.h   PatchCFG.h 
skipping to change at line 178 skipping to change at line 178
PatchObject* obj_; PatchObject* obj_;
BlockPoints points_; BlockPoints points_;
}; };
class PatchFunction { class PatchFunction {
friend class PatchEdge; friend class PatchEdge;
friend class PatchBlock; friend class PatchBlock;
friend class PatchObject; friend class PatchObject;
friend class PatchParseCallback; friend class PatchParseCallback;
friend class PatchModifier;
public: public:
struct compare { struct compare {
bool operator()(PatchBlock * const &b1, bool operator()(PatchBlock * const &b1,
PatchBlock * const &b2) const { PatchBlock * const &b2) const {
if(b1->start() < b2->start()) if(b1->start() < b2->start())
return true; return true;
else else
return false; return false;
} }
skipping to change at line 242 skipping to change at line 243
PATCHAPI_EXPORT virtual void markModified() {}; PATCHAPI_EXPORT virtual void markModified() {};
protected: protected:
// For callbacks from ParseAPI to PatchAPI // For callbacks from ParseAPI to PatchAPI
void removeBlock(PatchBlock *); void removeBlock(PatchBlock *);
void addBlock(PatchBlock *); void addBlock(PatchBlock *);
void splitBlock(PatchBlock *first, PatchBlock *second); void splitBlock(PatchBlock *first, PatchBlock *second);
void destroyPoints(); void destroyPoints();
void destroyBlockPoints(PatchBlock *block); void destroyBlockPoints(PatchBlock *block);
void invalidateBlocks();
ParseAPI::Function *func_; ParseAPI::Function *func_;
PatchObject* obj_; PatchObject* obj_;
Address addr_; Address addr_;
Blockset all_blocks_; Blockset all_blocks_;
Blockset call_blocks_; Blockset call_blocks_;
Blockset return_blocks_; Blockset return_blocks_;
Blockset exit_blocks_; Blockset exit_blocks_;
 End of changes. 2 change blocks. 
0 lines changed or deleted 2 lines changed or added


 PatchModifier.h   PatchModifier.h 
skipping to change at line 93 skipping to change at line 93
PATCHAPI_EXPORT static bool remove(std::vector<PatchBlock *> &blocks, bo ol force = false); PATCHAPI_EXPORT static bool remove(std::vector<PatchBlock *> &blocks, bo ol force = false);
// As the above, but for functions. // As the above, but for functions.
PATCHAPI_EXPORT static bool remove(PatchFunction *); PATCHAPI_EXPORT static bool remove(PatchFunction *);
PATCHAPI_EXPORT static InsertedCode::Ptr insert(PatchObject *, SnippetPt r snip, Point *point); PATCHAPI_EXPORT static InsertedCode::Ptr insert(PatchObject *, SnippetPt r snip, Point *point);
PATCHAPI_EXPORT static InsertedCode::Ptr insert(PatchObject *, void *sta rt, unsigned size); PATCHAPI_EXPORT static InsertedCode::Ptr insert(PatchObject *, void *sta rt, unsigned size);
private: private:
static InsertedCode::Ptr insert(PatchObject *, void *start, unsigned siz e, Address base); static InsertedCode::Ptr insert(PatchObject *, void *start, unsigned siz e, Address base);
}; };
}; };
}; };
#endif #endif
 End of changes. 1 change blocks. 
1 lines changed or deleted 0 lines changed or added


 Symtab.h   Symtab.h 
skipping to change at line 55 skipping to change at line 55
#include "boost/shared_ptr.hpp" #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 Dwarf {
class DwarfFrameParser;
typedef boost::shared_ptr<DwarfFrameParser> DwarfFrameParserPtr;
}
namespace SymtabAPI { namespace SymtabAPI {
class Archive; class Archive;
class builtInTypeCollection; class builtInTypeCollection;
class ExceptionBlock; class ExceptionBlock;
class Object; class Object;
class localVar; class localVar;
class relocationEntry; class relocationEntry;
class Type; class Type;
skipping to change at line 93 skipping to change at line 88
friend class Region; friend class Region;
friend class emitElf; friend class emitElf;
friend class emitElf64; friend class emitElf64;
friend class emitElfStatic; friend class emitElfStatic;
friend class emitWin; friend class emitWin;
friend class Aggregate; friend class Aggregate;
friend class relocationEntry; friend class relocationEntry;
public: public:
/**** DEBUG *****/
Dwarf::DwarfFrameParserPtr debugDwarf();
/***** 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(unsigned char *mem_image, size_t image_size, SYMTAB_EXPORT Symtab(unsigned char *mem_image, size_t image_size,
const std::string &name, bool defensive_binary, boo l &err); const std::string &name, bool defensive_binary, boo l &err);
 End of changes. 2 change blocks. 
8 lines changed or deleted 0 lines changed or added


 util.h   util.h 
skipping to change at line 165 skipping to change at line 165
#define THROW #define THROW
#else #else
#define THROW_SPEC(x) throw (x) #define THROW_SPEC(x) throw (x)
#define THROW throw () #define THROW throw ()
#endif #endif
#endif #endif
#ifndef __UTIL_H__ #ifndef __UTIL_H__
#define __UTIL_H__ #define __UTIL_H__
#include <string>
#include "dyntypes.h" #include "dyntypes.h"
namespace Dyninst { namespace Dyninst {
COMMON_EXPORT unsigned addrHashCommon(const Address &addr); COMMON_EXPORT unsigned addrHashCommon(const Address &addr);
COMMON_EXPORT unsigned ptrHash(const void * addr); COMMON_EXPORT unsigned ptrHash(const void * addr);
COMMON_EXPORT unsigned ptrHash(void * addr); COMMON_EXPORT unsigned ptrHash(void * addr);
COMMON_EXPORT unsigned addrHash(const Address &addr); COMMON_EXPORT unsigned addrHash(const Address &addr);
COMMON_EXPORT unsigned addrHash4(const Address &addr); COMMON_EXPORT unsigned addrHash4(const Address &addr);
COMMON_EXPORT unsigned addrHash16(const Address &addr); COMMON_EXPORT unsigned addrHash16(const Address &addr);
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/