summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2011-03-02 22:53:10 -0800
committerGabe Black <gblack@eecs.umich.edu>2011-03-02 22:53:10 -0800
commit3c19e45a68db15dc450f07a77cf0083aa40270cd (patch)
treeaeffbae528bbe823abab0c509eb3443748d44524
parent3df970f0de9790c0805ec76759a9c36a0fb10bac (diff)
downloadgem5-3c19e45a68db15dc450f07a77cf0083aa40270cd.tar.xz
Statetrace: Kill the printer functionality in statetrace.
-rw-r--r--util/statetrace/Makefile8
-rw-r--r--util/statetrace/printer.cc280
-rw-r--r--util/statetrace/printer.hh111
-rw-r--r--util/statetrace/refcnt.hh128
-rw-r--r--util/statetrace/statetrace.cc1
-rw-r--r--util/statetrace/x86.format6
6 files changed, 3 insertions, 531 deletions
diff --git a/util/statetrace/Makefile b/util/statetrace/Makefile
index 438828981..d7636ecf5 100644
--- a/util/statetrace/Makefile
+++ b/util/statetrace/Makefile
@@ -40,16 +40,14 @@ endef
all: statetrace
-printer.o: printer.cc printer.hh tracechild.hh refcnt.hh regstate.hh
- $(build-obj)
-statetrace.o: statetrace.cc printer.hh tracechild.hh refcnt.hh regstate.hh
+statetrace.o: statetrace.cc tracechild.hh regstate.hh
$(build-obj)
tracechild.o: tracechild.cc tracechild.hh regstate.hh
$(build-obj)
-tracechild_arch.o: statetrace.cc printer.hh tracechild.hh refcnt.hh regstate.hh arch/tracechild_arm.hh arch/tracechild_arm.cc arch/tracechild_i386.hh arch/tracechild_i386.cc arch/tracechild_amd64.cc arch/tracechild_amd64.hh arch/tracechild_sparc.cc arch/tracechild_sparc.hh
+tracechild_arch.o: statetrace.cc tracechild.hh regstate.hh arch/tracechild_arm.hh arch/tracechild_arm.cc arch/tracechild_i386.hh arch/tracechild_i386.cc arch/tracechild_amd64.cc arch/tracechild_amd64.hh arch/tracechild_sparc.cc arch/tracechild_sparc.hh
$(build-obj)
-statetrace: printer.o statetrace.o tracechild.o tracechild_arch.o
+statetrace: statetrace.o tracechild.o tracechild_arch.o
$(final-link)
clean:
diff --git a/util/statetrace/printer.cc b/util/statetrace/printer.cc
deleted file mode 100644
index 7cfa775f8..000000000
--- a/util/statetrace/printer.cc
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * Copyright (c) 2006-2007 The Regents of The University of Michigan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Gabe Black
- */
-
-#include "tracechild.hh"
-#include "printer.hh"
-
-using namespace std;
-
-//Types of printers. If none is found, or there is an error in the input,
-//there are psuedo types to return.
-enum PrinterType {PRINTER_NONE, PRINTER_ERROR, PRINTER_NESTING, PRINTER_REG};
-
-int findEndOfRegPrinter(string, int);
-int findEndOfNestingPrinter(string, int);
-PrinterType findSub(string, int &, int &);
-
-//This is pretty easy. Just find the closing parenthesis.
-int
-findEndOfRegPrinter(string config, int startPos)
-{
- int pos = config.find(")", startPos);
- if (pos == string::npos) {
- cerr << "Couldn't find the closing " <<
- "parenthesis for a reg printer" << endl;
- return 0;
- }
- return pos;
-}
-
-//This is a little harder. We need to make sure we don't
-//grab an ending parenthesis that belongs to the nesting printer.
-int
-findEndOfNestingPrinter(string config, int startPos)
-{
- int length = config.length();
- int pos = startPos;
- int endPos = length;
- int parenPos = config.find(")", pos);
- //If we didn't find an ending parenthesis at all, we're in trouble
- if (parenPos == string::npos) {
- cerr << "Couldn't find the closing " <<
- "parenthesis for a nesting printer on the first try" << endl;
- return 0;
- }
- //Keep pulling out embedded stuff until we can't any more
- //we need to make sure we aren't skipping over the parenthesis
- //that ends -this- printer.
- PrinterType type = findSub(config, pos, endPos);
- if (type == PRINTER_ERROR)
- return 0;
- while (type != PRINTER_NONE && endPos >= parenPos) {
- //Find the next closest ending parenthesis since we passed
- //up the last one
- parenPos = config.find(")", endPos + 1);
- //If we didn't find one, we're in trouble
- if (parenPos == string::npos) {
- cerr << "Couldn't find the closing parenthesis for a nested printer on later tries" << endl;
- return 0;
- }
- //Start looking for the end of this printer and embedded
- //stuff past the one we just found
- pos = endPos + 1;
- //Reset endPos so we search to the end of config
- endPos = length;
- type = findSub(config, pos, endPos);
- if (type == PRINTER_ERROR)
- return 0;
- }
- //We ran out of embedded items, and we didn't pass up our last
- //closing paren. This must be the end of this printer.
- return parenPos;
-}
-
-//Find a sub printer. This looks for things which have a type defining
-//character and then an opening parenthesis. The type is returned, and
-//startPos and endPos are set to the beginning and end of the sub printer
-//On entry, the search starts at index startPos and ends at either index
-//endPos or a closing parenthesis, whichever comes first
-PrinterType
-findSub(string config, int & startPos, int & endPos)
-{
- int length = config.length();
- //Figure out where the different types of sub printers may start
- int regPos = config.find("%(", startPos);
- int nestingPos = config.find("~(", startPos);
- //If a type of printer wasn't found, say it was found too far away.
- //This simplifies things later
- if (regPos == string::npos)
- regPos = endPos;
- if (nestingPos == string::npos)
- nestingPos = endPos;
- //If we find a closing paren, that marks the
- //end of the region we're searching.
- int closingPos = config.find(")", startPos);
- if (closingPos != string::npos &&
- closingPos < regPos &&
- closingPos < nestingPos)
- return PRINTER_NONE;
- //If we didn't find anything close enough, say so.
- if (regPos >= endPos && nestingPos >= endPos)
- return PRINTER_NONE;
- //At this point, we know that one of the options starts legally
- //We need to find which one is first and return that
- if (regPos < nestingPos) {
- int regEnd = findEndOfRegPrinter(config, regPos + 2);
- //If we couldn't find the end...
- if (!regEnd) {
- cerr << "Couldn't find the end of the reg printer" << endl;
- return PRINTER_ERROR;
- }
- //Report the sub printer's vitals.
- startPos = regPos;
- endPos = regEnd;
- return PRINTER_REG;
- } else {
- int nestingEnd = findEndOfNestingPrinter(config, nestingPos + 2);
- //If we couldn't find the end...
- if (!nestingEnd) {
- cerr << "Couldn't find the end of the nesting printer" << endl;
- return PRINTER_ERROR;
- }
- //Report the sub printer's vitals.
- startPos = nestingPos;
- endPos = nestingEnd;
- return PRINTER_NESTING;
- }
- return PRINTER_NONE;
-}
-
-//Set up a nesting printer. This printer can contain sub printers
-bool
-NestingPrinter::configure(string config)
-{
- //Clear out any old stuff
- constStrings.clear();
- numPrinters = 0;
- printers.clear();
- int length = config.length();
- int startPos = 0, endPos = length;
- int lastEndPos = -1;
- //Try to find a sub printer
- PrinterType type = findSub(config, startPos, endPos);
- if (type == PRINTER_ERROR) {
- cerr << "Problem finding first sub printer" << endl;
- return false;
- }
- while (type != PRINTER_NONE) {
- string prefix = config.substr(lastEndPos + 1,
- startPos - lastEndPos - 1);
- lastEndPos = endPos;
- constStrings.push_back(prefix);
- string subConfig, subString;
- long int commaPos, lastCommaPos, childSwitchVar;
- //Set up the register printer
- RegPrinter * regPrinter = new RegPrinter(child);
- NestingPrinter * nestingPrinter = new NestingPrinter(child);
- switch (type) {
- //If we found a plain register printer
- case PRINTER_REG:
- numPrinters++;
- //Get the register name
- subConfig = config.substr(startPos + 2, endPos - startPos - 2);
- if (!regPrinter->configure(subConfig)) {
- delete regPrinter;
- cerr << "Error configuring reg printer" << endl;
- return false;
- }
- printers.push_back(regPrinter);
- break;
- //If we found an embedded nesting printer
- case PRINTER_NESTING:
- numPrinters++;
- //Punt on reading in all the parameters of the nesting printer
- subConfig = config.substr(startPos + 2, endPos - startPos - 2);
- lastCommaPos = string::npos;
- commaPos = subConfig.find(",");
- if (commaPos == string::npos)
- return false;
- childSwitchVar = child->getRegNum(subConfig.substr(0, commaPos));
- if (childSwitchVar == -1) {
- cerr << "Couldn't configure switching variable!" << endl;
- return false;
- }
- //Eat up remaining arguments
- while (commaPos != string::npos) {
- lastCommaPos = commaPos;
- commaPos = subConfig.find(",", commaPos + 1);
- }
- if (lastCommaPos != string::npos) {
- subConfig = subConfig.substr(lastCommaPos + 1,
- subConfig.length() - lastCommaPos - 1);
- }
- if (!nestingPrinter->configure(subConfig)) {
- delete nestingPrinter;
- cerr << "Error configuring nesting printer" << endl;
- return false;
- }
- nestingPrinter->switchVar = childSwitchVar;
- printers.push_back(nestingPrinter);
- break;
- default:
- cerr << "Unrecognized printer type" << endl;
- return false;
- }
- //Move down past what we just parsed
- startPos = endPos + 1;
- endPos = length;
- type = findSub(config, startPos, endPos);
- if (type == PRINTER_ERROR) {
- cerr << "Unable to find subprinters on later tries" << endl;
- return false;
- }
- }
- //Put in the trailing stuff
- string trailer = config.substr(startPos, length - startPos);
- constStrings.push_back(trailer);
- return true;
-}
-
-bool
-RegPrinter::configure(string config)
-{
- //Figure out what our register number is based on the name we're given
- int num = child->getRegNum(config);
- if (num == -1) {
- cerr << "Couldn't find register " << config << endl;
- return false;
- }
- regNum(num);
- return true;
-}
-
-ostream &
-NestingPrinter::writeOut(ostream & os)
-{
- if (switchVar == -1 || child->diffSinceUpdate(switchVar)) {
- int x;
- for (x = 0; x < numPrinters; x++) {
- os << constStrings[x];
- os << printers[x];
- }
- os << constStrings[x];
- }
- return os;
-}
-
-ostream &
-RegPrinter::writeOut(ostream & os)
-{
- os << child->printReg(intRegNum);
- return os;
-}
-
diff --git a/util/statetrace/printer.hh b/util/statetrace/printer.hh
deleted file mode 100644
index 3e23cf425..000000000
--- a/util/statetrace/printer.hh
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2006 The Regents of The University of Michigan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Gabe Black
- */
-
-#ifndef PRINTER_HH
-#define PRINTER_HH
-
-#include <iostream>
-#include <string>
-#include <vector>
-
-#include "refcnt.hh"
-
-class TraceChild;
-class PrinterObject;
-
-typedef RefCountingPtr<PrinterObject> PrinterPointer;
-
-class PrinterObject : public RefCounted
-{
- protected:
- TraceChild * child;
- public:
- PrinterObject(TraceChild * newChild) : child(newChild)
- {;}
- virtual std::ostream & writeOut(std::ostream & os) = 0;
- virtual bool configure(std::string) = 0;
-};
-
-class NestingPrinter : public PrinterObject
-{
- private:
- std::vector<std::string> constStrings;
- std::vector<PrinterPointer> printers;
- int switchVar;
- int numPrinters;
- public:
- NestingPrinter(TraceChild * newChild) :
- PrinterObject(newChild), numPrinters(0), switchVar(-1)
- {;}
-
- bool configure(std::string);
-
- std::ostream & writeOut(std::ostream & os);
-};
-
-class RegPrinter : public PrinterObject
-{
- private:
- int intRegNum;
- public:
- RegPrinter(TraceChild * newChild, int num = 0) :
- PrinterObject(newChild), intRegNum(num)
- {;}
-
- void
- regNum(int num)
- {
- intRegNum = num;
- }
-
- int
- regNum()
- {
- return intRegNum;
- }
-
- bool configure(std::string);
-
- std::ostream & writeOut(std::ostream & os);
-};
-
-static inline std::ostream &
-operator << (std::ostream & os, PrinterObject & printer)
-{
- return printer.writeOut(os);
-}
-
-static inline std::ostream &
-operator << (std::ostream & os, PrinterPointer & printer)
-{
- return printer->writeOut(os);
-}
-
-#endif
diff --git a/util/statetrace/refcnt.hh b/util/statetrace/refcnt.hh
deleted file mode 100644
index d6c627b7a..000000000
--- a/util/statetrace/refcnt.hh
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2002-2005 The Regents of The University of Michigan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Nathan Binkert
- */
-
-#ifndef __REFCNT_HH__
-#define __REFCNT_HH__
-
-#include <stddef.h> //For the NULL macro definition
-
-class RefCounted
-{
- private:
- int count;
-
- private:
- RefCounted(const RefCounted &);
-
- public:
- RefCounted() : count(0) {}
- virtual ~RefCounted() {}
-
- void incref() { ++count; }
- void decref() { if (--count <= 0) delete this; }
-};
-
-template <class T>
-class RefCountingPtr
-{
- protected:
- T *data;
-
- void
- copy(T *d)
- {
- data = d;
- if (data)
- data->incref();
- }
- void
- del()
- {
- if (data)
- data->decref();
- }
- void
- set(T *d)
- {
- if (data == d)
- return;
-
- del();
- copy(d);
- }
-
-
- public:
- RefCountingPtr() : data(NULL) {}
- RefCountingPtr(T *data) { copy(data); }
- RefCountingPtr(const RefCountingPtr &r) { copy(r.data); }
- ~RefCountingPtr() { del(); }
-
- T *operator->() { return data; }
- T &operator*() { return *data; }
- T *get() { return data; }
-
- const T *operator->() const { return data; }
- const T &operator*() const { return *data; }
- const T *get() const { return data; }
-
- RefCountingPtr &operator=(T *p) { set(p); return *this; }
- RefCountingPtr &operator=(const RefCountingPtr &r)
- { return operator=(r.data); }
-
- bool operator!() const { return data == 0; }
- operator bool() const { return data != 0; }
-};
-
-template<class T>
-bool operator==(const RefCountingPtr<T> &l, const RefCountingPtr<T> &r)
-{ return l.get() == r.get(); }
-
-template<class T>
-bool operator==(const RefCountingPtr<T> &l, const T *r)
-{ return l.get() == r; }
-
-template<class T>
-bool operator==(const T &l, const RefCountingPtr<T> &r)
-{ return l == r.get(); }
-
-template<class T>
-bool operator!=(const RefCountingPtr<T> &l, const RefCountingPtr<T> &r)
-{ return l.get() != r.get(); }
-
-template<class T>
-bool operator!=(const RefCountingPtr<T> &l, const T *r)
-{ return l.get() != r; }
-
-template<class T>
-bool operator!=(const T &l, const RefCountingPtr<T> &r)
-{ return l != r.get(); }
-
-#endif // __REFCNT_HH__
diff --git a/util/statetrace/statetrace.cc b/util/statetrace/statetrace.cc
index 132e5baa3..ff20625a1 100644
--- a/util/statetrace/statetrace.cc
+++ b/util/statetrace/statetrace.cc
@@ -42,7 +42,6 @@
#include <sys/wait.h>
#include <unistd.h>
-#include "printer.hh"
#include "tracechild.hh"
using namespace std;
diff --git a/util/statetrace/x86.format b/util/statetrace/x86.format
deleted file mode 100644
index 03035ee29..000000000
--- a/util/statetrace/x86.format
+++ /dev/null
@@ -1,6 +0,0 @@
-######################
-EIP = %(eip)
-EAX = %(eax), EBX = %(ebx), ECX = %(ecx), EDX = %(edx)
-EDI = %(edi), ESI = %(esi)
-EBP = %(ebp), ESP = %(esp)
-CS = %(cs), DS = %(ds), ES = %(es), FS = %(fs), GS = %(gs), SS = %(ss)