forked from adobe-flash/avmplus
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAvmAssert.cpp
42 lines (37 loc) · 1.14 KB
/
AvmAssert.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4 -*- */
/* vi: set ts=4 sw=4 expandtab: (add to ~/.vimrc: set modeline modelines=5) */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "AVMPI.h"
namespace avmplus
{
void AvmDebugMsg(bool debuggerBreak, const char* format, ...)
{
#ifdef _DEBUG
char buf[1024];
va_list args;
va_start(args, format);
VMPI_vsnprintf(buf, sizeof(buf), format, args);
// Belt and suspenders, remove when we're sure VMPI_vsnprintf is completely reliable
buf[sizeof(buf)-2] = '\n';
buf[sizeof(buf)-1] = '\0';
va_end(args);
AvmDebugMsg(buf, debuggerBreak);
#else
(void)debuggerBreak;
(void)format;
#endif
}
void AvmDebugMsg(const char* p, bool debugBreak)
{
#ifdef _DEBUG
VMPI_debugLog(p);
if(debugBreak)
VMPI_debugBreak();
#else
(void)p;
(void)debugBreak;
#endif
}
}