Cygwin: cygtls: rename sig to current_sig
[newlib-cygwin.git] / winsup / cygwin / local_includes / debug.h
blob858f8d5dcd16aaa687822155c68f1f276220208e
1 /* debug.h
3 This software is a copyrighted work licensed under the terms of the
4 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
5 details. */
7 #if !defined(_DEBUG_H_)
8 #define _DEBUG_H_
10 #define being_debugged() (IsDebuggerPresent ())
12 #ifndef DEBUGGING
13 # define cygbench(s)
14 # define ForceCloseHandle CloseHandle
15 # define ForceCloseHandle1(h, n) CloseHandle (h)
16 # define ForceCloseHandle2(h, n) CloseHandle (h)
17 # define ModifyHandle(h, n) do {} while (0)
18 # define ProtectHandle(h) do {} while (0)
19 # define ProtectHandle1(h,n) do {} while (0)
20 # define ProtectHandle2(h,n) do {} while (0)
21 # define ProtectHandleINH(h) do {} while (0)
22 # define ProtectHandle1INH(h,n) do {} while (0)
23 # define ProtectHandle2INH(h,n) do {} while (0)
24 # define setclexec(h, nh, b) do {} while (0)
25 # define debug_fixup_after_fork_exec() do {} while (0)
26 # define VerifyHandle(h) do {} while (0)
27 # define console_printf small_printf
29 #else
31 # ifdef NO_DEBUG_DEFINES
32 # undef NO_DEBUG_DEFINES
33 # else
34 # define CloseHandle(h) \
35 close_handle (__PRETTY_FUNCTION__, __LINE__, (h), #h, FALSE)
36 # define ForceCloseHandle(h) \
37 close_handle (__PRETTY_FUNCTION__, __LINE__, (h), #h, TRUE)
38 # define ForceCloseHandle1(h,n) \
39 close_handle (__PRETTY_FUNCTION__, __LINE__, (h), #n, TRUE)
40 # define ForceCloseHandle2(h,n) \
41 close_handle (__PRETTY_FUNCTION__, __LINE__, (h), n, TRUE)
42 # endif
44 # define ModifyHandle(h, n) modify_handle (__PRETTY_FUNCTION__, __LINE__, (h), #h, n)
46 # define ProtectHandle(h) add_handle (__PRETTY_FUNCTION__, __LINE__, (h), #h)
47 # define ProtectHandle1(h, n) add_handle (__PRETTY_FUNCTION__, __LINE__, (h), #n)
48 # define ProtectHandle2(h, n) add_handle (__PRETTY_FUNCTION__, __LINE__, (h), n)
49 # define ProtectHandleINH(h) add_handle (__PRETTY_FUNCTION__, __LINE__, (h), #h, 1)
50 # define ProtectHandle1INH(h, n) add_handle (__PRETTY_FUNCTION__, __LINE__, (h), #n, 1)
51 # define ProtectHandle2INH(h, n) add_handle (__PRETTY_FUNCTION__, __LINE__, (h), n, 1)
52 # define VerifyHandle(h) verify_handle (__PRETTY_FUNCTION__, __LINE__, (h))
54 void add_handle (const char *, int, HANDLE, const char *, bool = false);
55 void verify_handle (const char *, int, HANDLE);
56 bool close_handle (const char *, int, HANDLE, const char *, bool);
57 extern "C" void console_printf (const char *fmt,...);
58 void cygbench (const char *s);
59 void modify_handle (const char *, int, HANDLE, const char *, bool);
60 void setclexec (HANDLE, HANDLE, bool);
61 void debug_fixup_after_fork_exec ();
63 struct handle_list
65 HANDLE h;
66 const char *name;
67 const char *func;
68 int ln;
69 bool inherited;
70 DWORD pid;
71 struct handle_list *next;
74 #endif /*DEBUGGING*/
75 #endif /*_DEBUG_H_*/