Difference between revisions of "Debugging Inkscape"

From Inkscape Wiki
Jump to navigation Jump to search
(Tips for debugging on Windows)
Line 10: Line 10:
Second, make use of the '''View > Messages...''' dialog from within the program.  Capturing the log here will show you messages printed with g_message(), g_warning(), and g_error()..
Second, make use of the '''View > Messages...''' dialog from within the program.  Capturing the log here will show you messages printed with g_message(), g_warning(), and g_error()..


Finally, look into [http://wiki.inkscape.org/wiki/index.php/FAQ#I.27m_on_Windows.2C_and_command_line_parameters_don.27t_seem_to_work.21 how to compile Eclipse as a command line app] so you can capture debug messages at the prompt, more like you would do in Linux.
Finally, look into [http://wiki.inkscape.org/wiki/index.php/FAQ#I.27m_on_Windows.2C_and_command_line_parameters_don.27t_seem_to_work.21 how to compile Inkscape as a command line app] so you can capture debug messages at the prompt, more like you would do in Linux.
 
===How Johan works===
Of course I am always compiling with [http://wiki.inkscape.org/wiki/index.php/FAQ#I.27m_on_Windows.2C_and_command_line_parameters_don.27t_seem_to_work.21 -mconsole, instead of -mwindows]. I don't compile with -g or any other extra flags. This is unnecessary and reduces build times <i>significantly</i>.
 
For example for crashes, usually I add g_message("blah") to the code to see where the execution of code goes and to see on which line things break:
 
    g_message("1");
    some_piece_of_code1();
    g_message("2");
    some_piece_of_code2();
    g_message("3");
    some_piece_of_code3();
    g_message("4");
    some_piece_of_code4();
    g_message("5");
 
If I see the message "2" but not "3" I know the crash happened in  some_piece_of_code2.
 
I also use GDB to get backtraces. Again, don't compile with -g. Not necessary at all! One of the problems with running Inkscape in gdb is that you cannot open a file with the file dialog: Inkscape will hang. I don't know the reason, but I do know a solution! Open the file through Inkscape's cmdline parameters:
 
    D:\Inkscape\inkscape>gdb
    GNU gdb 6.6
    Copyright (C) 2006 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB.  Type "show warranty" for details.
    This GDB was configured as "i686-pc-mingw32".
    (gdb) file inkscape.exe inkscape.dbg
    Reading symbols from D:\Inkscape\inkscape/inkscape.exe...(no debugging symbols found)...done.
    Reading symbols from D:\Inkscape\inkscape/inkscape.dbg...done.
    (gdb) run Tekening.svg
    Starting program: D:\Inkscape\inkscape/inkscape.exe Tekening.svg


[[Category:Developer Documentation]]
[[Category:Developer Documentation]]

Revision as of 18:22, 23 November 2007

  • If you're hunting down a GTK warning, you can set a breakpoint in gdb for "g_logv" so you can capture a backtrace. ("br g_logv", "run", "bt")
  • Bug list

- w32 version asks for (that crappy) Verdana typeface (which is not the most usual w32 typeface, also some users have deleted it to save disk space)

Debugging Tips for Windows

First, have a look at the Using Eclipse page for how to use that program on Windows to debug Inkscape.

Second, make use of the View > Messages... dialog from within the program. Capturing the log here will show you messages printed with g_message(), g_warning(), and g_error()..

Finally, look into how to compile Inkscape as a command line app so you can capture debug messages at the prompt, more like you would do in Linux.

How Johan works

Of course I am always compiling with -mconsole, instead of -mwindows. I don't compile with -g or any other extra flags. This is unnecessary and reduces build times significantly.

For example for crashes, usually I add g_message("blah") to the code to see where the execution of code goes and to see on which line things break:

   g_message("1");
   some_piece_of_code1();
   g_message("2");
   some_piece_of_code2();
   g_message("3");
   some_piece_of_code3();
   g_message("4");
   some_piece_of_code4();
   g_message("5");

If I see the message "2" but not "3" I know the crash happened in some_piece_of_code2.

I also use GDB to get backtraces. Again, don't compile with -g. Not necessary at all! One of the problems with running Inkscape in gdb is that you cannot open a file with the file dialog: Inkscape will hang. I don't know the reason, but I do know a solution! Open the file through Inkscape's cmdline parameters:

    D:\Inkscape\inkscape>gdb
    GNU gdb 6.6
    Copyright (C) 2006 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB.  Type "show warranty" for details.
    This GDB was configured as "i686-pc-mingw32".
    (gdb) file inkscape.exe inkscape.dbg
    Reading symbols from D:\Inkscape\inkscape/inkscape.exe...(no debugging symbols found)...done.
    Reading symbols from D:\Inkscape\inkscape/inkscape.dbg...done.
    (gdb) run Tekening.svg
    Starting program: D:\Inkscape\inkscape/inkscape.exe Tekening.svg