namespace Trace {
+static const char *memcpy_args[3] = {"dest", "src", "n"};
+const FunctionSig memcpy_sig = {0, "memcpy", 3, memcpy_args};
+
+static const char *malloc_args[1] = {"size"};
+const FunctionSig malloc_sig = {1, "malloc", 1, malloc_args};
+
+static const char *free_args[1] = {"ptr"};
+const FunctionSig free_sig = {2, "free", 1, free_args};
+
+static const char *realloc_args[2] = {"ptr", "size"};
+const FunctionSig realloc_sig = {3, "realloc", 2, realloc_args};
+
+
static void exceptionCallback(void)
{
- OS::DebugMessage("apitrace: flushing trace due to an exception\n");
localWriter.flush();
}
LocalWriter::LocalWriter() :
acquired(0)
-{}
+{
+ // Install the signal handlers as early as possible, to prevent
+ // interfering with the application's signal handling.
+ OS::SetExceptionCallback(exceptionCallback);
+}
LocalWriter::~LocalWriter()
{
Writer::open(szFileName);
- OS::SetExceptionCallback(exceptionCallback);
-
#if 0
// For debugging the exception handler
*((int *)0) = 0;
if (!acquired) {
OS::AcquireMutex();
if (m_file->isOpened()) {
+ OS::DebugMessage("apitrace: flushing trace due to an exception\n");
m_file->flush();
}
OS::ReleaseMutex();