Improved the seeding algorithm. Old behaviour can be achived by setting
[platform/upstream/glib.git] / docs / reference / glib / running.sgml
1 <refentry id="glib-running" revision="17 Jan 2002">
2 <refmeta>
3 <refentrytitle>Running GLib Applications</refentrytitle>
4 <manvolnum>3</manvolnum>
5 <refmiscinfo>GLib Library</refmiscinfo>
6 </refmeta>
7
8 <refnamediv>
9 <refname>Running GLib Applications</refname>
10 <refpurpose>
11 How to run and debug your GLib application
12 </refpurpose>
13 </refnamediv>
14
15 <refsect1>
16 <title>Running and debugging GLib Applications</title>
17
18 <refsect2>
19 <title>Environment variables</title>
20
21 <para> 
22 GLib inspects a few of environment variables in addition to standard
23 variables like <envar>LANG</envar>, <envar>PATH</envar> or <envar>HOME</envar>. 
24 </para>
25
26 <formalpara>
27   <title><envar>G_BROKEN_FILENAMES</envar></title>
28
29   <para>
30     If this environment variable is set, GLib assumes that filenames are in 
31     the locale encoding rather than in UTF-8.
32   </para>
33 </formalpara>
34
35 <formalpara>
36   <title><envar>G_MESSAGES_PREFIXED</envar></title>
37
38   <para>
39     A list of log levels for which messages should be prefixed by the 
40     program name and PID of the application. The default is to prefix
41     everything except <literal>G_LOG_LEVEL_MESSAGE</literal> and <literal>G_LOG_LEVEL_INFO</literal>. 
42   </para>
43 </formalpara>
44
45 <formalpara>
46   <title><envar>G_DEBUG</envar></title>
47
48   <para>
49     If GLib has been configured with <option>--enable-debug=yes</option>,
50     this variable can be set to a list of debug options, which cause GLib
51     to print out different types of debugging information.
52     <variablelist>
53       <varlistentry>
54         <term>fatal_warnings</term>
55         <listitem><para>Causes GLib to abort the program at the first call
56            to <link linkend="g-warning">g_warning</link>(). This option is 
57            special in that it doesn't require GLib to be configured with 
58            debugging support.</para>
59         </listitem>
60       </varlistentry>
61     </variablelist>
62   </para>
63 </formalpara>
64
65 <formalpara>
66   <title><envar>G_RANDOM_VERSION</envar></title>
67
68   <para>
69     If this environment variable is set to '2.0', the outdated
70     pseudo-random number seeding algorithm from GLib-2.0 is used
71     instead of the new better one. Use the GLib-2.0 algorithm only if
72     you have sequences of numbers generated with Glib-2.0 that you
73     need to reproduce exactly.
74   </para> 
75 </formalpara> 
76 </refsect2>
77
78 <refsect2>
79 <title>Traps and traces</title>
80
81 <para>
82 Some code portions contain trap variables that can be set during debugging 
83 time if GLib has been configured with <option>--enable-debug=yes</option>. 
84 Such traps lead to immediate code halts to examine the current program state 
85 and backtrace.
86 </para>
87
88 <para>
89 Currently, the following trap variables exist:
90 <programlisting>
91 static volatile gulong g_trap_free_size;
92 static volatile gulong g_trap_realloc_size;
93 static volatile gulong g_trap_malloc_size;
94 </programlisting>
95 If set to a size > 0, <link linkend="g-free">g_free</link>(), 
96 <link linkend="g-realloc">g_realloc</link>() and 
97 <link linkend="g-malloc">g_malloc</link>() will be intercepted if the size 
98 matches the size of the corresponding memory block. This will only work with 
99 <literal>g_mem_set_vtable (glib_mem_profiler_table)</literal> upon startup 
100 though, because memory profiling is required to match on the memory block sizes.
101 </para>
102 </refsect2>
103
104 </refsect1>
105
106 </refentry>