From: Gabe Black Date: Thu, 23 Jan 2020 04:29:36 +0000 (-0800) Subject: cpu: Fix ExeTraceRecord::traceInst. X-Git-Tag: v19.0.0.0~75 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7b62df85f8d5513b6fab5a8c40ad2e48ac5010ec;p=gem5.git cpu: Fix ExeTraceRecord::traceInst. A recent-ish change modified ExeTraceRecord::traceInst to make it more consistent with DPRINTF-s by using dprintf_flag to print the trace string. The generated string was passed as the format however, and that means that all % characters in the output (from register names, for example) are interpreted as format characters, mangling the output and making cprintf angry since there are no corresponding arguments. This change sets the format to "%s" instead, and passes the trace string as the first argument. The argument won't be parsed for format specifiers, and so should no longer get mangled. Change-Id: I8fa9c2c22179a5b55104a618a4af4080a3931c5f Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24643 Reviewed-by: Ciro Santilli Maintainer: Gabe Black Tested-by: kokoro --- diff --git a/src/cpu/exetrace.cc b/src/cpu/exetrace.cc index aeb17078c..2af59eb2e 100644 --- a/src/cpu/exetrace.cc +++ b/src/cpu/exetrace.cc @@ -177,7 +177,8 @@ Trace::ExeTracerRecord::traceInst(const StaticInstPtr &inst, bool ran) outs << endl; Trace::getDebugLogger()->dprintf_flag( - when, thread->getCpuPtr()->name(), "ExecEnable", outs.str().c_str()); + when, thread->getCpuPtr()->name(), "ExecEnable", "%s", + outs.str().c_str()); } void