blob: f3a778536c1b35324c377a82a62e51b024829b4e [file] [log] [blame]
alokp@chromium.org91b72322010-06-02 15:50:56 +00001//
2// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7// debug.cpp: Debugging utilities.
8
9#include "compiler/debug.h"
10
11#include <stdarg.h>
12
13#include "compiler/ParseHelper.h"
14
15static const int kTraceBufferLen = 1024;
16
17#ifdef TRACE_ENABLED
18extern "C" {
19void Trace(const char *format, ...) {
20 if (!format) return;
21
22 TParseContext* parseContext = GetGlobalParseContext();
23 if (parseContext) {
24 char buf[kTraceBufferLen];
25 va_list args;
26 va_start(args, format);
27 vsnprintf(buf, kTraceBufferLen, format, args);
28 va_end(args);
29
30 parseContext->infoSink.debug << buf;
31 }
32}
33} // extern "C"
34#endif // TRACE_ENABLED
35