tracechild.hh revision 8108
12810SN/A/*
28856Sandreas.hansson@arm.com * Copyright (c) 2006-2007 The Regents of The University of Michigan
38856Sandreas.hansson@arm.com * All rights reserved.
48856Sandreas.hansson@arm.com *
58856Sandreas.hansson@arm.com * Redistribution and use in source and binary forms, with or without
68856Sandreas.hansson@arm.com * modification, are permitted provided that the following conditions are
78856Sandreas.hansson@arm.com * met: redistributions of source code must retain the above copyright
88856Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer;
98856Sandreas.hansson@arm.com * redistributions in binary form must reproduce the above copyright
108856Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer in the
118856Sandreas.hansson@arm.com * documentation and/or other materials provided with the distribution;
128856Sandreas.hansson@arm.com * neither the name of the copyright holders nor the names of its
138856Sandreas.hansson@arm.com * contributors may be used to endorse or promote products derived from
142810SN/A * this software without specific prior written permission.
152810SN/A *
162810SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172810SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182810SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192810SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202810SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212810SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222810SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232810SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242810SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252810SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262810SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272810SN/A *
282810SN/A * Authors: Gabe Black
292810SN/A */
302810SN/A
312810SN/A#ifndef TRACECHILD_HH
322810SN/A#define TRACECHILD_HH
332810SN/A
342810SN/A#include "regstate.hh"
352810SN/A
362810SN/Aclass TraceChild : public RegState
372810SN/A{
382810SN/A  protected:
392810SN/A    int pid;
402810SN/A    uint64_t instructions;
414458SN/A    bool tracing;
424458SN/A  public:
432810SN/A    TraceChild() : tracing(false), instructions(0)
442810SN/A    {;}
452810SN/A    virtual bool sendState(int socket) = 0;
462810SN/A    virtual bool startTracing(const char * pathToFile, char * const argv[]);
472810SN/A    virtual bool stopTracing();
482810SN/A    virtual bool step();
492810SN/A    virtual uint64_t getPC() = 0;
502810SN/A    virtual uint64_t getSP() = 0;
512810SN/A    virtual std::ostream & outputStartState(std::ostream & os) = 0;
522810SN/A    int
537676Snate@binkert.org    getPid()
547676Snate@binkert.org    {
557676Snate@binkert.org        return pid;
562810SN/A    }
572810SN/A    bool
582825SN/A    isTracing()
592810SN/A    {
602810SN/A        return tracing;
616215Snate@binkert.org    }
628232Snate@binkert.org  protected:
638232Snate@binkert.org    bool ptraceSingleStep();
645338Sstever@gmail.com    bool doWait();
652810SN/A};
662810SN/A
678914Sandreas.hansson@arm.comTraceChild * genTraceChild();
688229Snate@binkert.org
695034SN/A#endif
702811SN/A