[xml] gdb hint and debugXML.c patch
- From: "Oleg A. Paraschenko" <olpa xmlhack ru>
- To: libxml mail list <xml gnome org>
- Subject: [xml] gdb hint and debugXML.c patch
- Date: Wed, 7 Sep 2005 01:44:02 +0400
Hello,
probably it's well known, but I'd like to share useful gdb
settings. From my ~/.gdbinit:
<code>
define xp
call xmlDebugDumpNode(stdout, $arg0, 0)
end
document xp
Executes xmlDebugDumpNode(stdout, arg, 0).
Use also:
xmlDebugDumpOneNode
xmlDebugDumpNodeList
xmlDebugDumpDocument
end
</code>
Now, debugging in gdb, it's possible to dump a variable as
an XML node:
<screen>
(gdb) cont
Breakpoint 2, xmlFreeNode (cur=0x8051760) at tree.c:3333
3333 xmlDictPtr dict = NULL;
(gdb) help xp
Executes xmlDebugDumpNode(stdout, arg, 0).
Use also:
xmlDebugDumpOneNode
xmlDebugDumpNodeList
xmlDebugDumpDocument
(gdb) xp cur
TEXT
content=
test.xsl:0: error : Node has no parent
</screen>
---
Unfortunately, xmlDebugDumpNode crashes when the argument
is a namespace node. The following fixes the problem.
$ cvs diff debugXML.c
Index: debugXML.c
===================================================================
RCS file: /cvs/gnome/libxml2/debugXML.c,v
retrieving revision 1.110
diff -r1.110 debugXML.c
1068c1068
< if ((node->children != NULL) && (node->type != XML_ENTITY_REF_NODE)) {
---
if ((node->type != XML_NAMESPACE_DECL) && (node->children != NULL) && (node->type !=
XML_ENTITY_REF_NODE)) {
--
Oleg Paraschenko olpa@ http://xmlhack.ru/ XML news in Russian
http://uucode.com/blog/ Generative Programming, XML, TeX, Scheme
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]