Deleted Added
sdiff udiff text old ( 8229:78bf55f23338 ) new ( 8271:1d3733d3acee )
full compact
1/*
2 * Copyright (c) 2010 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 42 unchanged lines hidden (view full) ---

51#include "arch/arm/tracechild.hh"
52
53using namespace std;
54
55ARMTraceChild::ARMTraceChild()
56{
57 foundMvn = false;
58
59 for (int x = 0; x < numregs; x++) {
60 memset(&regs, 0, sizeof(regs));
61 memset(&oldregs, 0, sizeof(regs));
62 regDiffSinceUpdate[x] = false;
63 }
64}
65
66bool
67ARMTraceChild::sendState(int socket)
68{
69 uint32_t regVal = 0;
70 uint32_t message[numregs + 1];
71 int pos = 1;
72 message[0] = 0;
73 for (int x = 0; x < numregs; x++) {
74 if (regDiffSinceUpdate[x]) {
75 message[0] = message[0] | (1 << x);
76 message[pos++] = getRegVal(x);
77 }
78 }
79
80 size_t sent = 0;
81 size_t toSend = pos * sizeof(message[0]);
82 uint8_t *messagePtr = (uint8_t *)message;
83 while (toSend != 0) {

--- 8 unchanged lines hidden (view full) ---

92 }
93
94 return true;
95}
96
97uint32_t
98ARMTraceChild::getRegs(user_regs &myregs, int num)
99{
100 assert(num < numregs && num >= 0);
101 return myregs.uregs[num];
102}
103
104bool
105ARMTraceChild::update(int pid)
106{
107 oldregs = regs;
108 if (ptrace(PTRACE_GETREGS, pid, 0, &regs) != 0) {
109 cerr << "update: " << strerror(errno) << endl;
110 return false;
111 }
112
113 for (unsigned int x = 0; x < numregs; x++)
114 regDiffSinceUpdate[x] = (getRegVal(x) != getOldRegVal(x));
115 return true;
116}
117
118int64_t
119ARMTraceChild::getRegVal(int num)
120{
121 return getRegs(regs, num);
122}
123
124int64_t
125ARMTraceChild::getOldRegVal(int num)
126{
127 return getRegs(oldregs, num);
128}
129
130ostream &
131ARMTraceChild::outputStartState(ostream & os)
132{
133 uint32_t sp = getSP();
134 uint32_t pc = getPC();
135 uint32_t highestInfo = 0;

--- 120 unchanged lines hidden ---