summaryrefslogtreecommitdiff
path: root/util/statetrace/statetrace.cc
diff options
context:
space:
mode:
authorKorey Sewell <ksewell@umich.edu>2009-07-31 10:40:42 -0400
committerKorey Sewell <ksewell@umich.edu>2009-07-31 10:40:42 -0400
commitaa75b9a7a7489bf86c4e6d406ff612e596ddff96 (patch)
tree58a6816583a21c19c181e32bff10bf74aa9ad15f /util/statetrace/statetrace.cc
parent60063cc700912666fa8b7968d692d00a1e82cb67 (diff)
parent3dd3de5feb31055a48acb39575da25a9cea2626d (diff)
downloadgem5-aa75b9a7a7489bf86c4e6d406ff612e596ddff96.tar.xz
merge mips fix and statetrace changes
Diffstat (limited to 'util/statetrace/statetrace.cc')
-rw-r--r--util/statetrace/statetrace.cc32
1 files changed, 22 insertions, 10 deletions
diff --git a/util/statetrace/statetrace.cc b/util/statetrace/statetrace.cc
index 5f7224b25..e2762ac2c 100644
--- a/util/statetrace/statetrace.cc
+++ b/util/statetrace/statetrace.cc
@@ -28,19 +28,19 @@
* Authors: Gabe Black
*/
-#include <iostream>
+#include <cstring>
+#include <errno.h>
#include <fstream>
+#include <iostream>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <stdio.h>
#include <string>
+#include <sys/ptrace.h>
+#include <sys/socket.h>
#include <sys/types.h>
#include <sys/wait.h>
-#include <sys/ptrace.h>
#include <unistd.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <errno.h>
#include "printer.hh"
#include "tracechild.hh"
@@ -61,6 +61,7 @@ int main(int argc, char * argv[], char * envp[])
//Parse the command line arguments
bool printInitial = false;
bool printTrace = true;
+ string host = "localhost";
for(int x = 1; x < argc; x++)
{
if(!strcmp(argv[x], "-h"))
@@ -68,6 +69,17 @@ int main(int argc, char * argv[], char * envp[])
printUsage(argv[0]);
return 0;
}
+ if(!strcmp(argv[x], "--host"))
+ {
+ x++;
+ if(x >= argc)
+ {
+ cerr << "Incorrect usage.\n" << endl;
+ printUsage(argv[0]);
+ return 1;
+ }
+ host = argv[x];
+ }
else if(!strcmp(argv[x], "-r"))
{
cout << "Legal register names:" << endl;
@@ -111,6 +123,7 @@ int main(int argc, char * argv[], char * envp[])
cerr << "Couldn't start target program" << endl;
return 1;
}
+ child->step();
if(printInitial)
{
child->outputStartState(cout);
@@ -127,7 +140,7 @@ int main(int argc, char * argv[], char * envp[])
return 1;
}
struct hostent *server;
- server = gethostbyname("localhost");
+ server = gethostbyname(host.c_str());
if(!server)
{
cerr << "Couldn't get host ip! " << strerror(errno) << endl;
@@ -145,7 +158,6 @@ int main(int argc, char * argv[], char * envp[])
cerr << "Couldn't connect to server! " << strerror(errno) << endl;
return 1;
}
- child->step();
while(child->isTracing())
{
if(!child->sendState(sock))