diff options
Diffstat (limited to 'common/trace_local_writer.cpp')
-rw-r--r-- | common/trace_local_writer.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/common/trace_local_writer.cpp b/common/trace_local_writer.cpp index ea6c111..e625f2e 100644 --- a/common/trace_local_writer.cpp +++ b/common/trace_local_writer.cpp @@ -41,14 +41,17 @@ namespace Trace { 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() { @@ -96,8 +99,6 @@ LocalWriter::open(void) { Writer::open(szFileName); - OS::SetExceptionCallback(exceptionCallback); - #if 0 // For debugging the exception handler *((int *)0) = 0; @@ -142,6 +143,7 @@ void LocalWriter::flush(void) { if (!acquired) { OS::AcquireMutex(); if (m_file->isOpened()) { + OS::DebugMessage("apitrace: flushing trace due to an exception\n"); m_file->flush(); } OS::ReleaseMutex(); |