nativetrace.cc revision 8232
112SN/A/*
21762SN/A * Copyright (c) 2006-2009 The Regents of The University of Michigan
312SN/A * All rights reserved.
412SN/A *
512SN/A * Redistribution and use in source and binary forms, with or without
612SN/A * modification, are permitted provided that the following conditions are
712SN/A * met: redistributions of source code must retain the above copyright
812SN/A * notice, this list of conditions and the following disclaimer;
912SN/A * redistributions in binary form must reproduce the above copyright
1012SN/A * notice, this list of conditions and the following disclaimer in the
1112SN/A * documentation and/or other materials provided with the distribution;
1212SN/A * neither the name of the copyright holders nor the names of its
1312SN/A * contributors may be used to endorse or promote products derived from
1412SN/A * this software without specific prior written permission.
1512SN/A *
1612SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1712SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1812SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1912SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2012SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2112SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2212SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2312SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2412SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2512SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2612SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * Authors: Gabe Black
2912SN/A */
3012SN/A
3112SN/A#include "base/socket.hh"
3212SN/A#include "cpu/nativetrace.hh"
3356SN/A#include "cpu/static_inst.hh"
347676Snate@binkert.org#include "debug/GDBMisc.hh"
352439SN/A#include "params/NativeTrace.hh"
367676Snate@binkert.org
377676Snate@binkert.orgusing namespace std;
3812SN/A
397676Snate@binkert.orgnamespace Trace {
407676Snate@binkert.org
417676Snate@binkert.orgNativeTrace::NativeTrace(const Params *p)
427676Snate@binkert.org    : ExeTracer(p)
437676Snate@binkert.org{
4456SN/A    if (ListenSocket::allDisabled())
4556SN/A        fatal("All listeners are disabled!");
467676Snate@binkert.org
4712SN/A    int port = 8000;
4812SN/A    while(!native_listener.listen(port, true))
4912SN/A    {
5012SN/A        DPRINTF(GDBMisc, "Can't bind port %d\n", port);
5112SN/A        port++;
5212SN/A    }
5312SN/A    ccprintf(cerr, "Listening for native process on port %d\n", port);
5412SN/A    fd = native_listener.accept();
55360SN/A}
56360SN/A
5712SN/Avoid
5812SN/ATrace::NativeTraceRecord::dump()
5912SN/A{
6012SN/A    //Don't print what happens for each micro-op, just print out
6112SN/A    //once at the last op, and for regular instructions.
6212SN/A    if (!staticInst->isMicroop() || staticInst->isLastMicroop())
6312SN/A        parent->check(this);
6412SN/A}
65360SN/A
66360SN/A} // namespace Trace
67360SN/A