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
3111793Sbrandon.potter@amd.com#include "cpu/nativetrace.hh"
3211793Sbrandon.potter@amd.com
334776Sgblack@eecs.umich.edu#include "base/socket.hh"
344776Sgblack@eecs.umich.edu#include "cpu/static_inst.hh"
358232Snate@binkert.org#include "debug/GDBMisc.hh"
364776Sgblack@eecs.umich.edu#include "params/NativeTrace.hh"
374776Sgblack@eecs.umich.edu
384776Sgblack@eecs.umich.eduusing namespace std;
394776Sgblack@eecs.umich.edu
404776Sgblack@eecs.umich.edunamespace Trace {
414776Sgblack@eecs.umich.edu
425523Snate@binkert.orgNativeTrace::NativeTrace(const Params *p)
436409Sgblack@eecs.umich.edu    : ExeTracer(p)
444776Sgblack@eecs.umich.edu{
455523Snate@binkert.org    if (ListenSocket::allDisabled())
465523Snate@binkert.org        fatal("All listeners are disabled!");
475523Snate@binkert.org
484776Sgblack@eecs.umich.edu    int port = 8000;
4911321Ssteve.reinhardt@amd.com    while (!native_listener.listen(port, true))
504776Sgblack@eecs.umich.edu    {
514776Sgblack@eecs.umich.edu        DPRINTF(GDBMisc, "Can't bind port %d\n", port);
524776Sgblack@eecs.umich.edu        port++;
534776Sgblack@eecs.umich.edu    }
544776Sgblack@eecs.umich.edu    ccprintf(cerr, "Listening for native process on port %d\n", port);
554776Sgblack@eecs.umich.edu    fd = native_listener.accept();
565049Sgblack@eecs.umich.edu}
575049Sgblack@eecs.umich.edu
584776Sgblack@eecs.umich.eduvoid
594776Sgblack@eecs.umich.eduTrace::NativeTraceRecord::dump()
604776Sgblack@eecs.umich.edu{
614776Sgblack@eecs.umich.edu    //Don't print what happens for each micro-op, just print out
624776Sgblack@eecs.umich.edu    //once at the last op, and for regular instructions.
636365Sgblack@eecs.umich.edu    if (!staticInst->isMicroop() || staticInst->isLastMicroop())
646365Sgblack@eecs.umich.edu        parent->check(this);
654830Sgblack@eecs.umich.edu}
664830Sgblack@eecs.umich.edu
677811Ssteve.reinhardt@amd.com} // namespace Trace
68