Skip to content

Commit

Permalink
Merge pull request #341 from dyninst/v9.3.x
Browse files Browse the repository at this point in the history
v9.3.x
  • Loading branch information
wrwilliams committed Mar 2, 2017
2 parents 86d44d2 + 3cddbd2 commit aa58c29
Show file tree
Hide file tree
Showing 27 changed files with 290 additions and 265 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sudo: false
env:
global:
- LLVM_VERSION=3.7.0
- LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH
- LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH

addons:
apt:
Expand All @@ -18,6 +18,8 @@ addons:
- libboost-system1.55-dev
- libboost-thread1.55-dev
- cmake
- elfutils
- libelf1
- libelf-dev
- g++-4.9

Expand All @@ -38,6 +40,7 @@ before_install:
script:
- if [ "$CC" == "clang" ]; then export CC=$HOME/llvm-$LLVM_VERSION/bin/clang; export CXX=$HOME/llvm-$LLVM_VERSION/bin/clang++; fi
- if [ "$CC" == "gcc" ]; then export CC=gcc-4.9; export CXX=g++-4.9; fi
- find /usr -name 'libelf.*'
- mkdir work
- cd work
- cmake ..
Expand Down
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Change Log

## [v9.3.1](https://github.com/dyninst/dyninst/releases/v9.3.1) (2017-03-02)
[Full Changelog](https://github.com/dyninst/dyninst/compare/v9.3.0...v9.3.1)

**Fixed bugs:**

- Abort on PPC64LE when trying to get line number info [\#337](https://github.com/dyninst/dyninst/issues/337)
- Seg Fault on PPC64LE during attach [\#336](https://github.com/dyninst/dyninst/issues/336)
- Memory leaks in indirect control flow analysis [\#322](https://github.com/dyninst/dyninst/issues/322)
- BPatch\_binaryEdit::writeFile\(\) fails for stack diversification [\#311](https://github.com/dyninst/dyninst/issues/311)
- Stackwalk issue on arm64 [\#303](https://github.com/dyninst/dyninst/issues/303)
- Decode returns null shared pointer [\#288](https://github.com/dyninst/dyninst/issues/288)
- Operands labelled "\[empty\]" with operand type mismatch \(all with 0x67 prefix\) [\#203](https://github.com/dyninst/dyninst/issues/203)

**Merged pull requests:**

- Replaced a bunch of asserts with graceful error handling. [\#340](https://github.com/dyninst/dyninst/pull/340) ([wrwilliams](https://github.com/wrwilliams))
- Fix jump table analysis for lulesh [\#338](https://github.com/dyninst/dyninst/pull/338) ([mxz297](https://github.com/mxz297))
- Better handling of anonymous structs and unions [\#335](https://github.com/dyninst/dyninst/pull/335) ([wrwilliams](https://github.com/wrwilliams))
- Fix memory leaks found with lsan [\#333](https://github.com/dyninst/dyninst/pull/333) ([wrwilliams](https://github.com/wrwilliams))
- Suppress debug message when no vsyscall page was found on arm64 [\#332](https://github.com/dyninst/dyninst/pull/332) ([wrwilliams](https://github.com/wrwilliams))
- Use ifdef to guard x86 code [\#331](https://github.com/dyninst/dyninst/pull/331) ([wrwilliams](https://github.com/wrwilliams))
- Fix memory leaks in indirect control flow. [\#329](https://github.com/dyninst/dyninst/pull/329) ([wrwilliams](https://github.com/wrwilliams))
- Fixes for API and dependency issues in 9.3.0 [\#323](https://github.com/dyninst/dyninst/pull/323) ([wrwilliams](https://github.com/wrwilliams))



\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
2 changes: 1 addition & 1 deletion cmake/Modules/FindLibElf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ find_path (LIBELF_INCLUDE_DIR

find_library (LIBELF_LIBRARIES
NAMES
elf
libelf.so.1
HINTS
${LIBELF_LIBRARIES}
PATHS
Expand Down
4 changes: 2 additions & 2 deletions cmake/packages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ if (UNIX)
PREFIX ${CMAKE_BINARY_DIR}/libelf
URL https://sourceware.org/elfutils/ftp/0.168/elfutils-0.168.tar.bz2
CONFIGURE_COMMAND <SOURCE_DIR>/configure --enable-shared --prefix=${CMAKE_BINARY_DIR}/libelf
BUILD_COMMAND make
INSTALL_COMMAND make install
BUILD_COMMAND make -C libelf
INSTALL_COMMAND make -C libelf install
)
set(LIBELF_INCLUDE_DIR ${CMAKE_BINARY_DIR}/libelf/include)
set(LIBELF_LIBRARIES ${CMAKE_BINARY_DIR}/libelf/lib/libelf.so)
Expand Down
2 changes: 1 addition & 1 deletion cmake/shared.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set (DYNINST_MAJOR_VERSION 9)
set (DYNINST_MINOR_VERSION 3)
set (DYNINST_PATCH_VERSION 0)
set (DYNINST_PATCH_VERSION 1)

# Debugging
# set(Boost_DEBUG 1)
Expand Down
60 changes: 3 additions & 57 deletions common/h/IBSTree-fast.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,60 +85,6 @@ namespace Dyninst
struct by_high{};

};
template <typename Value>
struct IntervalLookupTraits
{
typedef typename Value::range_type RangeType;
typedef typename Dyninst::Interval<RangeType> IntervalType;
typedef boost::multi_index::composite_key<Value,
boost::multi_index::member<IntervalType, RangeType, &Value::first>,
boost::multi_index::member<IntervalType, RangeType, &Value::second> > low_key;
typedef boost::multi_index::composite_key<Value,
boost::multi_index::member<IntervalType, RangeType, &Value::second>,
boost::multi_index::member<IntervalType, RangeType, &Value::first> > high_key;
typedef typename boost::multi_index_container
<
typename Value::Ptr, boost::multi_index::indexed_by<
boost::multi_index::ordered_unique<boost::multi_index::tag<typename Value::by_low>, low_key>,
boost::multi_index::ordered_non_unique<boost::multi_index::tag<typename Value::by_high>, high_key> >
> type;
typedef typename type::value_type value_type;
};
template <typename Value>
struct IntervalLookup : public IntervalLookupTraits<Value>::type
{
typedef IntervalLookupTraits<Value> traits;
typedef typename traits::type parent;
typedef typename traits::RangeType RangeType;


typedef typename parent::template index<typename Value::by_low>::type low_index;
typedef typename parent::template index<typename Value::by_high>::type high_index;
typedef typename low_index::const_iterator const_iterator;
typedef typename high_index::const_iterator const_iterator_by_high;

// First interval overlapping with v
template <typename T>
const_iterator find(const T& t) const {
auto lower = parent::template get<typename Value::by_high>().lower_bound(t);
auto upper = parent::template get<typename Value::by_high>().upper_bound(t);
while(lower != upper && lower != parent::end())
{
if(lower == t) return lower;
++lower;
}
}


template <typename T, typename OI>
void copy_equal_range(const T& t, OI iter) const {
auto lower = parent::template get<typename Value::by_high>().lower_bound(t);
auto upper = parent::template get<typename Value::by_high>().upper_bound(t);
parent candidates_by_high(lower, upper);
auto rng = candidates_by_high.equal_range(t);
std::copy(rng.first, rng.second, iter);
}
};

template <typename ITYPE >
class IBSTree_fast
Expand Down Expand Up @@ -202,7 +148,7 @@ namespace Dyninst
unique_intervals.upper_bound(entry->low());
// lower.high first >= entry.low
if(lower != unique_intervals.end() && (**lower == *entry)) return;
auto upper = lower;
typename interval_set::iterator upper = lower;
while(upper != unique_intervals.end() &&
(*upper)->low() <= entry->high())
{
Expand All @@ -223,7 +169,7 @@ namespace Dyninst
void IBSTree_fast<ITYPE>::remove(ITYPE* entry)
{
overlapping_intervals.remove(entry);
auto found = unique_intervals.find(entry->high());
typename interval_set::iterator found = unique_intervals.find(entry->high());
if(found != unique_intervals.end() && *found == entry) unique_intervals.erase(found);
}
template<class ITYPE>
Expand All @@ -249,7 +195,7 @@ namespace Dyninst
int num_overlapping = overlapping_intervals.find(I, results);
if(num_overlapping) return num_overlapping;
typename interval_set::const_iterator lb = unique_intervals.upper_bound(I->low());
auto ub = lb;
typename interval_set::iterator ub = lb;
while(ub != unique_intervals.end() && (*ub)->low() < I->high())
{
results.insert(*ub);
Expand Down
2 changes: 2 additions & 0 deletions common/src/addrtranslate-sysv.C
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ Address AddressTranslateSysV::getTrapAddrFromRdebug() {
return 0;
}
if( !r_debug_native->is_valid() ) {
delete r_debug_native;
return 0;
}
retVal = (Address) r_debug_native->r_brk();
Expand All @@ -661,6 +662,7 @@ Address AddressTranslateSysV::getTrapAddrFromRdebug() {
return 0;
}
if( !r_debug_32->is_valid() ) {
delete r_debug_32;
return 0;
}
retVal = (Address) r_debug_32->r_brk();
Expand Down
39 changes: 39 additions & 0 deletions dataflowAPI/src/RegisterMap.C
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,45 @@ RegisterMap &machRegIndex_ppc_64() {
return mrmap;
}

RegisterMap &machRegIndex_aarch64() {
static RegisterMap mrmap;
if (mrmap.empty()) {
mrmap = {
{aarch64::x0, 0},
{aarch64::x1, 1},
{aarch64::x2, 2},
{aarch64::x3, 3},
{aarch64::x4, 4},
{aarch64::x5, 5},
{aarch64::x6, 6},
{aarch64::x7, 7},
{aarch64::x8, 8},
{aarch64::x9, 9},
{aarch64::x10, 10},
{aarch64::x11, 11},
{aarch64::x12, 12},
{aarch64::x13, 13},
{aarch64::x14, 14},
{aarch64::x15, 15},
{aarch64::x16, 16},
{aarch64::x17, 17},
{aarch64::x18, 18},
{aarch64::x19, 19},
{aarch64::x20, 20},
{aarch64::x21, 21},
{aarch64::x22, 22},
{aarch64::x23, 23},
{aarch64::x24, 24},
{aarch64::x25, 25},
{aarch64::x26, 26},
{aarch64::x27, 27},
{aarch64::x28, 28},
{aarch64::x29, 29},
{aarch64::x30, 30} };
}
return mrmap;
}

#else
// This fails on VS 2015... but not VS 2010...
RegisterMap &machRegIndex_x86() {
Expand Down
4 changes: 4 additions & 0 deletions dataflowAPI/src/liveness.C
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ ReadWriteInfo LivenessAnalyzer::calcRWSets(Instruction::Ptr curInsn, Block* blk,
if (cur.getArchitecture() == Arch_ppc64)
cur = MachRegister((cur.val() & ~Arch_ppc64) | Arch_ppc32);
liveness_printf("\t%s \n", cur.name().c_str());
#if defined(x86_64) || defined(x86)
MachRegister base = cur.getBaseRegister();
if (cur == x86::flags || cur == x86_64::flags){
if (width == 4){
Expand Down Expand Up @@ -476,6 +477,7 @@ ReadWriteInfo LivenessAnalyzer::calcRWSets(Instruction::Ptr curInsn, Block* blk,
assert(index >= 0);
ret.read[index] = true;
}
#endif
}
liveness_printf("Write Registers: \n");
for (std::set<RegisterAST::Ptr>::const_iterator i = cur_written.begin();
Expand All @@ -484,6 +486,7 @@ ReadWriteInfo LivenessAnalyzer::calcRWSets(Instruction::Ptr curInsn, Block* blk,
if (cur.getArchitecture() == Arch_ppc64)
cur = MachRegister((cur.val() & ~Arch_ppc64) | Arch_ppc32);
liveness_printf("\t%s \n", cur.name().c_str());
#if defined(x86_64) || defined(x86)
MachRegister base = cur.getBaseRegister();
if (cur == x86::flags || cur == x86_64::flags){
if (width == 4){
Expand Down Expand Up @@ -516,6 +519,7 @@ ReadWriteInfo LivenessAnalyzer::calcRWSets(Instruction::Ptr curInsn, Block* blk,
ret.written[index] = true;
if ((cur != base && cur.size() < 4) || isMMX(base)) ret.read[index] = true;
}
#endif
}
InsnCategory category = curInsn->getCategory();
switch(category)
Expand Down
1 change: 1 addition & 0 deletions dyninstAPI/h/BPatch_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ class BPATCH_DLL_EXPORT BPatch_type{

// INTERNAL DATA MEMBERS

bool owns_typ;
unsigned int refCount;

protected:
Expand Down
15 changes: 11 additions & 4 deletions dyninstAPI/src/BPatch.C
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,20 @@ BPatch::BPatch()

stdTypes = BPatch_typeCollection::getGlobalTypeCollection();
vector<Type *> *sTypes = Symtab::getAllstdTypes();
for(unsigned i=0; i< sTypes->size(); i++)
stdTypes->addType(new BPatch_type((*sTypes)[i]));
BPatch_type* type = NULL;
for(const auto& t: *sTypes) {
stdTypes->addType(type = new BPatch_type(t));
type->decrRefCount();
}
delete sTypes;

builtInTypes = new BPatch_builtInTypeCollection;
sTypes = Symtab::getAllbuiltInTypes();
for(unsigned i=0; i< sTypes->size(); i++)
builtInTypes->addBuiltInType(new BPatch_type((*sTypes)[i]));
for(const auto& t: *sTypes) {
builtInTypes->addBuiltInType(type = new BPatch_type(t));
type->decrRefCount();
}
delete sTypes;

//loadNativeDemangler();

Expand Down
8 changes: 8 additions & 0 deletions dyninstAPI/src/BPatch_collections.C
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,14 @@ BPatch_typeCollection::~BPatch_typeCollection()
// decRefCount (which will delete when refcount == 0)
assert(refcount == 0 ||
refcount == 1);

for(const auto& t: typesByName) {
t.second->decrRefCount();
}

for(const auto& t: typesByID) {
t.second->decrRefCount();
}
}

/*
Expand Down
11 changes: 7 additions & 4 deletions dyninstAPI/src/BPatch_type.C
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ BPatch_type *BPatch_type::createFake(const char *_name) {
*
*/

BPatch_type::BPatch_type(Type *typ_): ID(typ_->getID()), typ(typ_),
BPatch_type::BPatch_type(Type *typ_): ID(typ_->getID()), typ(typ_), owns_typ(false),
refCount(1)
{
// if a derived type, make sure the upPtr is set for the base type.
Expand All @@ -98,10 +98,10 @@ BPatch_type::BPatch_type(Type *typ_): ID(typ_->getID()), typ(typ_),
{
//fprintf(stderr, "%s[%d]: failed to get up ptr here\n", FILE__, __LINE__);

BPatch_type* dyninstType = new BPatch_type(base);
//BPatch_type* dyninstType = new BPatch_type(base);
// We might consider registering this new type in BPatch.
// For now, just silence the warning:
(void) dyninstType;
//(void) dyninstType;
}
else
{
Expand All @@ -117,7 +117,7 @@ BPatch_type::BPatch_type(Type *typ_): ID(typ_->getID()), typ(typ_),
}

BPatch_type::BPatch_type(const char *_name, int _ID, BPatch_dataClass _type) :
ID(_ID), type_(_type), typ(NULL), refCount(1)
ID(_ID), type_(_type), typ(NULL), owns_typ(true), refCount(1)
{
if (_name != NULL)
typ = new Type(_name, ID, convertToSymtabType(_type));
Expand Down Expand Up @@ -147,6 +147,9 @@ BPatch_type *BPatch_type::findOrCreateType(Dyninst::SymtabAPI::Type *type)
*/
BPatch_type::~BPatch_type()
{
if(owns_typ) {
typ->decrRefCount();
}
}

bool BPatch_type::operator==(const BPatch_type &otype) const
Expand Down
2 changes: 2 additions & 0 deletions dyninstAPI/src/codegen.C
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,8 @@ void codeGen::beginTrackRegDefs()
regsDefined_ = bitArray(REGNUM_IGNORED+1);
#elif defined(arch_power)
regsDefined_ = bitArray(registerSpace::lastReg);
#elif defined(arch_aarch64)
regsDefined_ = bitArray(registerSpace::fpsr);
#else
regsDefined_ = bitArray();
#endif
Expand Down
2 changes: 2 additions & 0 deletions dyninstAPI/src/image.C
Original file line number Diff line number Diff line change
Expand Up @@ -1910,6 +1910,7 @@ const pdvector <image_variable *> *image::findVarVectorByPretty(const std::strin

if (!symVar->getAnnotation(imv, ImageVariableUpPtrAnno)) {
fprintf(stderr, "%s[%d]: failed to getAnnotations here\n", FILE__, __LINE__);
delete res;
return NULL;
}

Expand Down Expand Up @@ -1942,6 +1943,7 @@ const pdvector <image_variable *> *image::findVarVectorByMangled(const std::stri

if (!symVar->getAnnotation(imv, ImageVariableUpPtrAnno)) {
fprintf(stderr, "%s[%d]: failed to getAnnotations here\n", FILE__, __LINE__);
delete res;
return NULL;
}

Expand Down

0 comments on commit aa58c29

Please sign in to comment.