1 /* 2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 #if !defined(_AWT_DEBUG_H) 27 #define _AWT_DEBUG_H 28 29 #include "debug_assert.h" 30 #include "debug_trace.h" 31 32 #if defined(DEBUG) 33 #if defined(new) 34 #error new has already been defined! 35 #endif 36 class AwtDebugSupport { 37 public: 38 AwtDebugSupport(); 39 ~AwtDebugSupport(); 40 41 static void AssertCallback(const char * expr, const char * file, 42 int line); 43 /* This method signals that the VM is exiting cleanly, and thus the 44 the debug memory manager should dump a leaks report when the 45 VM has finished exiting. This method should not be called for 46 termination exits (such as <CTRL>-C) */ 47 static void GenerateLeaksReport(); 48 }; 49 50 extern void * operator new(size_t size, const char * filename, int linenumber); 51 extern void * operator new[](size_t size, const char * filename, int linenumber); 52 53 #if _MSC_VER >= 1200 54 /* VC 6.0 is more strict about enforcing matching placement new & delete */ 55 extern void operator delete(void *ptr, const char*, int); 56 #endif 57 58 extern void operator delete(void *ptr) throw(); 59 extern void DumpClipRectangle(const char * file, int line, int argc, const char * fmt, va_list arglist); 60 extern void DumpUpdateRectangle(const char * file, int line, int argc, const char * fmt, va_list arglist); 61 62 #define AWT_DUMP_UPDATE_RECTANGLE(_msg, _hwnd) \ 63 _DTrace_Template(DumpUpdateRectangle, 2, "", (_msg), (_hwnd), 0, 0, 0, 0, 0, 0) 64 65 #define AWT_DUMP_CLIP_RECTANGLE(_msg, _hwnd) \ 66 _DTrace_Template(DumpClipRectangle, 2, "", (_msg), (_hwnd), 0, 0, 0, 0, 0, 0) 67 68 #define new new(__FILE__, __LINE__) 69 70 #define VERIFY(exp) DASSERT(exp) 71 #define UNIMPLEMENTED() DASSERT(FALSE) 72 73 /* Disable inlining. */ 74 #define INLINE 75 #else 76 #define AWT_DUMP_UPDATE_RECTANGLE(_msg, _hwnd) ((void)0) 77 #define AWT_DUMP_CLIP_RECTANGLE(_msg, _hwnd) ((void)0) 78 79 #define UNIMPLEMENTED() \ 80 SignalError(0, JAVAPKG "NullPointerException","unimplemented"); 81 82 /* 83 * VERIFY macro -- assertion where expression is always evaluated 84 * (normally used for BOOL functions). 85 */ 86 #define VERIFY(exp) ((void)(exp)) 87 88 /* Enable inlining. */ 89 #define INLINE inline 90 #endif // DEBUG 91 92 #endif // _AWT_DEBUG_H