blob: 9642e1e37d1c460dbc737cdbc58937dbf8bd6fcf [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>
apatrick@chromium.org8187fa82010-06-15 22:09:28 +000012#include <stdio.h>
alokp@chromium.org91b72322010-06-02 15:50:56 +000013
14#include "compiler/ParseHelper.h"
15
16static const int kTraceBufferLen = 1024;
17
18#ifdef TRACE_ENABLED
19extern "C" {
20void Trace(const char *format, ...) {
21 if (!format) return;
22
23 TParseContext* parseContext = GetGlobalParseContext();
24 if (parseContext) {
25 char buf[kTraceBufferLen];
26 va_list args;
27 va_start(args, format);
28 vsnprintf(buf, kTraceBufferLen, format, args);
29 va_end(args);
30
31 parseContext->infoSink.debug << buf;
32 }
33}
34} // extern "C"
35#endif // TRACE_ENABLED
36