3 Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Red Hat, Inc.
5 This software is a copyrighted work licensed under the terms of the
6 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
10 #define MALLOC_CHECK do {} while (0)
14 #define MALLOC_CHECK ({\
15 debug_printf ("checking malloc pool");\
20 #if !defined(_DEBUG_H_)
23 #define being_debugged() (IsDebuggerPresent ())
27 # define ForceCloseHandle CloseHandle
28 # define ForceCloseHandle1(h, n) CloseHandle (h)
29 # define ForceCloseHandle2(h, n) CloseHandle (h)
30 # define ModifyHandle(h, n) do {} while (0)
31 # define ProtectHandle(h) do {} while (0)
32 # define ProtectHandle1(h,n) do {} while (0)
33 # define ProtectHandle2(h,n) do {} while (0)
34 # define ProtectHandleINH(h) do {} while (0)
35 # define ProtectHandle1INH(h,n) do {} while (0)
36 # define ProtectHandle2INH(h,n) do {} while (0)
37 # define debug_init() do {} while (0)
38 # define setclexec(h, nh, b) do {} while (0)
39 # define debug_fixup_after_fork_exec() do {} while (0)
40 # define VerifyHandle(h) do {} while (0)
41 # define console_printf small_printf
45 # ifdef NO_DEBUG_DEFINES
46 # undef NO_DEBUG_DEFINES
48 # define CloseHandle(h) \
49 close_handle (__PRETTY_FUNCTION__, __LINE__, (h), #h, FALSE)
50 # define ForceCloseHandle(h) \
51 close_handle (__PRETTY_FUNCTION__, __LINE__, (h), #h, TRUE)
52 # define ForceCloseHandle1(h,n) \
53 close_handle (__PRETTY_FUNCTION__, __LINE__, (h), #n, TRUE)
54 # define ForceCloseHandle2(h,n) \
55 close_handle (__PRETTY_FUNCTION__, __LINE__, (h), n, TRUE)
58 # define ModifyHandle(h, n) modify_handle (__PRETTY_FUNCTION__, __LINE__, (h), #h, n)
60 # define ProtectHandle(h) add_handle (__PRETTY_FUNCTION__, __LINE__, (h), #h)
61 # define ProtectHandle1(h, n) add_handle (__PRETTY_FUNCTION__, __LINE__, (h), #n)
62 # define ProtectHandle2(h, n) add_handle (__PRETTY_FUNCTION__, __LINE__, (h), n)
63 # define ProtectHandleINH(h) add_handle (__PRETTY_FUNCTION__, __LINE__, (h), #h, 1)
64 # define ProtectHandle1INH(h, n) add_handle (__PRETTY_FUNCTION__, __LINE__, (h), #n, 1)
65 # define ProtectHandle2INH(h, n) add_handle (__PRETTY_FUNCTION__, __LINE__, (h), n, 1)
66 # define VerifyHandle(h) verify_handle (__PRETTY_FUNCTION__, __LINE__, (h))
69 void __stdcall add_handle (const char *, int, HANDLE, const char *, bool = false)
70 __attribute__ ((regparm (3)));
71 void __stdcall verify_handle (const char *, int, HANDLE)
72 __attribute__ ((regparm (3)));
73 bool __stdcall close_handle (const char *, int, HANDLE, const char *, bool)
74 __attribute__ ((regparm (3)));
75 extern "C" void console_printf (const char *fmt,...);
76 void __stdcall cygbench (const char *s) __attribute__ ((regparm (1)));
77 void __stdcall modify_handle (const char *, int, HANDLE, const char *, bool)
78 __attribute__ ((regparm (3)));
79 void setclexec (HANDLE, HANDLE, bool);
80 void debug_fixup_after_fork_exec ();
90 struct handle_list *next;