T32: Parsing cli options for T32 fail-client

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@2108 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
hoffmann
2013-02-17 17:01:31 +00:00
parent 205c7ec919
commit 2c6a4c2d6e
7 changed files with 3033 additions and 75 deletions

View File

@ -1,82 +1,17 @@
/**
* FailT32 -- Fault Injection on the Lauterbach Trace32 System
*
* 1. Invoke t32 executable with appropriate Lauterbach Skript
* - Script has to load binary
* - and let system run until entry point
* -> Then we have a readily configured system
*
* @author Martin Hoffmann <hoffmann@cs.fau.de>
* @date 15.02.2013
*/
#include <t32.h>
#include "T32Connector.hpp"
#include <iostream>
#include <string.h>
#include <stdlib.h>
namespace fail {
#include "config/VariantConfig.hpp"
#include "sal/SALInst.hpp"
using namespace std;
/* Default T32 error handler */
void err(int ernum){
if(err != 0){
cerr << "Error: " << err << endl;
//exit(-1);
}
T32Connector::T32Connector(char *hostname, unsigned port, unsigned packlen) : m_hostname(hostname), m_port(port), m_packetlength(packlen) {
}
/* Here we go... */
int main(int argc, char** argv){
// Evaluate arguments
// Setup connection to Lauterbach
cout << "Lauterbach remote connection" << endl;
int error;
char hostname[] = "localhost";
char packlen[] = "1024";
char port[] = "20010";
cout << "[T32] Connecting to " << hostname << ":" << port << " Packlen: " << packlen << endl;
T32_Config("NODE=", hostname);
T32_Config("PACKLEN=", packlen);
T32_Config("PORT=", port);
cout << "[T32] Init." << endl;
err(T32_Init());
cout << "[T32] Attach." << endl;
err(T32_Attach(T32_DEV_ICD));
// Let the SimulatorController do the dirty work.
fail::simulator.startup();
// Here, we come back after any experiment called a resume
// Start execution of the SUT.
// The experiments/traces hopefully set some Breakpoints, we can react on.
// We may also provide a timeout, if a TimerListener was set wanted.
/*
while(1) {
// Start execution (with next timeout, in any)
// Wait for debugger to stop.
// Evaluate state.
// Call appropriate callback of the SimulatorController.
}
*/
cout << "[T32 Backend] After startup" << endl;
return 0;
T32Connector::~T32Connector() {
// Close Connection to T32 on object deletion. Also works, on simulator.terminate -> global object.
std::cout << "[T32] Closing connection." << std::endl;
}
}