diff options
author | Andreas Hansson <andreas.hansson@armm.com> | 2013-02-19 05:56:05 -0500 |
---|---|---|
committer | Andreas Hansson <andreas.hansson@armm.com> | 2013-02-19 05:56:05 -0500 |
commit | 9947923c605bdbd864aebaa47e6a062390288652 (patch) | |
tree | 6bc512ceb4d6f0115dd6cd58af5bff2d51e198bf /src | |
parent | 21aa950318c3f754797e1aab3533f749559e7e87 (diff) | |
download | gem5-9947923c605bdbd864aebaa47e6a062390288652.tar.xz |
mem: Ensure trace captures packet fields before forwarding
This patch fixes a bug in the CommMonitor caused by the packet being
modified before it is captured in the trace. By recording the fields
before passing the packet on, and then putting these values in the
trace we ensure that even if the packet is modified the trace captures
what the CommMonitor saw.
Diffstat (limited to 'src')
-rw-r--r-- | src/mem/comm_monitor.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mem/comm_monitor.cc b/src/mem/comm_monitor.cc index 88e549cbb..51e95b36b 100644 --- a/src/mem/comm_monitor.cc +++ b/src/mem/comm_monitor.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 ARM Limited + * Copyright (c) 2012-2013 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -162,6 +162,7 @@ CommMonitor::recvTimingReq(PacketPtr pkt) // or even deleted when sendTiming() is called. bool isRead = pkt->isRead(); bool isWrite = pkt->isWrite(); + int cmd = pkt->cmdToIndex(); unsigned size = pkt->getSize(); Addr addr = pkt->getAddr(); bool needsResponse = pkt->needsResponse(); @@ -193,9 +194,9 @@ CommMonitor::recvTimingReq(PacketPtr pkt) // trace. Message::Packet pkt_msg; pkt_msg.set_tick(curTick()); - pkt_msg.set_cmd(pkt->cmdToIndex()); - pkt_msg.set_addr(pkt->getAddr()); - pkt_msg.set_size(pkt->getSize()); + pkt_msg.set_cmd(cmd); + pkt_msg.set_addr(addr); + pkt_msg.set_size(size); traceStream->write(pkt_msg); } |