exetrace.hh revision 5784
12SN/A/* 21762SN/A * Copyright (c) 2001-2005 The Regents of The University of Michigan 32SN/A * All rights reserved. 42SN/A * 52SN/A * Redistribution and use in source and binary forms, with or without 62SN/A * modification, are permitted provided that the following conditions are 72SN/A * met: redistributions of source code must retain the above copyright 82SN/A * notice, this list of conditions and the following disclaimer; 92SN/A * redistributions in binary form must reproduce the above copyright 102SN/A * notice, this list of conditions and the following disclaimer in the 112SN/A * documentation and/or other materials provided with the distribution; 122SN/A * neither the name of the copyright holders nor the names of its 132SN/A * contributors may be used to endorse or promote products derived from 142SN/A * this software without specific prior written permission. 152SN/A * 162SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu * 282665Ssaidi@eecs.umich.edu * Authors: Steve Reinhardt 292665Ssaidi@eecs.umich.edu * Nathan Binkert 302SN/A */ 312SN/A 322SN/A#ifndef __EXETRACE_HH__ 332SN/A#define __EXETRACE_HH__ 342SN/A 354046Sbinkertn@umich.edu#include "base/trace.hh" 364046Sbinkertn@umich.edu#include "cpu/static_inst.hh" 3756SN/A#include "sim/host.hh" 384776Sgblack@eecs.umich.edu#include "sim/insttracer.hh" 395034Smilesck@eecs.umich.edu#include "params/ExeTracer.hh" 402SN/A 413064Sgblack@eecs.umich.educlass ThreadContext; 422SN/A 432SN/A 442SN/Anamespace Trace { 452SN/A 464776Sgblack@eecs.umich.educlass ExeTracerRecord : public InstRecord 472SN/A{ 482SN/A public: 494776Sgblack@eecs.umich.edu ExeTracerRecord(Tick _when, ThreadContext *_thread, 505784Sgblack@eecs.umich.edu const StaticInstPtr _staticInst, Addr _pc, bool spec, 515784Sgblack@eecs.umich.edu const StaticInstPtr _macroStaticInst = NULL, MicroPC _upc = 0) 525784Sgblack@eecs.umich.edu : InstRecord(_when, _thread, _staticInst, _pc, spec, 535784Sgblack@eecs.umich.edu _macroStaticInst, _upc) 542SN/A { 552SN/A } 562SN/A 575784Sgblack@eecs.umich.edu void traceInst(StaticInstPtr inst, bool ran); 585784Sgblack@eecs.umich.edu 594046Sbinkertn@umich.edu void dump(); 602SN/A}; 612SN/A 624776Sgblack@eecs.umich.educlass ExeTracer : public InstTracer 634776Sgblack@eecs.umich.edu{ 644776Sgblack@eecs.umich.edu public: 655034Smilesck@eecs.umich.edu typedef ExeTracerParams Params; 665034Smilesck@eecs.umich.edu ExeTracer(const Params *params) : InstTracer(params) 674776Sgblack@eecs.umich.edu {} 682SN/A 694776Sgblack@eecs.umich.edu InstRecord * 704776Sgblack@eecs.umich.edu getInstRecord(Tick when, ThreadContext *tc, 715784Sgblack@eecs.umich.edu const StaticInstPtr staticInst, Addr pc, 725784Sgblack@eecs.umich.edu const StaticInstPtr macroStaticInst = NULL, MicroPC upc = 0) 734776Sgblack@eecs.umich.edu { 744776Sgblack@eecs.umich.edu if (!IsOn(ExecEnable)) 754776Sgblack@eecs.umich.edu return NULL; 762SN/A 774776Sgblack@eecs.umich.edu if (!Trace::enabled) 784776Sgblack@eecs.umich.edu return NULL; 792SN/A 804776Sgblack@eecs.umich.edu if (!IsOn(ExecSpeculative) && tc->misspeculating()) 814776Sgblack@eecs.umich.edu return NULL; 824074Sbinkertn@umich.edu 834776Sgblack@eecs.umich.edu return new ExeTracerRecord(when, tc, 845784Sgblack@eecs.umich.edu staticInst, pc, tc->misspeculating(), macroStaticInst, upc); 854776Sgblack@eecs.umich.edu } 864776Sgblack@eecs.umich.edu}; 872SN/A 884054Sbinkertn@umich.edu/* namespace Trace */ } 892SN/A 902SN/A#endif // __EXETRACE_HH__ 91