nativetrace.cc revision 6365
14776Sgblack@eecs.umich.edu/* 26365Sgblack@eecs.umich.edu * Copyright (c) 2006-2009 The Regents of The University of Michigan 34776Sgblack@eecs.umich.edu * All rights reserved. 44776Sgblack@eecs.umich.edu * 54776Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 64776Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are 74776Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright 84776Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 94776Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 104776Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 114776Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution; 124776Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its 134776Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 144776Sgblack@eecs.umich.edu * this software without specific prior written permission. 154776Sgblack@eecs.umich.edu * 164776Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 174776Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 184776Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 194776Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 204776Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 214776Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 224776Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 234776Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 244776Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 254776Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 264776Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 274776Sgblack@eecs.umich.edu * 286365Sgblack@eecs.umich.edu * Authors: Gabe Black 294776Sgblack@eecs.umich.edu */ 304776Sgblack@eecs.umich.edu 314776Sgblack@eecs.umich.edu#include "base/socket.hh" 324776Sgblack@eecs.umich.edu#include "cpu/nativetrace.hh" 334776Sgblack@eecs.umich.edu#include "cpu/static_inst.hh" 344776Sgblack@eecs.umich.edu#include "params/NativeTrace.hh" 354776Sgblack@eecs.umich.edu 364776Sgblack@eecs.umich.eduusing namespace std; 374776Sgblack@eecs.umich.edu 384776Sgblack@eecs.umich.edunamespace Trace { 394776Sgblack@eecs.umich.edu 405523Snate@binkert.orgNativeTrace::NativeTrace(const Params *p) 415523Snate@binkert.org : InstTracer(p) 424776Sgblack@eecs.umich.edu{ 435523Snate@binkert.org if (ListenSocket::allDisabled()) 445523Snate@binkert.org fatal("All listeners are disabled!"); 455523Snate@binkert.org 464776Sgblack@eecs.umich.edu int port = 8000; 474776Sgblack@eecs.umich.edu while(!native_listener.listen(port, true)) 484776Sgblack@eecs.umich.edu { 494776Sgblack@eecs.umich.edu DPRINTF(GDBMisc, "Can't bind port %d\n", port); 504776Sgblack@eecs.umich.edu port++; 514776Sgblack@eecs.umich.edu } 524776Sgblack@eecs.umich.edu ccprintf(cerr, "Listening for native process on port %d\n", port); 534776Sgblack@eecs.umich.edu fd = native_listener.accept(); 545049Sgblack@eecs.umich.edu} 555049Sgblack@eecs.umich.edu 564776Sgblack@eecs.umich.eduvoid 574776Sgblack@eecs.umich.eduTrace::NativeTraceRecord::dump() 584776Sgblack@eecs.umich.edu{ 594776Sgblack@eecs.umich.edu //Don't print what happens for each micro-op, just print out 604776Sgblack@eecs.umich.edu //once at the last op, and for regular instructions. 616365Sgblack@eecs.umich.edu if (!staticInst->isMicroop() || staticInst->isLastMicroop()) 626365Sgblack@eecs.umich.edu parent->check(this); 634830Sgblack@eecs.umich.edu} 644830Sgblack@eecs.umich.edu 656365Sgblack@eecs.umich.edu} /* namespace Trace */ 66