]>
git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_utilities/lib/debugging_internal.h
2 * Copyright (c) 2000-2004,2011-2012,2014 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
26 // debugging_internal - non-trivial debug support
28 // everything in this file is deprecated. Try not to use it.
35 #include <security_utilities/utilities.h>
44 // Debug-dumping functions always exist. They may be stubs depending on build options.
46 bool dumping(const char *scope
);
47 void dump(const char *format
, ...) __attribute((format(printf
,1,2)));
48 void dumpData(const void *data
, size_t length
);
49 void dumpData(const char *title
, const void *data
, size_t length
);
50 template <class Data
> inline void dumpData(const Data
&obj
)
51 { dumpData(obj
.data(), obj
.length()); }
52 template <class Data
> inline void dumpData(const char *title
, const Data
&obj
)
53 { dumpData(title
, obj
.data(), obj
.length()); }
57 // The following functions perform runtime recovery of type names.
58 // This is meant for debugging ONLY. Don't even THINK of depending
59 // on this for program correctness. For all you know, we may replace
60 // all those names with "XXX" tomorrow.
62 string
makeTypeName(const type_info
&info
);
64 template <class Object
>
65 string
typeName(const Object
&obj
)
67 return makeTypeName(typeid(obj
));
70 template <class Object
>
73 return makeTypeName(typeid(Object
));
78 // We are still conditionally emitting debug-dumping code
83 // No more debugdump, it emits thread-unsafe buggy code which hampers actual debugging, ironically enough
84 // # define DEBUGDUMP 1
89 #if defined(DEBUGDUMP)
90 # define IFDUMP(code) code
91 # define IFDUMPING(scope,code) if (Debug::dumping(scope)) code; else /* no */
93 # define IFDUMP(code) /* no-op */
94 # define IFDUMPING(scope,code) /* no-op */
99 // We have some very, very old customers who call old debug facilities.
100 // Dummy them out for now.
102 inline bool debugging(const char *scope
) DEPRECATED_ATTRIBUTE
;
103 inline void debug(const char *scope
, const char *format
, ...) DEPRECATED_ATTRIBUTE
;
104 inline void vdebug(const char *scope
, const char *format
, va_list args
) DEPRECATED_ATTRIBUTE
;
106 inline bool debugging(const char *scope
) { return false; }
107 inline void debug(const char *scope
, const char *format
, ...) { }
108 inline void vdebug(const char *scope
, const char *format
, va_list args
) { }
114 } // end namespace Debug
115 } // end namespace Security
117 // leak debug() into the global namespace because URLAccess et al rely on that
118 using Security::Debug::debug
;
123 // Include DTrace static probe definitions
125 typedef const void *DTException
;
126 #include <security_utilities/utilities_dtrace.h>
128 // The following are deprecated functions. Don't use them (but they need to be here for symbol reasons).
129 __attribute__((visibility("default"))) void secdebug_internal(const char* scope
, const char* format
, ...);
130 __attribute__((visibility("default"))) void secdebugfunc_internal(const char* scope
, const char* functionname
, const char* format
, ...);
140 #include <CoreFoundation/CFString.h>
143 #endif //_H_DEBUGGING