summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mem/probes/MemTraceProbe.py3
-rw-r--r--src/mem/probes/mem_trace.cc5
-rw-r--r--src/mem/probes/mem_trace.hh5
-rw-r--r--src/sim/probe/mem.hh4
4 files changed, 15 insertions, 2 deletions
diff --git a/src/mem/probes/MemTraceProbe.py b/src/mem/probes/MemTraceProbe.py
index 971765eb4..c51ec9282 100644
--- a/src/mem/probes/MemTraceProbe.py
+++ b/src/mem/probes/MemTraceProbe.py
@@ -46,6 +46,9 @@ class MemTraceProbe(BaseMemProbe):
# Boolean to compress the trace or not.
trace_compress = Param.Bool(True, "Enable trace compression")
+ # For requests with a valid PC, include the PC in the trace
+ with_pc = Param.Bool(False, "Include PC info in the trace")
+
# packet trace output file, disabled by default
trace_file = Param.String("", "Packet trace output file")
diff --git a/src/mem/probes/mem_trace.cc b/src/mem/probes/mem_trace.cc
index 121c6de48..97b97daae 100644
--- a/src/mem/probes/mem_trace.cc
+++ b/src/mem/probes/mem_trace.cc
@@ -47,7 +47,8 @@
MemTraceProbe::MemTraceProbe(MemTraceProbeParams *p)
: BaseMemProbe(p),
- traceStream(nullptr)
+ traceStream(nullptr),
+ withPC(p->with_pc)
{
std::string filename;
if (p->trace_file != "") {
@@ -102,6 +103,8 @@ MemTraceProbe::handleRequest(const ProbePoints::PacketInfo &pkt_info)
pkt_msg.set_flags(pkt_info.flags);
pkt_msg.set_addr(pkt_info.addr);
pkt_msg.set_size(pkt_info.size);
+ if (withPC && pkt_info.pc != 0)
+ pkt_msg.set_pc(pkt_info.pc);
traceStream->write(pkt_msg);
}
diff --git a/src/mem/probes/mem_trace.hh b/src/mem/probes/mem_trace.hh
index d34235eef..158c5aacb 100644
--- a/src/mem/probes/mem_trace.hh
+++ b/src/mem/probes/mem_trace.hh
@@ -64,6 +64,11 @@ class MemTraceProbe : public BaseMemProbe
/** Trace output stream */
ProtoOutputStream *traceStream;
+
+ private:
+
+ /** Include the Program Counter in the memory trace */
+ const bool withPC;
};
#endif //__MEM_PROBES_MEM_TRACE_HH__
diff --git a/src/sim/probe/mem.hh b/src/sim/probe/mem.hh
index 2d4b9aeec..f17815bab 100644
--- a/src/sim/probe/mem.hh
+++ b/src/sim/probe/mem.hh
@@ -56,12 +56,14 @@ struct PacketInfo {
Addr addr;
uint32_t size;
Request::FlagsType flags;
+ Addr pc;
explicit PacketInfo(const PacketPtr& pkt) :
cmd(pkt->cmd),
addr(pkt->getAddr()),
size(pkt->getSize()),
- flags(pkt->req->getFlags()) { }
+ flags(pkt->req->getFlags()),
+ pc(pkt->req->hasPC() ? pkt->req->getPC() : 0) { }
};
/**