nativetrace.hh revision 4776
15124Sgblack@eecs.umich.edu/* 25124Sgblack@eecs.umich.edu * Copyright (c) 2001-2005 The Regents of The University of Michigan 35124Sgblack@eecs.umich.edu * All rights reserved. 45124Sgblack@eecs.umich.edu * 55124Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 65124Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are 75124Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright 85124Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 95124Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 105124Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 115124Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution; 125124Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its 135124Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 145124Sgblack@eecs.umich.edu * this software without specific prior written permission. 155124Sgblack@eecs.umich.edu * 165124Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 175124Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 185124Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 195124Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 205124Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 215124Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 225124Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 235124Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 245124Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 255124Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 265124Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 275124Sgblack@eecs.umich.edu * 285124Sgblack@eecs.umich.edu * Authors: Steve Reinhardt 295124Sgblack@eecs.umich.edu * Nathan Binkert 305124Sgblack@eecs.umich.edu */ 315124Sgblack@eecs.umich.edu 325124Sgblack@eecs.umich.edu#ifndef __NATIVETRACE_HH__ 335124Sgblack@eecs.umich.edu#define __NATIVETRACE_HH__ 345124Sgblack@eecs.umich.edu 355124Sgblack@eecs.umich.edu#include "base/trace.hh" 365124Sgblack@eecs.umich.edu#include "cpu/static_inst.hh" 375124Sgblack@eecs.umich.edu#include "sim/host.hh" 385124Sgblack@eecs.umich.edu#include "sim/insttracer.hh" 395124Sgblack@eecs.umich.edu 405124Sgblack@eecs.umich.educlass ThreadContext; 415124Sgblack@eecs.umich.edu 425124Sgblack@eecs.umich.edu 435124Sgblack@eecs.umich.edunamespace Trace { 445124Sgblack@eecs.umich.edu 455124Sgblack@eecs.umich.educlass NativeTrace; 465124Sgblack@eecs.umich.edu 475124Sgblack@eecs.umich.educlass NativeTraceRecord : public InstRecord 485124Sgblack@eecs.umich.edu{ 495124Sgblack@eecs.umich.edu protected: 505124Sgblack@eecs.umich.edu NativeTrace * parent; 515124Sgblack@eecs.umich.edu 525124Sgblack@eecs.umich.edu bool 535124Sgblack@eecs.umich.edu checkIntReg(const char * regName, int index, int size); 545124Sgblack@eecs.umich.edu 555124Sgblack@eecs.umich.edu bool 565124Sgblack@eecs.umich.edu checkPC(const char * regName, int size); 575124Sgblack@eecs.umich.edu 585124Sgblack@eecs.umich.edu public: 595124Sgblack@eecs.umich.edu NativeTraceRecord(NativeTrace * _parent, 605124Sgblack@eecs.umich.edu Tick _when, ThreadContext *_thread, 615124Sgblack@eecs.umich.edu const StaticInstPtr &_staticInst, Addr _pc, bool spec) 625124Sgblack@eecs.umich.edu : InstRecord(_when, _thread, _staticInst, _pc, spec), parent(_parent) 635124Sgblack@eecs.umich.edu { 645124Sgblack@eecs.umich.edu } 655124Sgblack@eecs.umich.edu 665124Sgblack@eecs.umich.edu void dump(); 675124Sgblack@eecs.umich.edu}; 685124Sgblack@eecs.umich.edu 695124Sgblack@eecs.umich.educlass NativeTrace : public InstTracer 705124Sgblack@eecs.umich.edu{ 715124Sgblack@eecs.umich.edu protected: 725124Sgblack@eecs.umich.edu int fd; 735124Sgblack@eecs.umich.edu 745124Sgblack@eecs.umich.edu ListenSocket native_listener; 755124Sgblack@eecs.umich.edu 765124Sgblack@eecs.umich.edu public: 775124Sgblack@eecs.umich.edu 785124Sgblack@eecs.umich.edu NativeTrace(const std::string & name); 795124Sgblack@eecs.umich.edu 805124Sgblack@eecs.umich.edu NativeTraceRecord * 815124Sgblack@eecs.umich.edu getInstRecord(Tick when, ThreadContext *tc, 825124Sgblack@eecs.umich.edu const StaticInstPtr staticInst, Addr pc) 835124Sgblack@eecs.umich.edu { 845124Sgblack@eecs.umich.edu if (tc->misspeculating()) 855124Sgblack@eecs.umich.edu return NULL; 865124Sgblack@eecs.umich.edu 875124Sgblack@eecs.umich.edu return new NativeTraceRecord(this, when, tc, 885124Sgblack@eecs.umich.edu staticInst, pc, tc->misspeculating()); 895124Sgblack@eecs.umich.edu } 905124Sgblack@eecs.umich.edu 915124Sgblack@eecs.umich.edu friend class NativeTraceRecord; 925124Sgblack@eecs.umich.edu}; 935124Sgblack@eecs.umich.edu 945124Sgblack@eecs.umich.edu/* namespace Trace */ } 955124Sgblack@eecs.umich.edu 965124Sgblack@eecs.umich.edu#endif // __EXETRACE_HH__ 975124Sgblack@eecs.umich.edu