Skip to content

Commit

Permalink
Merge branch 'PR653' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
hainest committed Oct 14, 2019
2 parents 2211007 + f65050b commit 579436b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
3 changes: 3 additions & 0 deletions dataflowAPI/src/liveness.C
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,9 @@ ReadWriteInfo LivenessAnalyzer::calcRWSets(Instruction curInsn, Block *blk, Addr
if (curInsn.getOperation().getID() == power_op_svcs) {
isSyscall = true;
}
if (curInsn.getOperation().getID() == aarch64_op_svc) {
isSyscall = true;
}
if (isInterrupt || isSyscall) {
ret.read |= (abi->getSyscallReadRegisters());
ret.written |= (abi->getSyscallWrittenRegisters());
Expand Down
6 changes: 3 additions & 3 deletions dyninstAPI/src/emit-aarch64.C
Original file line number Diff line number Diff line change
Expand Up @@ -274,17 +274,17 @@ void EmitterAARCH64::emitLoadOrigRegister(Address register_num, Register destina
registerSlot *dest = (*gen.rs())[destination];
assert(dest);

if (register_num == REG_SP) {
if (src->name == "sp") {
insnCodeGen::generateAddSubImmediate(gen, insnCodeGen::Add, 0,
TRAMP_FRAME_SIZE_64, destination, REG_SP, true);
TRAMP_FRAME_SIZE_64, REG_SP, destination, true);

return;
}

if (src->spilledState == registerSlot::unspilled)
{
// not on the stack. Directly move the value
emitMoveRegToReg((Register) register_num, destination, gen);
insnCodeGen::generateMove(gen, destination, (Register) register_num, true);
return;
}

Expand Down
9 changes: 7 additions & 2 deletions dyninstAPI_RT/src/RTthread-aarch64.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
*/

#include "dyninstAPI_RT/src/RTthread.h"

int tc_lock_lock(tc_lock_t *t) {
#include <stdbool.h>
int tc_lock_lock(tc_lock_t *t)
{
dyntid_t me = dyn_pthread_self();
bool* l = (bool*)(&(t->mutex));
while (__atomic_test_and_set(l, __ATOMIC_ACQUIRE))
if (t->tid == me) return DYNINST_DEAD_LOCK;
return 0;
}
24 changes: 19 additions & 5 deletions stackwalk/src/linuxbsd-swk.C
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,13 @@ void BottomOfStackStepperImpl::newLibraryNotification(LibAddrPair *, lib_change_
}

#if defined(arch_aarch64)
static const Dyninst::Address START_HEURISTIC_LENGTH = 0x38;
static const int heuristic_length = 2;
static const Dyninst::Address heuristic_length_array[] = {0x38, 0x4C};
static const uint8_t expectedValue = 0x97;
#else
static const Dyninst::Address START_HEURISTIC_LENGTH = 43;
static const int heuristic_length = 1;
static const Dyninst::Address heuristic_length_array[] = {43};
static const uint8_t expectedValue = 0;
#endif

void BottomOfStackStepperImpl::initialize()
Expand Down Expand Up @@ -321,9 +325,19 @@ void BottomOfStackStepperImpl::initialize()
Dyninst::Address start = aout->getSymbolOffset(start_sym)+aout_addr.second;
Dyninst::Address end = aout->getSymbolSize(start_sym) + start;
if (start == end) {
sw_printf("[%s:%u] - %s symbol has 0 length, using length of %lu\n",
FILE__, __LINE__, START_FUNC_NAME, START_HEURISTIC_LENGTH);
end = start + START_HEURISTIC_LENGTH;
sw_printf("[%s:%u] - %s symbol has 0 length, using length heuristics\n",
FILE__, __LINE__, START_FUNC_NAME);
if (heuristic_length == 1) {
end = start + heuristic_length_array[0];
} else {
for (int i = 0; i < heuristic_length; ++i) {
end = start + heuristic_length_array[i];
uint8_t byteValue;
bool result = proc->readMem(&byteValue, end - 1, 1);
if (result && byteValue != expectedValue) continue;
break;
}
}
}
sw_printf("[%s:%u] - Bottom stepper taking %lx to %lx for start\n",
FILE__, __LINE__, start, end);
Expand Down

0 comments on commit 579436b

Please sign in to comment.