Gabe Black | 8dd7700 | 2007-07-28 20:30:43 -0700 | [diff] [blame] | 1 | /* |
Gabe Black | 3e8e813 | 2009-07-19 23:54:56 -0700 | [diff] [blame] | 2 | * Copyright (c) 2006-2009 The Regents of The University of Michigan |
Gabe Black | 8dd7700 | 2007-07-28 20:30:43 -0700 | [diff] [blame] | 3 | * 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 Black | 8dd7700 | 2007-07-28 20:30:43 -0700 | [diff] [blame] | 27 | */ |
| 28 | |
Gabe Black | 8dd7700 | 2007-07-28 20:30:43 -0700 | [diff] [blame] | 29 | #include "cpu/nativetrace.hh" |
Brandon Potter | 7a8dda4 | 2016-11-09 14:27:37 -0600 | [diff] [blame] | 30 | |
| 31 | #include "base/socket.hh" |
Gabe Black | 8dd7700 | 2007-07-28 20:30:43 -0700 | [diff] [blame] | 32 | #include "cpu/static_inst.hh" |
Nathan Binkert | eddac53 | 2011-04-15 10:44:32 -0700 | [diff] [blame] | 33 | #include "debug/GDBMisc.hh" |
Gabe Black | 8dd7700 | 2007-07-28 20:30:43 -0700 | [diff] [blame] | 34 | #include "params/NativeTrace.hh" |
| 35 | |
Daniel R. Carvalho | 974a47d | 2021-05-09 12:32:07 -0300 | [diff] [blame] | 36 | namespace gem5 |
| 37 | { |
| 38 | |
Gabe Black | 8dd7700 | 2007-07-28 20:30:43 -0700 | [diff] [blame] | 39 | namespace Trace { |
| 40 | |
Gabe Black | 91d83cc | 2020-10-07 06:49:23 -0700 | [diff] [blame] | 41 | NativeTrace::NativeTrace(const Params &p) |
Gabe Black | 8ec235c | 2009-07-27 00:54:09 -0700 | [diff] [blame] | 42 | : ExeTracer(p) |
Gabe Black | 8dd7700 | 2007-07-28 20:30:43 -0700 | [diff] [blame] | 43 | { |
Nathan Binkert | 50ef39a | 2008-08-03 18:19:55 -0700 | [diff] [blame] | 44 | if (ListenSocket::allDisabled()) |
| 45 | fatal("All listeners are disabled!"); |
| 46 | |
Gabe Black | 8dd7700 | 2007-07-28 20:30:43 -0700 | [diff] [blame] | 47 | int port = 8000; |
Steve Reinhardt | 5592798 | 2016-02-06 17:21:19 -0800 | [diff] [blame] | 48 | while (!native_listener.listen(port, true)) |
Gabe Black | 8dd7700 | 2007-07-28 20:30:43 -0700 | [diff] [blame] | 49 | { |
| 50 | DPRINTF(GDBMisc, "Can't bind port %d\n", port); |
| 51 | port++; |
| 52 | } |
Gabe Black | 2343ee2 | 2021-01-21 04:40:10 -0800 | [diff] [blame] | 53 | ccprintf(std::cerr, "Listening for native process on port %d\n", port); |
Gabe Black | 8dd7700 | 2007-07-28 20:30:43 -0700 | [diff] [blame] | 54 | fd = native_listener.accept(); |
Gabe Black | 26044dc | 2007-09-04 23:39:57 -0700 | [diff] [blame] | 55 | } |
| 56 | |
Gabe Black | 8dd7700 | 2007-07-28 20:30:43 -0700 | [diff] [blame] | 57 | void |
| 58 | Trace::NativeTraceRecord::dump() |
| 59 | { |
Gabe Black | 8dd7700 | 2007-07-28 20:30:43 -0700 | [diff] [blame] | 60 | //Don't print what happens for each micro-op, just print out |
| 61 | //once at the last op, and for regular instructions. |
Gabe Black | 3e8e813 | 2009-07-19 23:54:56 -0700 | [diff] [blame] | 62 | if (!staticInst->isMicroop() || staticInst->isLastMicroop()) |
| 63 | parent->check(this); |
Gabe Black | e42524a | 2007-08-01 12:01:51 -0700 | [diff] [blame] | 64 | } |
| 65 | |
Steve Reinhardt | c69d48f | 2011-01-03 14:35:43 -0800 | [diff] [blame] | 66 | } // namespace Trace |
Daniel R. Carvalho | 974a47d | 2021-05-09 12:32:07 -0300 | [diff] [blame] | 67 | } // namespace gem5 |