Вопрос

I'm posting an edited question since the whole business of segfaults and third-party libraries in the original question are just distracting.

What I have is a program that uses xerces-c and segfaults (creating a core-dump in the process). What I want to do is to fire up gdb and traverse the created DOMDocument from the core-dump.

e.g., I want to get the attributes of a given DOMElement or it's children nodes and so on. Does anyone have any articles I can read up for this that describe the internal structure of DOMElements and so on? Or even point me to some resources on the xerces-c source code since I've been unable to find the source code for DOMElement in my source tarball. (Having the source code might help since then I know exactly how DOMElement is implemented allowing me to traverse it).

As I said, I'm not too familiar with the xerces-c codebase and apache documentation is patently horrible.

Original Question:-

I'm using an third-party library that in turn uses xercesc for xml parsing somewhere which is segfaulting. How do I inspect xerces-c elements from the core-dump?

I have access to the library source code and it's segfaulting in a function that uses a DOMElement reference as a function argument. Something like

void func (DOMElement& e, ...) {
}

I want to inspect this DOMElement from the core-dump (as in print out it's name, tags, children elements and so on. basically traverse the DOMDocument below this DOMElement) but I'm not familiar with the xerces-c codebase.

Any idea of how I can go about doing this?

Additional info :- I'm using gdb.

Это было полезно?

Решение

If you are using gdb I assume you are using linux, right? Then you should install libexerces-c++-dev (or libexerces-c++-devel depending on your distribution) packet AND the source code. This would allow you to even set breakpoints in the xerces code.

I've been using xerces a lot in the past and when it crashes generally the problem is not in the library itself but in the "caller". In your case I'd create a very trivial project using the external library, and try to parse a simple known-to-work XML file, because even if you can find the crash instructions I doubt it would help, given that xerces is used not directly by you but by another library

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top