Moving files to packaging and extracing new tarball.
[profile/ivi/glib2.git] / docs / reference / glib / html / glib-Warnings-and-Assertions.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Message Output and Debugging Functions</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7 <link rel="home" href="index.html" title="GLib Reference Manual">
8 <link rel="up" href="glib-core.html" title="GLib Core Application Support">
9 <link rel="prev" href="glib-Error-Reporting.html" title="Error Reporting">
10 <link rel="next" href="glib-Message-Logging.html" title="Message Logging">
11 <meta name="generator" content="GTK-Doc V1.18 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
16 <tr valign="middle">
17 <td><a accesskey="p" href="glib-Error-Reporting.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18 <td><a accesskey="u" href="glib-core.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
19 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
20 <th width="100%" align="center">GLib Reference Manual</th>
21 <td><a accesskey="n" href="glib-Message-Logging.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
22 </tr>
23 <tr><td colspan="5" class="shortcuts">
24 <a href="#glib-Warnings-and-Assertions.synopsis" class="shortcut">Top</a>
25                    | 
26                   <a href="#glib-Warnings-and-Assertions.description" class="shortcut">Description</a>
27 </td></tr>
28 </table>
29 <div class="refentry">
30 <a name="glib-Warnings-and-Assertions"></a><div class="titlepage"></div>
31 <div class="refnamediv"><table width="100%"><tr>
32 <td valign="top">
33 <h2><span class="refentrytitle"><a name="glib-Warnings-and-Assertions.top_of_page"></a>Message Output and Debugging Functions</span></h2>
34 <p>Message Output and Debugging Functions — functions to output messages and help debug applications</p>
35 </td>
36 <td valign="top" align="right"></td>
37 </tr></table></div>
38 <div class="refsynopsisdiv">
39 <a name="glib-Warnings-and-Assertions.synopsis"></a><h2>Synopsis</h2>
40 <pre class="synopsis">
41 #include &lt;glib.h&gt;
42
43 <span class="returnvalue">void</span>                <a class="link" href="glib-Warnings-and-Assertions.html#g-print" title="g_print ()">g_print</a>                             (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format</code></em>,
44                                                          <em class="parameter"><code>...</code></em>);
45 <a class="link" href="glib-Warnings-and-Assertions.html#GPrintFunc" title="GPrintFunc ()"><span class="returnvalue">GPrintFunc</span></a>          <a class="link" href="glib-Warnings-and-Assertions.html#g-set-print-handler" title="g_set_print_handler ()">g_set_print_handler</a>                 (<em class="parameter"><code><a class="link" href="glib-Warnings-and-Assertions.html#GPrintFunc" title="GPrintFunc ()"><span class="type">GPrintFunc</span></a> func</code></em>);
46 <span class="returnvalue">void</span>                (<a class="link" href="glib-Warnings-and-Assertions.html#GPrintFunc" title="GPrintFunc ()">*GPrintFunc</a>)                       (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>);
47
48 <span class="returnvalue">void</span>                <a class="link" href="glib-Warnings-and-Assertions.html#g-printerr" title="g_printerr ()">g_printerr</a>                          (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format</code></em>,
49                                                          <em class="parameter"><code>...</code></em>);
50 <a class="link" href="glib-Warnings-and-Assertions.html#GPrintFunc" title="GPrintFunc ()"><span class="returnvalue">GPrintFunc</span></a>          <a class="link" href="glib-Warnings-and-Assertions.html#g-set-printerr-handler" title="g_set_printerr_handler ()">g_set_printerr_handler</a>              (<em class="parameter"><code><a class="link" href="glib-Warnings-and-Assertions.html#GPrintFunc" title="GPrintFunc ()"><span class="type">GPrintFunc</span></a> func</code></em>);
51
52 #define             <a class="link" href="glib-Warnings-and-Assertions.html#g-return-if-fail" title="g_return_if_fail()">g_return_if_fail</a>                    (expr)
53 #define             <a class="link" href="glib-Warnings-and-Assertions.html#g-return-val-if-fail" title="g_return_val_if_fail()">g_return_val_if_fail</a>                (expr,
54                                                          val)
55 #define             <a class="link" href="glib-Warnings-and-Assertions.html#g-return-if-reached" title="g_return_if_reached">g_return_if_reached</a>
56 #define             <a class="link" href="glib-Warnings-and-Assertions.html#g-return-val-if-reached" title="g_return_val_if_reached()">g_return_val_if_reached</a>             (val)
57 #define             <a class="link" href="glib-Warnings-and-Assertions.html#g-warn-if-fail" title="g_warn_if_fail()">g_warn_if_fail</a>                      (expr)
58 #define             <a class="link" href="glib-Warnings-and-Assertions.html#g-warn-if-reached" title="g_warn_if_reached">g_warn_if_reached</a>
59
60 <span class="returnvalue">void</span>                <a class="link" href="glib-Warnings-and-Assertions.html#g-on-error-query" title="g_on_error_query ()">g_on_error_query</a>                    (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *prg_name</code></em>);
61 <span class="returnvalue">void</span>                <a class="link" href="glib-Warnings-and-Assertions.html#g-on-error-stack-trace" title="g_on_error_stack_trace ()">g_on_error_stack_trace</a>              (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *prg_name</code></em>);
62
63 #define             <a class="link" href="glib-Warnings-and-Assertions.html#G-BREAKPOINT:CAPS" title="G_BREAKPOINT">G_BREAKPOINT</a>
64 </pre>
65 </div>
66 <div class="refsect1">
67 <a name="glib-Warnings-and-Assertions.description"></a><h2>Description</h2>
68 <p>
69 These functions provide support for outputting messages.
70 </p>
71 <p>
72 The <code class="function">g_return</code> family of macros (<a class="link" href="glib-Warnings-and-Assertions.html#g-return-if-fail" title="g_return_if_fail()"><code class="function">g_return_if_fail()</code></a>,
73 <a class="link" href="glib-Warnings-and-Assertions.html#g-return-val-if-fail" title="g_return_val_if_fail()"><code class="function">g_return_val_if_fail()</code></a>, <a class="link" href="glib-Warnings-and-Assertions.html#g-return-if-reached" title="g_return_if_reached"><code class="function">g_return_if_reached()</code></a>, <a class="link" href="glib-Warnings-and-Assertions.html#g-return-val-if-reached" title="g_return_val_if_reached()"><code class="function">g_return_val_if_reached()</code></a>)
74 should only be used for programming errors, a typical use case is
75 checking for invalid parameters at the beginning of a public function.
76 They should not be used if you just mean "if (error) return", they
77 should only be used if you mean "if (bug in program) return".
78 The program behavior is generally considered undefined after one
79 of these checks fails. They are not intended for normal control
80 flow, only to give a perhaps-helpful warning before giving up.
81 </p>
82 </div>
83 <div class="refsect1">
84 <a name="glib-Warnings-and-Assertions.details"></a><h2>Details</h2>
85 <div class="refsect2">
86 <a name="g-print"></a><h3>g_print ()</h3>
87 <pre class="programlisting"><span class="returnvalue">void</span>                g_print                             (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format</code></em>,
88                                                          <em class="parameter"><code>...</code></em>);</pre>
89 <p>
90 Outputs a formatted message via the print handler.
91 The default print handler simply outputs the message to stdout.
92 </p>
93 <p>
94 <a class="link" href="glib-Warnings-and-Assertions.html#g-print" title="g_print ()"><code class="function">g_print()</code></a> should not be used from within libraries for debugging
95 messages, since it may be redirected by applications to special
96 purpose message windows or even files. Instead, libraries should
97 use <a class="link" href="glib-Message-Logging.html#g-log" title="g_log ()"><code class="function">g_log()</code></a>, or the convenience functions <a class="link" href="glib-Message-Logging.html#g-message" title="g_message()"><code class="function">g_message()</code></a>, <a class="link" href="glib-Message-Logging.html#g-warning" title="g_warning()"><code class="function">g_warning()</code></a>
98 and <a class="link" href="glib-Message-Logging.html#g-error" title="g_error()"><code class="function">g_error()</code></a>.
99 </p>
100 <div class="variablelist"><table border="0">
101 <col align="left" valign="top">
102 <tbody>
103 <tr>
104 <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td>
105 <td>the message format. See the <code class="function">printf()</code> documentation</td>
106 </tr>
107 <tr>
108 <td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
109 <td>the parameters to insert into the format string</td>
110 </tr>
111 </tbody>
112 </table></div>
113 </div>
114 <hr>
115 <div class="refsect2">
116 <a name="g-set-print-handler"></a><h3>g_set_print_handler ()</h3>
117 <pre class="programlisting"><a class="link" href="glib-Warnings-and-Assertions.html#GPrintFunc" title="GPrintFunc ()"><span class="returnvalue">GPrintFunc</span></a>          g_set_print_handler                 (<em class="parameter"><code><a class="link" href="glib-Warnings-and-Assertions.html#GPrintFunc" title="GPrintFunc ()"><span class="type">GPrintFunc</span></a> func</code></em>);</pre>
118 <p>
119 Sets the print handler.
120 </p>
121 <p>
122 Any messages passed to <a class="link" href="glib-Warnings-and-Assertions.html#g-print" title="g_print ()"><code class="function">g_print()</code></a> will be output via
123 the new handler. The default handler simply outputs
124 the message to stdout. By providing your own handler
125 you can redirect the output, to a GTK+ widget or a
126 log file for example.
127 </p>
128 <div class="variablelist"><table border="0">
129 <col align="left" valign="top">
130 <tbody>
131 <tr>
132 <td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
133 <td>the new print handler</td>
134 </tr>
135 <tr>
136 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
137 <td>the old print handler</td>
138 </tr>
139 </tbody>
140 </table></div>
141 </div>
142 <hr>
143 <div class="refsect2">
144 <a name="GPrintFunc"></a><h3>GPrintFunc ()</h3>
145 <pre class="programlisting"><span class="returnvalue">void</span>                (*GPrintFunc)                       (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *string</code></em>);</pre>
146 <p>
147 Specifies the type of the print handler functions.
148 These are called with the complete formatted string to output.
149 </p>
150 <div class="variablelist"><table border="0">
151 <col align="left" valign="top">
152 <tbody><tr>
153 <td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td>
154 <td>the message to output</td>
155 </tr></tbody>
156 </table></div>
157 </div>
158 <hr>
159 <div class="refsect2">
160 <a name="g-printerr"></a><h3>g_printerr ()</h3>
161 <pre class="programlisting"><span class="returnvalue">void</span>                g_printerr                          (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *format</code></em>,
162                                                          <em class="parameter"><code>...</code></em>);</pre>
163 <p>
164 Outputs a formatted message via the error message handler.
165 The default handler simply outputs the message to stderr.
166 </p>
167 <p>
168 <a class="link" href="glib-Warnings-and-Assertions.html#g-printerr" title="g_printerr ()"><code class="function">g_printerr()</code></a> should not be used from within libraries.
169 Instead <a class="link" href="glib-Message-Logging.html#g-log" title="g_log ()"><code class="function">g_log()</code></a> should be used, or the convenience functions
170 <a class="link" href="glib-Message-Logging.html#g-message" title="g_message()"><code class="function">g_message()</code></a>, <a class="link" href="glib-Message-Logging.html#g-warning" title="g_warning()"><code class="function">g_warning()</code></a> and <a class="link" href="glib-Message-Logging.html#g-error" title="g_error()"><code class="function">g_error()</code></a>.
171 </p>
172 <div class="variablelist"><table border="0">
173 <col align="left" valign="top">
174 <tbody>
175 <tr>
176 <td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td>
177 <td>the message format. See the <code class="function">printf()</code> documentation</td>
178 </tr>
179 <tr>
180 <td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
181 <td>the parameters to insert into the format string</td>
182 </tr>
183 </tbody>
184 </table></div>
185 </div>
186 <hr>
187 <div class="refsect2">
188 <a name="g-set-printerr-handler"></a><h3>g_set_printerr_handler ()</h3>
189 <pre class="programlisting"><a class="link" href="glib-Warnings-and-Assertions.html#GPrintFunc" title="GPrintFunc ()"><span class="returnvalue">GPrintFunc</span></a>          g_set_printerr_handler              (<em class="parameter"><code><a class="link" href="glib-Warnings-and-Assertions.html#GPrintFunc" title="GPrintFunc ()"><span class="type">GPrintFunc</span></a> func</code></em>);</pre>
190 <p>
191 Sets the handler for printing error messages.
192 </p>
193 <p>
194 Any messages passed to <a class="link" href="glib-Warnings-and-Assertions.html#g-printerr" title="g_printerr ()"><code class="function">g_printerr()</code></a> will be output via
195 the new handler. The default handler simply outputs the
196 message to stderr. By providing your own handler you can
197 redirect the output, to a GTK+ widget or a log file for
198 example.
199 </p>
200 <div class="variablelist"><table border="0">
201 <col align="left" valign="top">
202 <tbody>
203 <tr>
204 <td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
205 <td>the new error message handler</td>
206 </tr>
207 <tr>
208 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
209 <td>the old error message handler</td>
210 </tr>
211 </tbody>
212 </table></div>
213 </div>
214 <hr>
215 <div class="refsect2">
216 <a name="g-return-if-fail"></a><h3>g_return_if_fail()</h3>
217 <pre class="programlisting">#define             g_return_if_fail(expr)</pre>
218 <p>
219 Verifies that the expression evaluates to <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.  If the expression
220 evaluates to <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>, a critical message is logged and the current
221 function returns.  This can only be used in functions which do not
222 return a value.
223 </p>
224 <p>
225 If G_DISABLE_CHECKS is defined then the check is not performed.  You
226 should therefore not depend on any side effects of <em class="parameter"><code>expr</code></em>.
227 </p>
228 <div class="variablelist"><table border="0">
229 <col align="left" valign="top">
230 <tbody><tr>
231 <td><p><span class="term"><em class="parameter"><code>expr</code></em> :</span></p></td>
232 <td>the expression to check</td>
233 </tr></tbody>
234 </table></div>
235 </div>
236 <hr>
237 <div class="refsect2">
238 <a name="g-return-val-if-fail"></a><h3>g_return_val_if_fail()</h3>
239 <pre class="programlisting">#define             g_return_val_if_fail(expr,val)</pre>
240 <p>
241 Verifies that the expression evaluates to <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.  If the expression
242 evaluates to <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>, a critical message is logged and <em class="parameter"><code>val</code></em> is
243 returned from the current function.
244 </p>
245 <p>
246 If G_DISABLE_CHECKS is defined then the check is not performed.  You
247 should therefore not depend on any side effects of <em class="parameter"><code>expr</code></em>.
248 </p>
249 <div class="variablelist"><table border="0">
250 <col align="left" valign="top">
251 <tbody>
252 <tr>
253 <td><p><span class="term"><em class="parameter"><code>expr</code></em> :</span></p></td>
254 <td>the expression to check</td>
255 </tr>
256 <tr>
257 <td><p><span class="term"><em class="parameter"><code>val</code></em> :</span></p></td>
258 <td>the value to return from the current function
259 if the expression is not true</td>
260 </tr>
261 </tbody>
262 </table></div>
263 </div>
264 <hr>
265 <div class="refsect2">
266 <a name="g-return-if-reached"></a><h3>g_return_if_reached</h3>
267 <pre class="programlisting">#define             g_return_if_reached()</pre>
268 <p>
269 Logs a critical message and returns from the current function.
270 This can only be used in functions which do not return a value.
271 </p>
272 </div>
273 <hr>
274 <div class="refsect2">
275 <a name="g-return-val-if-reached"></a><h3>g_return_val_if_reached()</h3>
276 <pre class="programlisting">#define             g_return_val_if_reached(val)</pre>
277 <p>
278 Logs a critical message and returns <em class="parameter"><code>val</code></em>.
279 </p>
280 <div class="variablelist"><table border="0">
281 <col align="left" valign="top">
282 <tbody><tr>
283 <td><p><span class="term"><em class="parameter"><code>val</code></em> :</span></p></td>
284 <td>the value to return from the current function</td>
285 </tr></tbody>
286 </table></div>
287 </div>
288 <hr>
289 <div class="refsect2">
290 <a name="g-warn-if-fail"></a><h3>g_warn_if_fail()</h3>
291 <pre class="programlisting">#define             g_warn_if_fail(expr)</pre>
292 <p>
293 Logs a warning if the expression is not true.
294 </p>
295 <div class="variablelist"><table border="0">
296 <col align="left" valign="top">
297 <tbody><tr>
298 <td><p><span class="term"><em class="parameter"><code>expr</code></em> :</span></p></td>
299 <td>the expression to check</td>
300 </tr></tbody>
301 </table></div>
302 <p class="since">Since 2.16</p>
303 </div>
304 <hr>
305 <div class="refsect2">
306 <a name="g-warn-if-reached"></a><h3>g_warn_if_reached</h3>
307 <pre class="programlisting">#define             g_warn_if_reached()</pre>
308 <p>
309 Logs a critical warning.
310 </p>
311 <p class="since">Since 2.16</p>
312 </div>
313 <hr>
314 <div class="refsect2">
315 <a name="g-on-error-query"></a><h3>g_on_error_query ()</h3>
316 <pre class="programlisting"><span class="returnvalue">void</span>                g_on_error_query                    (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *prg_name</code></em>);</pre>
317 <p>
318 Prompts the user with
319 <code class="computeroutput">[E]xit, [H]alt, show [S]tack trace or [P]roceed</code>.
320 This function is intended to be used for debugging use only.
321 The following example shows how it can be used together with
322 the <a class="link" href="glib-Message-Logging.html#g-log" title="g_log ()"><code class="function">g_log()</code></a> functions.
323 </p>
324 <p>
325 </p>
326 <div class="informalexample">
327   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
328     <tbody>
329       <tr>
330         <td class="listing_lines" align="right"><pre>1
331 2
332 3
333 4
334 5
335 6
336 7
337 8
338 9
339 10
340 11
341 12
342 13
343 14
344 15
345 16
346 17
347 18
348 19
349 20
350 21
351 22
352 23</pre></td>
353         <td class="listing_code"><pre class="programlisting"><span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;glib.h&gt;</span>
354
355 <span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
356 <span class="function">log_handler</span><span class="normal"> </span><span class="symbol">(</span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">   </span><span class="symbol">*</span><span class="normal">log_domain</span><span class="symbol">,</span>
357 <span class="normal">             </span><span class="usertype">GLogLevelFlags</span><span class="normal"> log_level</span><span class="symbol">,</span>
358 <span class="normal">             </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">   </span><span class="symbol">*</span><span class="normal">message</span><span class="symbol">,</span>
359 <span class="normal">             </span><span class="usertype">gpointer</span><span class="normal">       user_data</span><span class="symbol">)</span>
360 <span class="cbracket">{</span>
361 <span class="normal">  </span><span class="function"><a href="glib-Message-Logging.html#g-log-default-handler">g_log_default_handler</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">log_domain</span><span class="symbol">,</span><span class="normal"> log_level</span><span class="symbol">,</span><span class="normal"> message</span><span class="symbol">,</span><span class="normal"> user_data</span><span class="symbol">);</span>
362
363 <span class="normal">  </span><span class="function"><a href="glib-Warnings-and-Assertions.html#g-on-error-query">g_on_error_query</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">MY_PROGRAM_NAME</span><span class="symbol">);</span>
364 <span class="cbracket">}</span>
365
366 <span class="type">int</span>
367 <span class="function">main</span><span class="normal"> </span><span class="symbol">(</span><span class="type">int</span><span class="normal"> argc</span><span class="symbol">,</span><span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">argv</span><span class="symbol">[])</span>
368 <span class="cbracket">{</span>
369 <span class="normal">  </span><span class="function"><a href="glib-Message-Logging.html#g-log-set-handler">g_log_set_handler</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">MY_LOG_DOMAIN</span><span class="symbol">,</span>
370 <span class="normal">                     <a href="glib-Message-Logging.html#G-LOG-LEVEL-WARNING:CAPS">G_LOG_LEVEL_WARNING</a> </span><span class="symbol">|</span>
371 <span class="normal">                     <a href="glib-Message-Logging.html#G-LOG-LEVEL-ERROR:CAPS">G_LOG_LEVEL_ERROR</a> </span><span class="symbol">|</span>
372 <span class="normal">                     <a href="glib-Message-Logging.html#G-LOG-LEVEL-CRITICAL:CAPS">G_LOG_LEVEL_CRITICAL</a></span><span class="symbol">,</span>
373 <span class="normal">                     log_handler</span><span class="symbol">,</span>
374 <span class="normal">                     <a href="glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
375 <span class="normal">  </span><span class="comment">/* ... */</span></pre></td>
376       </tr>
377     </tbody>
378   </table>
379 </div>
380
381 <p>
382 </p>
383 <p>
384 If [E]xit is selected, the application terminates with a call
385 to <code class="literal">_exit(0)</code>.
386 </p>
387 <p>
388 If [S]tack trace is selected, <a class="link" href="glib-Warnings-and-Assertions.html#g-on-error-stack-trace" title="g_on_error_stack_trace ()"><code class="function">g_on_error_stack_trace()</code></a> is called.
389 This invokes <span class="command"><strong>gdb</strong></span>, which attaches to the current
390 process and shows a stack trace. The prompt is then shown again.
391 </p>
392 <p>
393 If [P]roceed is selected, the function returns.
394 </p>
395 <p>
396 This function may cause different actions on non-UNIX platforms.
397 </p>
398 <div class="variablelist"><table border="0">
399 <col align="left" valign="top">
400 <tbody><tr>
401 <td><p><span class="term"><em class="parameter"><code>prg_name</code></em> :</span></p></td>
402 <td>the program name, needed by <span class="command"><strong>gdb</strong></span>
403 for the [S]tack trace option. If <em class="parameter"><code>prg_name</code></em> is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, <a class="link" href="glib-Miscellaneous-Utility-Functions.html#g-get-prgname" title="g_get_prgname ()"><code class="function">g_get_prgname()</code></a>
404 is called to get the program name (which will work correctly if
405 <a href="http://library.gnome.org/devel/gdk/gdk3-General.html#gdk-init"><code class="function">gdk_init()</code></a> or <a href="http://library.gnome.org/devel/gtk/gtk3-General.html#gtk-init"><code class="function">gtk_init()</code></a> has been called)</td>
406 </tr></tbody>
407 </table></div>
408 </div>
409 <hr>
410 <div class="refsect2">
411 <a name="g-on-error-stack-trace"></a><h3>g_on_error_stack_trace ()</h3>
412 <pre class="programlisting"><span class="returnvalue">void</span>                g_on_error_stack_trace              (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *prg_name</code></em>);</pre>
413 <p>
414 Invokes <span class="command"><strong>gdb</strong></span>, which attaches to the current
415 process and shows a stack trace. Called by <a class="link" href="glib-Warnings-and-Assertions.html#g-on-error-query" title="g_on_error_query ()"><code class="function">g_on_error_query()</code></a>
416 when the [S]tack trace option is selected. You can get the current
417 process's "program name" with <a class="link" href="glib-Miscellaneous-Utility-Functions.html#g-get-prgname" title="g_get_prgname ()"><code class="function">g_get_prgname()</code></a>, assuming that you
418 have called <a href="http://library.gnome.org/devel/gtk/gtk3-General.html#gtk-init"><code class="function">gtk_init()</code></a> or <a href="http://library.gnome.org/devel/gdk/gdk3-General.html#gdk-init"><code class="function">gdk_init()</code></a>.
419 </p>
420 <p>
421 This function may cause different actions on non-UNIX platforms.
422 </p>
423 <div class="variablelist"><table border="0">
424 <col align="left" valign="top">
425 <tbody><tr>
426 <td><p><span class="term"><em class="parameter"><code>prg_name</code></em> :</span></p></td>
427 <td>the program name, needed by <span class="command"><strong>gdb</strong></span>
428 for the [S]tack trace option.</td>
429 </tr></tbody>
430 </table></div>
431 </div>
432 <hr>
433 <div class="refsect2">
434 <a name="G-BREAKPOINT:CAPS"></a><h3>G_BREAKPOINT</h3>
435 <pre class="programlisting">#  define G_BREAKPOINT()        G_STMT_START{ __asm__ __volatile__ ("int $03"); }G_STMT_END
436 </pre>
437 <p>
438 Inserts a breakpoint instruction into the code.
439 </p>
440 <p>
441 On x86 and alpha systems this is implemented as a soft interrupt
442 and on other architectures it raises a <code class="literal">SIGTRAP</code> signal.
443 </p>
444 </div>
445 </div>
446 </div>
447 <div class="footer">
448 <hr>
449           Generated by GTK-Doc V1.18</div>
450 </body>
451 </html>