inst_pb_trace.cc (11153:20bbfe5b2b86) inst_pb_trace.cc (12615:ccdc49c36ad3)
1/*
2 * Copyright (c) 2014 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

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

64 }
65
66 // If this instruction accessed memory lets record it
67 if (getMemValid())
68 tracer.traceMem(staticInst, getAddr(), getSize(), getFlags());
69}
70
71InstPBTrace::InstPBTrace(const InstPBTraceParams *p)
1/*
2 * Copyright (c) 2014 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

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

64 }
65
66 // If this instruction accessed memory lets record it
67 if (getMemValid())
68 tracer.traceMem(staticInst, getAddr(), getSize(), getFlags());
69}
70
71InstPBTrace::InstPBTrace(const InstPBTraceParams *p)
72 : InstTracer(p), curMsg(nullptr)
72 : InstTracer(p), buf(nullptr), bufSize(0), curMsg(nullptr)
73{
74 // Create our output file
75 createTraceFile(p->file_name);
76}
77
78void
79InstPBTrace::createTraceFile(std::string filename)
80{

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

136{
137 if (curMsg) {
138 /// @todo if we are running multi-threaded I assume we'd need a lock here
139 traceStream->write(*curMsg);
140 delete curMsg;
141 curMsg = NULL;
142 }
143
73{
74 // Create our output file
75 createTraceFile(p->file_name);
76}
77
78void
79InstPBTrace::createTraceFile(std::string filename)
80{

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

136{
137 if (curMsg) {
138 /// @todo if we are running multi-threaded I assume we'd need a lock here
139 traceStream->write(*curMsg);
140 delete curMsg;
141 curMsg = NULL;
142 }
143
144 size_t instSize = si->asBytes(buf.get(), bufSize);
145 if (instSize > bufSize) {
146 bufSize = instSize;
147 buf.reset(new uint8_t[bufSize]);
148 instSize = si->asBytes(buf.get(), bufSize);
149 }
150
144 // Create a new instruction message and fill out the fields
145 curMsg = new ProtoMessage::Inst;
146 curMsg->set_pc(pc.pc());
151 // Create a new instruction message and fill out the fields
152 curMsg = new ProtoMessage::Inst;
153 curMsg->set_pc(pc.pc());
147 curMsg->set_inst(static_cast<uint32_t>(bits(si->machInst, 31, 0)));
154 if (instSize == sizeof(uint32_t)) {
155 curMsg->set_inst(letoh(*reinterpret_cast<uint32_t *>(buf.get())));
156 } else if (instSize) {
157 curMsg->set_inst_bytes(
158 std::string(reinterpret_cast<const char *>(buf.get()), bufSize));
159 }
148 curMsg->set_cpuid(tc->cpuId());
149 curMsg->set_tick(curTick());
150 curMsg->set_type(static_cast<ProtoMessage::Inst_InstType>(si->opClass()));
151 curMsg->set_inst_flags(bits(si->machInst, 7, 0));
152
153}
154
155void

--- 23 unchanged lines hidden ---
160 curMsg->set_cpuid(tc->cpuId());
161 curMsg->set_tick(curTick());
162 curMsg->set_type(static_cast<ProtoMessage::Inst_InstType>(si->opClass()));
163 curMsg->set_inst_flags(bits(si->machInst, 7, 0));
164
165}
166
167void

--- 23 unchanged lines hidden ---