michael@0: // michael@0: // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: // michael@0: michael@0: // compiler_debug.cpp: Debugging utilities. michael@0: michael@0: #include "compiler/compiler_debug.h" michael@0: michael@0: #include michael@0: #include michael@0: michael@0: #include "compiler/InitializeParseContext.h" michael@0: #include "compiler/ParseHelper.h" michael@0: michael@0: static const int kTraceBufferLen = 1024; michael@0: michael@0: #ifdef TRACE_ENABLED michael@0: extern "C" { michael@0: void Trace(const char *format, ...) { michael@0: if (!format) return; michael@0: michael@0: TParseContext* parseContext = GetGlobalParseContext(); michael@0: if (parseContext) { michael@0: char buf[kTraceBufferLen]; michael@0: va_list args; michael@0: va_start(args, format); michael@0: vsnprintf(buf, kTraceBufferLen, format, args); michael@0: va_end(args); michael@0: michael@0: parseContext->trace(buf); michael@0: } michael@0: } michael@0: } // extern "C" michael@0: #endif // TRACE_ENABLED michael@0: