13115SN/A/*
24125SN/A * Copyright (c) 2006-2007 The Regents of The University of Michigan
33115SN/A * All rights reserved.
43115SN/A *
53115SN/A * Redistribution and use in source and binary forms, with or without
63115SN/A * modification, are permitted provided that the following conditions are
73115SN/A * met: redistributions of source code must retain the above copyright
83115SN/A * notice, this list of conditions and the following disclaimer;
93115SN/A * redistributions in binary form must reproduce the above copyright
103115SN/A * notice, this list of conditions and the following disclaimer in the
113115SN/A * documentation and/or other materials provided with the distribution;
123115SN/A * neither the name of the copyright holders nor the names of its
133115SN/A * contributors may be used to endorse or promote products derived from
143115SN/A * this software without specific prior written permission.
153115SN/A *
163115SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
173115SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
183115SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
193115SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
203115SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
213115SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
223115SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
233115SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
243115SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
253115SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
263115SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
273115SN/A *
283115SN/A * Authors: Gabe Black
293115SN/A */
303115SN/A
313115SN/A#ifndef TRACECHILD_HH
323115SN/A#define TRACECHILD_HH
333115SN/A
348113Sgblack@eecs.umich.edu#include "base/regstate.hh"
353115SN/A
363115SN/Aclass TraceChild : public RegState
373115SN/A{
388108SN/A  protected:
398108SN/A    int pid;
408108SN/A    uint64_t instructions;
418108SN/A    bool tracing;
428108SN/A  public:
438108SN/A    TraceChild() : tracing(false), instructions(0)
448108SN/A    {;}
458108SN/A    virtual bool sendState(int socket) = 0;
468108SN/A    virtual bool startTracing(const char * pathToFile, char * const argv[]);
478108SN/A    virtual bool stopTracing();
488108SN/A    virtual bool step();
498108SN/A    virtual std::ostream & outputStartState(std::ostream & os) = 0;
508108SN/A    bool
518108SN/A    isTracing()
528108SN/A    {
538108SN/A        return tracing;
548108SN/A    }
558108SN/A  protected:
568108SN/A    bool ptraceSingleStep();
578108SN/A    bool doWait();
583115SN/A};
593115SN/A
603115SN/ATraceChild * genTraceChild();
613115SN/A
623115SN/A#endif
63