44 #include "config/the_isa.hh"
47 #include "debug/ExecEnable.hh"
48 #include "params/InstPBTrace.hh"
49 #include "proto/inst.pb.h"
88 ProtoMessage::InstHeader header_msg;
89 header_msg.set_obj_id(
"gem5 generated instruction trace");
90 header_msg.set_ver(0);
92 header_msg.set_has_mem(
true);
127 if (!Debug::ExecEnable)
145 curMsg =
new ProtoMessage::Inst;
150 curMsg->set_type(static_cast<ProtoMessage::Inst_InstType>(si->
opClass()));
161 curMsg->set_type(static_cast<ProtoMessage::Inst_InstType>(si->
opClass()));
163 ProtoMessage::Inst::MemAccess *mem_msg =
curMsg->add_mem_access();
164 mem_msg->set_addr(a);
165 mem_msg->set_size(s);
166 mem_msg->set_mem_flags(f);
174 InstPBTraceParams::create()
A ProtoOutputStream wraps a coded stream, potentially with compression, based on looking at the file ...
bool isFirstMicroop() const
void closeStreams()
If there is a pending message still write it out and then close the file.
void write(const google::protobuf::Message &msg)
Write a message to the stream, preprending it with the message size.
InstPBTraceRecord * getInstRecord(Tick when, ThreadContext *tc, const StaticInstPtr si, TheISA::PCState pc, const StaticInstPtr mi=NULL) override
OpClass opClass() const
Operation class. Used to select appropriate function unit in issue.
panic_if(!root,"Invalid expression\n")
This in an instruction tracer that records the flow of instructions through multiple cpus and systems...
Tick Frequency
The simulated frequency of curTick(). (In ticks per second)
ThreadContext is the external interface to all thread state for anything outside of the CPU...
const ExtMachInst machInst
The binary machine instruction.
Tick curTick()
The current simulated tick.
static ProtoOutputStream * traceStream
One output stream for the entire simulation.
friend class InstPBTraceRecord
virtual int cpuId() const =0
InstPBTrace(const InstPBTraceParams *p)
uint64_t Tick
Tick count type.
void registerExitCallback(Callback *callback)
Register an exit callback.
StaticInstPtr macroStaticInst
ProtoMessage::Inst * curMsg
This is the message were working on writing.
unsigned getFlags() const
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
std::string resolve(const std::string &name) const
Returns relative file names prepended with name of this directory.
void traceInst(ThreadContext *tc, StaticInstPtr si, TheISA::PCState pc)
Write an instruction to the trace file.
GenericISA::SimplePCState< MachInst > PCState
Helper template class to turn a simple class member function into a callback.
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it...
void createTraceFile(std::string filename)
Create the output file and write the header into it.
void traceMem(StaticInstPtr si, Addr a, Addr s, unsigned f)
Write a memory request to the trace file as part of the cur instruction.
void dump() override
called by the cpu when the instruction commits.