summaryrefslogtreecommitdiffstats
path: root/tester/covoar/TraceConverter.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tester/covoar/TraceConverter.cc')
-rw-r--r--tester/covoar/TraceConverter.cc60
1 files changed, 49 insertions, 11 deletions
diff --git a/tester/covoar/TraceConverter.cc b/tester/covoar/TraceConverter.cc
index 0f7a44e..22b0f81 100644
--- a/tester/covoar/TraceConverter.cc
+++ b/tester/covoar/TraceConverter.cc
@@ -10,9 +10,10 @@
#include <sys/stat.h>
#include <string.h>
#include <getopt.h>
+#include <signal.h>
+#include <unistd.h>
#include "qemu-log.h"
-
#include "TraceReaderLogQEMU.h"
#include "TraceWriterQEMU.h"
#include "TraceList.h"
@@ -20,6 +21,9 @@
#include "app_common.h"
#include "TargetFactory.h"
+#include "rld.h"
+#include "rld-process.h"
+
char* progname;
void usage()
@@ -32,6 +36,40 @@ void usage()
exit(1);
}
+static void
+fatal_signal( int signum )
+{
+ signal( signum, SIG_DFL );
+
+ rld::process::temporaries_clean_up();
+
+ /*
+ * Get the same signal again, this time not handled, so its normal effect
+ * occurs.
+ */
+ kill( getpid(), signum );
+}
+
+static void
+setup_signals( void )
+{
+ if ( signal (SIGINT, SIG_IGN) != SIG_IGN )
+ signal( SIGINT, fatal_signal );
+#ifdef SIGHUP
+ if ( signal( SIGHUP, SIG_IGN ) != SIG_IGN )
+ signal( SIGHUP, fatal_signal );
+#endif
+ if ( signal( SIGTERM, SIG_IGN ) != SIG_IGN )
+ signal( SIGTERM, fatal_signal );
+#ifdef SIGPIPE
+ if ( signal( SIGPIPE, SIG_IGN ) != SIG_IGN )
+ signal( SIGPIPE, fatal_signal );
+#endif
+#ifdef SIGCHLD
+ signal( SIGCHLD, SIG_DFL );
+#endif
+}
+
int main(
int argc,
char** argv
@@ -45,10 +83,14 @@ int main(
const char *tracefile = "";
const char *logname = "/tmp/qemu.log";
Coverage::ExecutableInfo* executableInfo;
-
- //
- // Process command line options.
- //
+ rld::process::tempfile objdumpFile( ".dmp" );
+ rld::process::tempfile err( ".err" );
+
+ setup_signals();
+
+ //
+ // Process command line options.
+ //
progname = argv[0];
while ((opt = getopt(argc, argv, "c:e:l:L:t:v")) != -1) {
@@ -88,17 +130,13 @@ int main(
executableInfo = new Coverage::ExecutableInfo( executable );
objdumpProcessor = new Coverage::ObjdumpProcessor();
-
+
// If a dynamic library was specified, determine the load address.
if (dynamicLibrary)
executableInfo->setLoadAddress(
objdumpProcessor->determineLoadAddress( executableInfo )
);
-
- objdumpProcessor->loadAddressTable( executableInfo );
-
+ objdumpProcessor->loadAddressTable( executableInfo, objdumpFile, err );
log.processFile( logname );
-
trace.writeFile( tracefile, &log );
-
}