-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDebugging-Tools.html
261 lines (245 loc) · 15.9 KB
/
Debugging-Tools.html
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<!-- HTML header for doxygen 1.8.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6-nimbuskit"/>
<title>NimbusKit: Debugging Tools</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="appledocs.css" rel="stylesheet" type="text/css"/>
<link href="nimbuskit.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-24278774-1']);
_gaq.push(['_setDomainName', 'nimbuskit.info']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<a href="index.html"><img style="float:left" src="nimbus128.png" width="80" height="80" /></a>
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">NimbusKit
 <span id="projectnumber">1.2.1 - <a href="http://github.com/jverkoey/nimbus">Fork Nimbus on Github</a> - <a href="http://wiki.nimbuskit.info/">Visit the Nimbus Wiki</a></span>
</div>
<div id="projectbrief">The iOS framework that grows only as fast as its documentation</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6-nimbuskit -->
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('Debugging-Tools.html','');});
</script>
<div id="doc-content">
<div class="header">
<div class="summary">
<a href="#define-members">Macros</a> |
<a href="#func-members">Functions</a> |
<a href="#var-members">Variables</a> </div>
<div class="headertitle">
<div class="title">Debugging Tools<div class="ingroups"><a class="el" href="NimbusCore.html">Nimbus Core</a></div></div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:gNIDPRINT"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="Debugging-Tools.html#gNIDPRINT">NIDPRINT</a>(xx,...)   NSLog(@"%s(%d): " xx, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)</td></tr>
<tr class="separator:gNIDPRINT"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gNIDPRINTMETHODNAME"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="Debugging-Tools.html#gNIDPRINTMETHODNAME">NIDPRINTMETHODNAME</a>()   <a class="el" href="Debugging-Tools.html#gNIDPRINT">NIDPRINT</a>(@"%s", __PRETTY_FUNCTION__)</td></tr>
<tr class="separator:gNIDPRINTMETHODNAME"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gNIDCONDITIONLOG"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="Debugging-Tools.html#gNIDCONDITIONLOG">NIDCONDITIONLOG</a>(condition, xx,...)</td></tr>
<tr class="separator:gNIDCONDITIONLOG"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gNIDERROR"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="Debugging-Tools.html#gNIDERROR">NIDERROR</a>(xx,...)   <a class="el" href="Debugging-Tools.html#gNIDCONDITIONLOG">NIDCONDITIONLOG</a>((NILOGLEVEL_ERROR <= <a class="el" href="Debugging-Tools.html#gNIMaxLogLevel">NIMaxLogLevel</a>), xx, ##__VA_ARGS__)</td></tr>
<tr class="separator:gNIDERROR"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gNIDWARNING"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="Debugging-Tools.html#gNIDWARNING">NIDWARNING</a>(xx,...)</td></tr>
<tr class="separator:gNIDWARNING"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gNIDINFO"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="Debugging-Tools.html#gNIDINFO">NIDINFO</a>(xx,...)   <a class="el" href="Debugging-Tools.html#gNIDCONDITIONLOG">NIDCONDITIONLOG</a>((NILOGLEVEL_INFO <= <a class="el" href="Debugging-Tools.html#gNIMaxLogLevel">NIMaxLogLevel</a>), xx, ##__VA_ARGS__)</td></tr>
<tr class="separator:gNIDINFO"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gNIIsInDebugger"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="Debugging-Tools.html#gNIIsInDebugger">NIIsInDebugger</a> (void)</td></tr>
<tr class="separator:gNIIsInDebugger"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:gNIMaxLogLevel"><td class="memItemLeft" align="right" valign="top">NSInteger </td><td class="memItemRight" valign="bottom"><a class="el" href="Debugging-Tools.html#gNIMaxLogLevel">NIMaxLogLevel</a></td></tr>
<tr class="separator:gNIMaxLogLevel"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gNIDebugAssertionsShouldBreak"><td class="memItemLeft" align="right" valign="top">BOOL </td><td class="memItemRight" valign="bottom"><a class="el" href="Debugging-Tools.html#gNIDebugAssertionsShouldBreak">NIDebugAssertionsShouldBreak</a></td></tr>
<tr class="separator:gNIDebugAssertionsShouldBreak"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<p>For inspecting code and writing to logs in debug builds. </p>
<p>Nearly all of the following macros will only do anything if the DEBUG macro is defined. The recommended way to enable the debug tools is to specify DEBUG in the "Preprocessor Macros" field in your application's Debug target settings. Be careful not to set this for your release or app store builds because this will enable code that may cause your app to be rejected.</p>
<h2>Debug Assertions</h2>
<p>Debug assertions are a lightweight "sanity check". They won't crash the app, nor will they be included in release builds. They <em>will</em> halt the app's execution when debugging so that you can inspect the values that caused the failure.</p>
<div class="fragment"><div class="line">NIDASSERT(statement);</div>
</div><!-- fragment --><p>If <em>statement</em> is false, the statement will be written to the log and if a debugger is attached, the app will break on the assertion line.</p>
<h2>Debug Logging</h2>
<div class="fragment"><div class="line"><a class="code" href="Debugging-Tools.html#gNIDPRINT">NIDPRINT</a>(<span class="stringliteral">@"formatted log text %d"</span>, param1);</div>
</div><!-- fragment --><p>Print the given formatted text to the log.</p>
<div class="fragment"><div class="line"><a class="code" href="Debugging-Tools.html#gNIDPRINTMETHODNAME">NIDPRINTMETHODNAME</a>();</div>
</div><!-- fragment --><p>Print the current method name to the log.</p>
<div class="fragment"><div class="line"><a class="code" href="Debugging-Tools.html#gNIDCONDITIONLOG">NIDCONDITIONLOG</a>(statement, <span class="stringliteral">@"formatted log text %d"</span>, param1);</div>
</div><!-- fragment --><p>If statement is true, then the formatted text will be written to the log.</p>
<div class="fragment"><div class="line"><a class="code" href="Debugging-Tools.html#gNIDINFO">NIDINFO</a>/<a class="code" href="Debugging-Tools.html#gNIDWARNING">NIDWARNING</a>/<a class="code" href="Debugging-Tools.html#gNIDERROR">NIDERROR</a>(<span class="stringliteral">@"formatted log text %d"</span>, param1);</div>
</div><!-- fragment --><p>Will only write the formatted text to the log if NIMaxLogLevel is greater than the respective NID* method's log level. See below for log levels.</p>
<p>The default maximum log level is NILOGLEVEL_WARNING.</p>
<h3>Turning up the log level while the app is running</h3>
<p>NIMaxLogLevel is declared a non-const extern so that you can modify it at runtime. This can be helpful for turning logging on while the application is running.</p>
<div class="fragment"><div class="line"><a class="code" href="Debugging-Tools.html#gNIMaxLogLevel">NIMaxLogLevel</a> = NILOGLEVEL_INFO;</div>
</div><!-- fragment --> <h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="gNIDPRINT"></a>
<div class="memitem">
<h3 class="memname">NIDPRINT   NSLog(@"%s(%d): " xx, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)</h3>
<div class="memdoc">
<p class="abstract">Only writes to the log when DEBUG is defined. </p>
<div class="declaration">
#define NIDPRINT;</td></tr>
</div>
<h5>Discussion</h5>
<p>This log method will always write to the log, regardless of log levels. It is used by all of the other logging methods in Nimbus' debugging library. </p>
</div>
</div>
<a class="anchor" id="gNIDPRINTMETHODNAME"></a>
<div class="memitem">
<h3 class="memname">NIDPRINTMETHODNAME   <a class="el" href="Debugging-Tools.html#gNIDPRINT">NIDPRINT</a>(@"%s", __PRETTY_FUNCTION__)</h3>
<div class="memdoc">
<p class="abstract">Write the containing method's name to the log using NIDPRINT. </p>
<div class="declaration">
#define NIDPRINTMETHODNAME;</td></tr>
</div>
</div>
</div>
<a class="anchor" id="gNIDCONDITIONLOG"></a>
<div class="memitem">
<h3 class="memname">NIDCONDITIONLOG</h3>
<div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">{ <span class="keywordflow">if</span> ((condition)) { <a class="code" href="Debugging-Tools.html#gNIDPRINT">NIDPRINT</a>(xx, ##__VA_ARGS__); } \</div>
<div class="line">} ((void)0)</div>
<div class="ttc" id="Debugging-Tools_html_gNIDPRINT"><div class="ttname"><a href="Debugging-Tools.html#gNIDPRINT">NIDPRINT</a></div><div class="ttdeci">#define NIDPRINT(xx,...)</div><div class="ttdoc">Only writes to the log when DEBUG is defined. </div><div class="ttdef"><b>Definition:</b> <a href="NIDebuggingTools_8h_source.html#l00154">NIDebuggingTools.h:154</a></div></div>
</div><!-- fragment -->
<p class="abstract">Only writes to the log if condition is satisified. </p>
<div class="declaration">
#define NIDCONDITIONLOG;</td></tr>
</div>
<h5>Discussion</h5>
<p>This macro powers the level-based loggers. It can also be used for conditionally enabling families of logs. </p>
</div>
</div>
<a class="anchor" id="gNIDERROR"></a>
<div class="memitem">
<h3 class="memname">NIDERROR   <a class="el" href="Debugging-Tools.html#gNIDCONDITIONLOG">NIDCONDITIONLOG</a>((NILOGLEVEL_ERROR <= <a class="el" href="Debugging-Tools.html#gNIMaxLogLevel">NIMaxLogLevel</a>), xx, ##__VA_ARGS__)</h3>
<div class="memdoc">
<p class="abstract">Only writes to the log if NIMaxLogLevel >= NILOGLEVEL_ERROR. </p>
<div class="declaration">
#define NIDERROR;</td></tr>
</div>
</div>
</div>
<a class="anchor" id="gNIDWARNING"></a>
<div class="memitem">
<h3 class="memname">NIDWARNING</h3>
<div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line"><a class="code" href="Debugging-Tools.html#gNIDCONDITIONLOG">NIDCONDITIONLOG</a>((NILOGLEVEL_WARNING <= <a class="code" href="Debugging-Tools.html#gNIMaxLogLevel">NIMaxLogLevel</a>), \</div>
<div class="line">xx, ##__VA_ARGS__)</div>
<div class="ttc" id="Debugging-Tools_html_gNIMaxLogLevel"><div class="ttname"><a href="Debugging-Tools.html#gNIMaxLogLevel">NIMaxLogLevel</a></div><div class="ttdeci">NSInteger NIMaxLogLevel</div><div class="ttdoc">The maximum log level to output for Nimbus debug logs. </div><div class="ttdef"><b>Definition:</b> <a href="NIDebuggingTools_8m_source.html#l00024">NIDebuggingTools.m:24</a></div></div>
<div class="ttc" id="Debugging-Tools_html_gNIDCONDITIONLOG"><div class="ttname"><a href="Debugging-Tools.html#gNIDCONDITIONLOG">NIDCONDITIONLOG</a></div><div class="ttdeci">#define NIDCONDITIONLOG(condition, xx,...)</div><div class="ttdoc">Only writes to the log if condition is satisified. </div><div class="ttdef"><b>Definition:</b> <a href="NIDebuggingTools_8h_source.html#l00171">NIDebuggingTools.h:171</a></div></div>
</div><!-- fragment -->
<p class="abstract">Only writes to the log if NIMaxLogLevel >= NILOGLEVEL_WARNING. </p>
<div class="declaration">
#define NIDWARNING;</td></tr>
</div>
</div>
</div>
<a class="anchor" id="gNIDINFO"></a>
<div class="memitem">
<h3 class="memname">NIDINFO   <a class="el" href="Debugging-Tools.html#gNIDCONDITIONLOG">NIDCONDITIONLOG</a>((NILOGLEVEL_INFO <= <a class="el" href="Debugging-Tools.html#gNIMaxLogLevel">NIMaxLogLevel</a>), xx, ##__VA_ARGS__)</h3>
<div class="memdoc">
<p class="abstract">Only writes to the log if NIMaxLogLevel >= NILOGLEVEL_INFO. </p>
<div class="declaration">
#define NIDINFO;</td></tr>
</div>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="gNIIsInDebugger"></a>
<div class="memitem">
<h3 class="memname">NIIsInDebugger</h3>
<div class="memdoc">
<p class="abstract">Assertions that only fire when DEBUG is defined. </p>
<div class="declaration">
int NIIsInDebugger:;</td></tr>
</div>
<h5>Discussion</h5>
<p>An assertion is like a programmatic breakpoint. Use it for sanity checks to save headache while writing your code. </p>
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a class="anchor" id="gNIMaxLogLevel"></a>
<div class="memitem">
<h3 class="memname">NIMaxLogLevel</h3>
<div class="memdoc">
<p class="abstract">The maximum log level to output for Nimbus debug logs. </p>
<div class="declaration">
NSInteger NIMaxLogLevel;</td></tr>
</div>
<h5>Discussion</h5>
<p>This value may be changed at run-time.</p>
<p>The default value is NILOGLEVEL_WARNING. </p>
</div>
</div>
<a class="anchor" id="gNIDebugAssertionsShouldBreak"></a>
<div class="memitem">
<h3 class="memname">NIDebugAssertionsShouldBreak</h3>
<div class="memdoc">
<p class="abstract">Whether or not debug assertions should halt program execution like a breakpoint when they fail. </p>
<div class="declaration">
BOOL NIDebugAssertionsShouldBreak;</td></tr>
</div>
<h5>Discussion</h5>
<p>An example of when this is used is in unit tests, when failure cases are tested that will fire debug assertions.</p>
<p>The default value is YES. </p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.6-->
<!-- start footer part -->
<script type="text/javascript" src="widget.js"></script>
</body>
</html>