summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/statetrace/arch/tracechild_arm.cc29
-rw-r--r--util/statetrace/tracechild.cc5
2 files changed, 22 insertions, 12 deletions
diff --git a/util/statetrace/arch/tracechild_arm.cc b/util/statetrace/arch/tracechild_arm.cc
index fc2eb3e24..4687b46f0 100644
--- a/util/statetrace/arch/tracechild_arm.cc
+++ b/util/statetrace/arch/tracechild_arm.cc
@@ -46,23 +46,38 @@ const char* ARMTraceChild::regNames[numregs] = {
ARMTraceChild::ARMTraceChild()
{
- for (int x = 0; x < numregs; x++)
+ for (int x = 0; x < numregs; x++) {
+ memset(&regs, 0, sizeof(regs));
+ memset(&oldregs, 0, sizeof(regs));
regDiffSinceUpdate[x] = false;
+ }
}
bool ARMTraceChild::sendState(int socket)
{
uint32_t regVal = 0;
- for(int x = 0; x < numregs; x++)
- {
- regVal = getRegVal(x);
- if(write(socket, &regVal, sizeof(regVal)) == -1)
- {
+ uint32_t message[numregs + 1];
+ int pos = 1;
+ message[0] = 0;
+ for (int x = 0; x < numregs; x++) {
+ if (regDiffSinceUpdate[x]) {
+ message[0] = message[0] | (1 << x);
+ message[pos++] = getRegVal(x);
+ }
+ }
+
+ size_t sent = 0;
+ size_t toSend = pos * sizeof(message[0]);
+ uint8_t *messagePtr = (uint8_t *)message;
+ while (toSend != 0) {
+ sent = write(socket, messagePtr, toSend);
+ if (sent == -1) {
cerr << "Write failed! " << strerror(errno) << endl;
tracing = false;
return false;
}
-
+ toSend -= sent;
+ messagePtr += sent;
}
return true;
diff --git a/util/statetrace/tracechild.cc b/util/statetrace/tracechild.cc
index 52e19a0e9..85f42addd 100644
--- a/util/statetrace/tracechild.cc
+++ b/util/statetrace/tracechild.cc
@@ -79,11 +79,6 @@ bool TraceChild::startTracing(const char * pathToFile, char * const argv[])
return false;
}
tracing = true;
- if(!update(pid))
- {
- cout << "Didn't update successfully!" << endl;
- return false;
- }
return true;
}