blob: 0686bcab012dfd36ab174f8d269da4d8ae223c7a [file] [log] [blame]
Gabe Black8dd77002007-07-28 20:30:43 -07001/*
Gabe Black3e8e8132009-07-19 23:54:56 -07002 * Copyright (c) 2006-2009 The Regents of The University of Michigan
Gabe Black8dd77002007-07-28 20:30:43 -07003 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Gabe Black8dd77002007-07-28 20:30:43 -070027 */
28
Gabe Black8dd77002007-07-28 20:30:43 -070029#include "cpu/nativetrace.hh"
Brandon Potter7a8dda42016-11-09 14:27:37 -060030
31#include "base/socket.hh"
Gabe Black8dd77002007-07-28 20:30:43 -070032#include "cpu/static_inst.hh"
Nathan Binkerteddac532011-04-15 10:44:32 -070033#include "debug/GDBMisc.hh"
Gabe Black8dd77002007-07-28 20:30:43 -070034#include "params/NativeTrace.hh"
35
Daniel R. Carvalho974a47d2021-05-09 12:32:07 -030036namespace gem5
37{
38
Gabe Black8dd77002007-07-28 20:30:43 -070039namespace Trace {
40
Gabe Black91d83cc2020-10-07 06:49:23 -070041NativeTrace::NativeTrace(const Params &p)
Gabe Black8ec235c2009-07-27 00:54:09 -070042 : ExeTracer(p)
Gabe Black8dd77002007-07-28 20:30:43 -070043{
Nathan Binkert50ef39a2008-08-03 18:19:55 -070044 if (ListenSocket::allDisabled())
45 fatal("All listeners are disabled!");
46
Gabe Black8dd77002007-07-28 20:30:43 -070047 int port = 8000;
Steve Reinhardt55927982016-02-06 17:21:19 -080048 while (!native_listener.listen(port, true))
Gabe Black8dd77002007-07-28 20:30:43 -070049 {
50 DPRINTF(GDBMisc, "Can't bind port %d\n", port);
51 port++;
52 }
Gabe Black2343ee22021-01-21 04:40:10 -080053 ccprintf(std::cerr, "Listening for native process on port %d\n", port);
Gabe Black8dd77002007-07-28 20:30:43 -070054 fd = native_listener.accept();
Gabe Black26044dc2007-09-04 23:39:57 -070055}
56
Gabe Black8dd77002007-07-28 20:30:43 -070057void
58Trace::NativeTraceRecord::dump()
59{
Gabe Black8dd77002007-07-28 20:30:43 -070060 //Don't print what happens for each micro-op, just print out
61 //once at the last op, and for regular instructions.
Gabe Black3e8e8132009-07-19 23:54:56 -070062 if (!staticInst->isMicroop() || staticInst->isLastMicroop())
63 parent->check(this);
Gabe Blacke42524a2007-08-01 12:01:51 -070064}
65
Steve Reinhardtc69d48f2011-01-03 14:35:43 -080066} // namespace Trace
Daniel R. Carvalho974a47d2021-05-09 12:32:07 -030067} // namespace gem5