summaryrefslogtreecommitdiff
path: root/util/statetrace/tracechild.cc
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2007-03-05 20:54:20 -0500
committerGabe Black <gblack@eecs.umich.edu>2007-03-05 20:54:20 -0500
commit9b72ff82907a1f3b0b740dcbceb462fb0fd7d8c3 (patch)
tree7943858c2bf18c9f8cb45267b193687badade473 /util/statetrace/tracechild.cc
parent68ad1533096ab736c534cb29364a1a93e1010306 (diff)
downloadgem5-9b72ff82907a1f3b0b740dcbceb462fb0fd7d8c3.tar.xz
Fixing statetrace to work with 32 bit SPARC processes, as well as rewritting it's single stepping code.
--HG-- extra : convert_revision : 69b1668a850519ab98b02c525ec41ff727eb6036
Diffstat (limited to 'util/statetrace/tracechild.cc')
-rw-r--r--util/statetrace/tracechild.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/util/statetrace/tracechild.cc b/util/statetrace/tracechild.cc
index 292c45658..130f9690f 100644
--- a/util/statetrace/tracechild.cc
+++ b/util/statetrace/tracechild.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006 The Regents of The University of Michigan
+ * 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
@@ -36,8 +36,9 @@
using namespace std;
-bool TraceChild::startTracing(const char * pathToFile, const char * arg)
+bool TraceChild::startTracing(const char * pathToFile, char * const argv[])
{
+ instructions = 0;
pid = fork();
if(pid == -1)
{
@@ -53,7 +54,7 @@ bool TraceChild::startTracing(const char * pathToFile, const char * arg)
ptrace(PTRACE_TRACEME, 0, 0, 0);
//Start the program to trace
- execl(pathToFile, arg);
+ execv(pathToFile, argv);
//We should never get here, so this is an error!
return false;
@@ -121,6 +122,8 @@ bool TraceChild::doWait()
{
cerr << "Program exited! Exit status is "
<< WEXITSTATUS(wait_val) << endl;
+ cerr << "Executed " << instructions
+ << " instructions." << endl;
tracing = false;
return false;
}
@@ -132,6 +135,8 @@ bool TraceChild::doWait()
if(WCOREDUMP(wait_val))
cerr << "Program core dumped!" << endl;
tracing = false;
+ cerr << "Executed " << instructions
+ << " instructions." << endl;
return false;
}
if(WIFSTOPPED(wait_val) && WSTOPSIG(wait_val) != SIGTRAP)
@@ -139,6 +144,8 @@ bool TraceChild::doWait()
cerr << "Program stopped by signal "
<< WSTOPSIG(wait_val) << endl;
tracing = false;
+ cerr << "Executed " << instructions
+ << " instructions." << endl;
return false;
}
return true;