diff -r eb3096e6af32 -r d7bd359183b3 src/mem/probes/mem_trace.cc --- a/src/mem/probes/mem_trace.cc Wed May 27 13:50:01 2015 +0100 +++ b/src/mem/probes/mem_trace.cc Tue Oct 20 18:50:31 2015 +0100 @@ -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 @@ 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 -r eb3096e6af32 -r d7bd359183b3 src/sim/probe/mem.hh --- a/src/sim/probe/mem.hh Wed May 27 13:50:01 2015 +0100 +++ b/src/sim/probe/mem.hh Tue Oct 20 18:50:31 2015 +0100 @@ -56,12 +56,14 @@ 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) { } }; /** diff -r eb3096e6af32 -r d7bd359183b3 util/decode_packet_trace.py --- a/util/decode_packet_trace.py Wed May 27 13:50:01 2015 +0100 +++ b/util/decode_packet_trace.py Tue Oct 20 18:50:31 2015 +0100 @@ -118,11 +118,15 @@ if packet.HasField('pkt_id'): ascii_out.write('%s,' % (packet.pkt_id)) if packet.HasField('flags'): - ascii_out.write('%s,%s,%s,%s,%s\n' % (cmd, packet.addr, packet.size, + ascii_out.write('%s,%s,%s,%s,%s' % (cmd, packet.addr, packet.size, packet.flags, packet.tick)) else: - ascii_out.write('%s,%s,%s,%s\n' % (cmd, packet.addr, packet.size, + ascii_out.write('%s,%s,%s,%s' % (cmd, packet.addr, packet.size, packet.tick)) + if packet.HasField('pc'): + ascii_out.write(',%s\n' % (packet.pc)) + else: + ascii_out.write('\n') print "Parsed packets:", num_packets diff -r eb3096e6af32 -r d7bd359183b3 src/mem/probes/MemTraceProbe.py --- a/src/mem/probes/MemTraceProbe.py Wed May 27 13:50:01 2015 +0100 +++ b/src/mem/probes/MemTraceProbe.py Tue Oct 20 18:50:31 2015 +0100 @@ -46,6 +46,9 @@ # 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 -r eb3096e6af32 -r d7bd359183b3 src/mem/probes/mem_trace.hh --- a/src/mem/probes/mem_trace.hh Wed May 27 13:50:01 2015 +0100 +++ b/src/mem/probes/mem_trace.hh Tue Oct 20 18:50:31 2015 +0100 @@ -64,6 +64,11 @@ /** Trace output stream */ ProtoOutputStream *traceStream; + + private: + + /** Include the Program Counter in the memory trace */ + const bool withPC; }; #endif //__MEM_PROBES_MEM_TRACE_HH__