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
|
<section id="debugging">
<sectioninfo>
<title>Debugging xmlroff</title>
<abstract><para>Debugging xmlroff</para></abstract>
</sectioninfo>
<section id="command-line">
<title>Command Line</title>
<section id="dump-fo-tree">
<title>-d2 command line switch dumps FO tree</title>
<para>Each node shows its type [FoTree], its address [0x82a0698], and its reference count [1].</para>
<para>Values of the node's properties (GObject properties, which mostly correspond to XSL properties) are shown indented underneath the node information.</para>
<para>Properties of the node's parent type (and that type's parent type, etc.) are shown indented relative to the properties of the node's type.</para>
<programlisting>[xmlroff]$ ./xmlroff -d2 xmlroff.fo
(process:16930): libfo-DEBUG: FoTree (0x82a0698 : 1)
(process:16930): libfo-DEBUG: default-master: 0x82c7530
(process:16930): libfo-DEBUG: master-name hash:
(process:16930): libfo-DEBUG: first : 0x82c7530
(process:16930): libfo-DEBUG: page-sequence-master-name hash:
(process:16930): libfo-DEBUG: generate-reference-area: FALSE
(process:16930): libfo-DEBUG: allow-mixed-content: FALSE
(process:16930): libfo-DEBUG: element: (nil)
(process:16930): libfo-DEBUG: context: 0x82a6d48
(process:16930): libfo-DEBUG: areas:
(process:16930): libfo-DEBUG: 0x82c6a40
(process:16930): libfo-DEBUG: root (0x82c6c00 : 1)
(process:16930): libfo-DEBUG: media-usage (0x82bd838 : 72)
(process:16930): libfo-DEBUG: FoEnum (0x82be270 : 2) : auto
(process:16930): libfo-DEBUG: generate-reference-area: FALSE
(process:16930): libfo-DEBUG: allow-mixed-content: FALSE
(process:16930): libfo-DEBUG: element: 0x82a8e68
(process:16930): libfo-DEBUG: context: 0x82dfd48
(process:16930): libfo-DEBUG: areas:
(process:16930): libfo-DEBUG: (none)
...</programlisting>
</section>
<section id="dump-area-tree">
<title>-d4 command line switch dumps area tree</title>
<programlisting>[xmlroff]$ ./xmlroff -d4 xmlroff.fo
(process:16932): libfo-DEBUG: FoAreaTree (0x82c6a40 : 1)
(process:16932): libfo-DEBUG: context: 0x82c6a90
(process:16932): libfo-DEBUG: is-first: true
(process:16932): libfo-DEBUG: prev-part: (null)
(process:16932): libfo-DEBUG: is-last: true
(process:16932): libfo-DEBUG: next-part: (null)
(process:16932): libfo-DEBUG: next-x: 0 pt
(process:16932): libfo-DEBUG: next-y: 0 pt
(process:16932): libfo-DEBUG: available-width: 0 pt
(process:16932): libfo-DEBUG: available-height: 0 pt
(process:16932): libfo-DEBUG: child-available-ipdim: 0 pt
(process:16932): libfo-DEBUG: child-available-bpdim: 0 pt
(process:16932): libfo-DEBUG: generated-by: (null)
(process:16932): libfo-DEBUG: reference: (null)
(process:16932): libfo-DEBUG: page: (null)
(process:16932): libfo-DEBUG: FoAreaPage (0x82e4300 : 2)
(process:16932): libfo-DEBUG: page-number: 1
(process:16932): libfo-DEBUG: page-width: 576 pt
(process:16932): libfo-DEBUG: page-height: 792 pt
(process:16932): libfo-DEBUG: margin-top: 72 pt
(process:16932): libfo-DEBUG: margin-bottom: 72 pt
(process:16932): libfo-DEBUG: margin-left: 72 pt
(process:16932): libfo-DEBUG: margin-right: 72 pt
(process:16932): libfo-DEBUG: bpd: 3
(process:16932): libfo-DEBUG: ipd: 1
(process:16932): libfo-DEBUG: sd: 4
(process:16932): libfo-DEBUG: x: 0 pt
(process:16932): libfo-DEBUG: y: 0 pt
(process:16932): libfo-DEBUG: width: 0 pt
(process:16932): libfo-DEBUG: height: 0 pt
...</programlisting>
</section>
<section id="dump-pango-info">
<title>-d8 command line switch dumps PangoAttribute information</title>
<programlisting>[xmlroff]$ ./xmlroff -d8 xmlroff.fo
(process:16933): libfo-DEBUG: get_text_attr_list:: block text: 'xmlroff ? Sun xmlroff XSL Formatter'
(process:16933): libfo-DEBUG: get_text_attr_list:: attr_glist: 0x82aa650
(process:16933): libfo-DEBUG: get_text_attr_list:: attr_glist length: 26
(process:16933): libfo-DEBUG: dump_attr_list:: String:
(process:16933): libfo-DEBUG: dump_attr_list:: start: 0; end: 7
(process:16933): libfo-DEBUG: dump_attr_list:: start: 7; end: 37
(process:16933): libfo-DEBUG: dump_attr_list:: start: 37; end: 2147483647
(process:16933): libfo-DEBUG: dump_attr_list:: Font family:
(process:16933): libfo-DEBUG: dump_attr_list:: start: 0; end: 7; family: mono
(process:16933): libfo-DEBUG: dump_attr_list:: start: 7; end: 37; family: sans-serif
(process:16933): libfo-DEBUG: dump_attr_list:: Font size:
(process:16933): libfo-DEBUG: dump_attr_list:: start: 0; end: 7; size: 10
(process:16933): libfo-DEBUG: dump_attr_list:: start: 7; end: 37; size: 10
...</programlisting>
</section>
<section id="fatal-critical">
<title>Aborting on critical log message</title>
<para>xmlroff often gives "CRITICAL" error messages when something goes wrong. For example:</para>
<literallayout><computeroutput>(xmlroff:4384): libfo-CRITICAL **:
fo_area_area_split_before_height_check: assertion `max_height > 0'
failed</computeroutput></literallayout>
<para>If you want to abort on the critical error so you can use a debugger on the core file, according to <ulink url="http://library.gnome.org/devel/glib/stable/glib-running.html">http://library.gnome.org/devel/glib/stable/glib-running.html</ulink>, if you set G_DEBUG=fatal-critical, xmlroff should abort.</para>
</section>
</section>
<section id="using-gdb">
<title>Using GDB or other debugger</title>
<section id="statically-linked">
<title>Statically link xmlroff</title>
<para>GDB, at least, has more to work with when you build a statically linked xmlroff executable.</para>
<para>Add --enable-static --disable-shared to the configure.in (or autogen.sh if building from CVS) command line.</para>
</section>
<section id="break-on">
<title>Break on g_log</title>
<para>If you are getting an error message and you can't work out what's causing it, break on g_log so you break just before the message is emitted.</para>
<para>After the break, you can go up several stack frames to where g_error (or similar) is called.</para>
<para>By going up enough stack frames, you can usually work out what property or what FO experienced the error.</para>
<para>Note that you should disable the breakpoint on g_log if you are going to interactively call any functions that use g_log.</para>
</section>
<section id="interactive-debug">
<title>Functions useful when debugging interatively</title>
<variablelist>
<varlistentry>
<term>fo_object_sprintf(object)</term>
<listitem><para>The 'nice' printout of the object.</para></listitem>
</varlistentry>
<varlistentry>
<term>fo_object_debug_sprintf(object)</term>
<listitem><para>The 'nice' printout of the object plus its adress and reference count.</para></listitem>
</varlistentry>
<varlistentry>
<term>fo_object_debug_dump(object,indent)</term>
<listitem><para>Dump everything about the object and its descendants (if it's part of a tree, that is).</para></listitem>
</varlistentry>
<varlistentry>
<term>fo_node_path_to_root_sprintf(node)</term>
<listitem><para>Print XPath-like locator for node.</para></listitem>
</varlistentry>
<varlistentry>
<term>fo_node_debug_dump_tree(node)</term>
<listitem><para>Dumps just the FoNode objects, not their properties, in the tree rooted at node.</para></listitem>
</varlistentry>
</variablelist>
</section>
</section>
</section>
|