Difference between revisions of "Windows Debugging"

From GnuCash
Jump to: navigation, search
(Exetype: remove references to MSYS and install.sh)
(Debugging with gdb: removed again, the current version is Stack_Trace#Windows)
 
Line 13: Line 13:
 
exetype.pl gnucash-bin.exe console
 
exetype.pl gnucash-bin.exe console
 
</syntaxhighlight>
 
</syntaxhighlight>
 
== Debugging with gdb ==
 
In addition to [[Stack Trace]], here are a few instructions on how to run gnucash under gdb on Windows:
 
* Install "gdb" from mingw.org [http://downloads.sourceforge.net/mingw/gdb-6.3-1.exe]
 
*'''GnuCash 2.4.0 and more recent'''
 
:* Open a Windows command prompt and type:
 
    set PATH=C:\Program Files\gdb\bin;%PATH%
 
    gdb "C:\Program Files\gnucash\bin\gnucash"
 
::Be careful to use the actual paths in which you have installed gdb and gnucash respectively.
 
* '''GnuCash 2.2.9 and older'''
 
:* Modify the installed "bin\gnucash.cmd" script by inserting one and changing one line.  It should end like
 
    set PATH=C:\Program Files\gdb\bin;%PATH%
 
    start gdb --args gnucash-bin %*
 
::Be careful to use the actual paths in which you have installed gdb.exe
 
:* Then start gnucash as usual
 
*'''For all versions''': this will open a gdb prompt
 
* Type <tt>run</tt> at the gdb prompt.
 
* Then provoke the crash and type <tt>backtrace</tt> or shorthand <tt>bt</tt> at the gdb prompt to obtain the backtrace, as explained on [[Stack Trace]] as well.
 
 
('''2.2.9 and older only''')If you are working in a MinGW shell, you may want to change and call the bin\gnucash script instead and use <tt>exec start gdb --args gnucash-bin "$@"</tt> to make <tt>Ctrl-C</tt> actually work.
 
 
If you build gnucash with the help of install.sh, make sure you export <tt>DISABLE_OPTIMIZATIONS=yes</tt> in <tt>packaging/win32/custom.sh</tt> to include debugging symbols and avoid optimizations that complicate debugging.
 
 
You can provide even better stack traces if you tell gdb where in memory dynamically loaded modules got mapped to, because otherwise function calls into those are only written as '??'. See [http://lists.gnucash.org/pipermail/gnucash-devel/2006-November/019042.html here] and [http://lists.gnucash.org/pipermail/gnucash-devel/2006-November/019048.html here] for a way to do this.
 
 
To enter <tt>[</tt> and <tt>]</tt>, use <tt>set editing off</tt>.
 

Latest revision as of 21:59, 19 December 2019

Troubleshooting under Windows is slightly different from POSIX conform operating systems. The differences are handled here.

Error messages, Trace file

When running into problems when running GnuCash, the trace file is usually your first stop to look for errors. You will find more details on this file here (Windows specific) and here (More generic).

Changing the Exetype to See Console Output

All executables and DLLs on Windows operate in one of a few different subsystems, most of them either in Console or GUI (also called Windows). Basically, executables in Console always start up in a new console window and print output for stdout und stderr to it, whereas ones in GUI do not open windows and are pretty quiet, even in console windows. If you want to change that subsystem type, because you want to see debugging output or hide unnecessary console windows, [1] lists a few possible ways.

The easiest option if you don't have any further build tools available is probably the third one from that mail:

  1. Fetch https://github.com/Gnucash/gnucash-on-windows/blob/master/exetype.pl
  2. Install Perl, if not already done for Online Quotes and
  3. start cmd.exe type
    exetype.pl gnucash-bin.exe console