nativetrace.cc revision 6409
16019Shines@cs.fsu.edu/*
210338SCurtis.Dunham@arm.com * Copyright (c) 2006-2009 The Regents of The University of Michigan
37093Sgblack@eecs.umich.edu * All rights reserved.
47093Sgblack@eecs.umich.edu *
57093Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without
67093Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are
77093Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright
87093Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer;
97093Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright
107093Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the
117093Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution;
127093Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its
137093Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from
146019Shines@cs.fsu.edu * this software without specific prior written permission.
156019Shines@cs.fsu.edu *
166019Shines@cs.fsu.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
176019Shines@cs.fsu.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
186019Shines@cs.fsu.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
196019Shines@cs.fsu.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
206019Shines@cs.fsu.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
216019Shines@cs.fsu.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
226019Shines@cs.fsu.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
236019Shines@cs.fsu.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
246019Shines@cs.fsu.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
256019Shines@cs.fsu.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
266019Shines@cs.fsu.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
276019Shines@cs.fsu.edu *
286019Shines@cs.fsu.edu * Authors: Gabe Black
296019Shines@cs.fsu.edu */
306019Shines@cs.fsu.edu
316019Shines@cs.fsu.edu#include "base/socket.hh"
326019Shines@cs.fsu.edu#include "cpu/nativetrace.hh"
336019Shines@cs.fsu.edu#include "cpu/static_inst.hh"
346019Shines@cs.fsu.edu#include "params/NativeTrace.hh"
356019Shines@cs.fsu.edu
366019Shines@cs.fsu.eduusing namespace std;
376019Shines@cs.fsu.edu
386019Shines@cs.fsu.edunamespace Trace {
396019Shines@cs.fsu.edu
406019Shines@cs.fsu.eduNativeTrace::NativeTrace(const Params *p)
416735Sgblack@eecs.umich.edu    : ExeTracer(p)
426735Sgblack@eecs.umich.edu{
4310037SARM gem5 Developers    if (ListenSocket::allDisabled())
4410037SARM gem5 Developers        fatal("All listeners are disabled!");
456019Shines@cs.fsu.edu
466019Shines@cs.fsu.edu    int port = 8000;
476019Shines@cs.fsu.edu    while(!native_listener.listen(port, true))
4810037SARM gem5 Developers    {
4910037SARM gem5 Developers        DPRINTF(GDBMisc, "Can't bind port %d\n", port);
5010037SARM gem5 Developers        port++;
5110037SARM gem5 Developers    }
528229Snate@binkert.org    ccprintf(cerr, "Listening for native process on port %d\n", port);
538229Snate@binkert.org    fd = native_listener.accept();
546019Shines@cs.fsu.edu}
558232Snate@binkert.org
568782Sgblack@eecs.umich.eduvoid
576019Shines@cs.fsu.eduTrace::NativeTraceRecord::dump()
586019Shines@cs.fsu.edu{
596019Shines@cs.fsu.edu    //Don't print what happens for each micro-op, just print out
606019Shines@cs.fsu.edu    //once at the last op, and for regular instructions.
6110037SARM gem5 Developers    if (!staticInst->isMicroop() || staticInst->isLastMicroop())
6210037SARM gem5 Developers        parent->check(this);
6310037SARM gem5 Developers}
6410037SARM gem5 Developers
6510037SARM gem5 Developers} /* namespace Trace */
6610037SARM gem5 Developers