[GCC-XML] How to debug gccxml?

Daniel J. Lauk dj at djlauk.de
Mon Jan 16 12:03:43 EST 2006


Well, I did as you described and I found that my code bails out on a function 
call. I have absolutely no clue, what's going on.
Might it be, that this is some issue about static and non-static functions?

Practically *all* my functions are static, besides an entry point to 
the .c-file which is non-static. The code snippets are below.

Did I get something wrong about static functions? I mean it's all a visibility 
question, right? xml.c could not call DJL_xml_output_body(...) directly, 
because it's static. This is why there is a specific entry function, which is 
non-static. Sounded like a good idea to me...


/* your entry point to this module */
void do_xml_dump_body(xml_document_info_p xdi, tree t, int indent_level) {
    /* this is where SIGSEGV gets triggered   :-(   */
    DJL_xml_output_body(xdi->file, t, indent_level);

 /* ... skipping several lines ... */
static void DJL_xml_output_body(FILE *file, tree t, int indent_level) {
  DJL_xml_open_tag(file, indent_level++, "Body");
  DJL_xml_output_statement(file, t, indent_level);
  DJL_xml_close_tag(file, --indent_level, "Body");

Am Sonntag, 15. Januar 2006 17:02 schrieb Brad King:
> Daniel J. Lauk wrote:
> > 1) How do I make a debug build of gccxml? (couldn't find appropriate
> > CMake docs)
> Set CMAKE_BUILD_TYPE to "Debug" in the configuration dialog.
> > 2) How would I run the gdb (or any GUI frontend) so that it breaks inside
> > of xml.c:do_xml_output?
> First run the main program "gccxml" as normal but add the "--debug"
> option.  It will print the full command line for gccxml_cc1plus.  Then
> you can use that command line inside gdb.
> -Brad

More information about the gccxml mailing list