Skip to content

Commit

Permalink
Merge branch 'master' into att_syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
John Detter committed Dec 2, 2016
2 parents eea25e4 + 0f8e88c commit fadf29c
Show file tree
Hide file tree
Showing 23 changed files with 192 additions and 166 deletions.
2 changes: 1 addition & 1 deletion cmake/shared.cmake
Expand Up @@ -3,7 +3,7 @@ set (DYNINST_MINOR_VERSION 2)
set (DYNINST_PATCH_VERSION 0)

# Debugging
set(Boost_DEBUG 1)
# set(Boost_DEBUG 1)

add_definitions(-DBOOST_ALL_NO_LIB=1)
set (SOVERSION "${DYNINST_MAJOR_VERSION}.${DYNINST_MINOR_VERSION}")
Expand Down
2 changes: 1 addition & 1 deletion cmake/warnings.cmake
Expand Up @@ -4,7 +4,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -Wpointer-arith -Wcast-qual -Wo
if (CMAKE_C_COMPILER_ID MATCHES GNU)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wcast-align")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wcast-align -Wno-non-template-friend -Wno-unused-local-typedefs -Wno-deprecated-declarations")
endif (CMAKE_C_COMPILER_ID)
endif (CMAKE_C_COMPILER_ID MATCHES GNU)
elseif (MSVC)
message(STATUS "TODO: Set up custom warning flags for MSVC")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4251 /wd4091 /wd4503")
Expand Down
12 changes: 8 additions & 4 deletions common/src/linuxKludges.C
Expand Up @@ -286,9 +286,11 @@ bool PtraceBulkRead(Address inTraced, unsigned size, void *inSelf, int pid)
if (ret == -1) {
if (errno == ENOSYS) {
have_process_vm_readv = false;
} else if (errno == EFAULT) {
} else if (errno == EFAULT || errno == EPERM) {
/* Could be a no-read page -- ptrace may be allowed to
* peek anyway, so fallthrough and let ptrace try. */
* peek anyway, so fallthrough and let ptrace try.
* It may also be denied by kernel.yama.ptrace_scope=1 if we're
* no longer a direct ancestor thanks to pid re-parenting. */
} else {
return false;
}
Expand Down Expand Up @@ -377,9 +379,11 @@ bool PtraceBulkWrite(Dyninst::Address inTraced, unsigned nbytes,
if (ret == -1) {
if (errno == ENOSYS) {
have_process_vm_writev = false;
} else if (errno == EFAULT) {
} else if (errno == EFAULT || errno == EPERM) {
/* Could be a read-only page -- ptrace may be allowed to
* poke anyway, so fallthrough and let ptrace try. */
* poke anyway, so fallthrough and let ptrace try.
* It may also be denied by kernel.yama.ptrace_scope=1 if we're
* no longer a direct ancestor thanks to pid re-parenting. */
} else {
return false;
}
Expand Down
31 changes: 23 additions & 8 deletions dataflowAPI/src/stackanalysis.C
Expand Up @@ -61,13 +61,13 @@ const StackAnalysis::Height StackAnalysis::Height::top(
StackAnalysis::Height::uninitialized, StackAnalysis::Height::TOP);

AnnotationClass<StackAnalysis::Intervals>
Stack_Anno_Intervals(std::string("Stack_Anno_Intervals"), nullptr);
Stack_Anno_Intervals(std::string("Stack_Anno_Intervals"), NULL);
AnnotationClass<StackAnalysis::BlockEffects>
Stack_Anno_Block_Effects(std::string("Stack_Anno_Block_Effects"), nullptr);
Stack_Anno_Block_Effects(std::string("Stack_Anno_Block_Effects"), NULL);
AnnotationClass<StackAnalysis::InstructionEffects>
Stack_Anno_Insn_Effects(std::string("Stack_Anno_Insn_Effects"), nullptr);
Stack_Anno_Insn_Effects(std::string("Stack_Anno_Insn_Effects"), NULL);
AnnotationClass<StackAnalysis::CallEffects>
Stack_Anno_Call_Effects(std::string("Stack_Anno_Call_Effects"), nullptr);
Stack_Anno_Call_Effects(std::string("Stack_Anno_Call_Effects"), NULL);

template class std::list<Dyninst::StackAnalysis::TransferFunc*>;
template class std::map<Dyninst::Absloc, Dyninst::StackAnalysis::Height>;
Expand Down Expand Up @@ -186,6 +186,15 @@ void add_target(std::queue<Block*>& worklist, Edge* e) {
worklist.push(e->trg());
}

void add_target_list_exclude(std::queue<Block *> &worklist,
std::set<Block *> &excludeSet, Edge *e) {
Block *b = e->trg();
if (excludeSet.find(b) == excludeSet.end()) {
excludeSet.insert(b);
worklist.push(b);
}
}

void add_target_exclude(std::stack<Block *> &workstack,
std::set<Block *> &excludeSet, Edge *e) {
Block *b = e->trg();
Expand All @@ -195,7 +204,6 @@ void add_target_exclude(std::stack<Block *> &workstack,
}
}


// We want to create a transfer function for the block as a whole. This will
// allow us to perform our fixpoint calculation over blocks (thus, O(B^2))
// rather than instructions (thus, O(I^2)).
Expand Down Expand Up @@ -258,13 +266,17 @@ void StackAnalysis::summarizeBlocks(bool verbose) {

void StackAnalysis::fixpoint(bool verbose) {
intra_nosink_nocatch epred2;
std::set<Block *> touchedSet;
std::set<Block *> workSet;
std::queue<Block *> worklist;
workSet.insert(func->entry());
worklist.push(func->entry());

bool firstBlock = true;
while (!worklist.empty()) {
Block *block = worklist.front();
worklist.pop();
workSet.erase(block);

if (verbose) {
stackanalysis_printf("\t Fixpoint analysis: visiting block at 0x%lx\n",
Expand All @@ -291,8 +303,9 @@ void StackAnalysis::fixpoint(bool verbose) {
stackanalysis_printf("\t New in meet: %s\n", format(input).c_str());
}

// Step 2: see if the input has changed
if (input == blockInputs[block]) {
// Step 2: see if the input has changed. Analyze each block at least once
if (input == blockInputs[block] &&
touchedSet.find(block) != touchedSet.end()) {
// No new work here
if (verbose) {
stackanalysis_printf("\t ... equal to current, skipping block\n");
Expand All @@ -319,10 +332,12 @@ void StackAnalysis::fixpoint(bool verbose) {
std::for_each(
boost::make_filter_iterator(epred2, outEdges.begin(), outEdges.end()),
boost::make_filter_iterator(epred2, outEdges.end(), outEdges.end()),
boost::bind(add_target, boost::ref(worklist), _1)
boost::bind(add_target_list_exclude, boost::ref(worklist),
boost::ref(workSet), _1)
);

firstBlock = false;
touchedSet.insert(block);
}
}

Expand Down

0 comments on commit fadf29c

Please sign in to comment.